A web app built for nonprofit organization Patriots and Paws to process and analyze veteran service requests (VSRs). Includes a digital VSR for veterans, and an admin portal for staff.
This project is built with MongoDB, Express.js, Node.js, React, TypeScript, Next.js, and Firebase.
- Git
- Text Editor (VS Code, Notepad, Vim, etc.)
- Prettier VS Code extension to auto-format code (recommended)
- Node.js and NPM
- MongoDB
Before running the project, you must configure environment variables for the frontend and backend. Environment variables contain information that may be different between different developers and development vs. production environments, and/or may be sensitive information we don't want to put in our public GitHub repos (e.g. Firebase keys, email account password).
See the .env.example files in both the frontend and backend for a list of environment variables and example values. The real values (for sensitive variables, such as Firebase settings) can be found in our project's Google Drive (TSE Drive -> PAP -> Development -> Environment Variables). Note that on Google Drive, the environment variable files are named .env.backend.development and .env.frontend.development, but you will need to rename them to just .env when you put them in the backend and frontend directories respectively. This is because by default, our code will look for a file named .env to get environment variables from.
Once your environment variables are setup, your file structure for the project should look like:
- PAP-Inventory-Processing
- backend/
- .env (renamed from
env.backend.development) -
- [other directories & files]
- .env (renamed from
- frontend/
- .env (renamed from
env.frontend.development) -
- [other directories & files]
- .env (renamed from
- [other directories & files]
- backend/
The src/util/validateEnv.ts files in both the frontend and backend list the expected types for each environment variable, and will throw an error if any environment variables are missing or of the wrong format when you run the project.
- First, ensure that MongoDB is running on your machine on the port specified in the
MONGODB_URIenvironment variable cd backendto go to the backend directorynpm installto install dependenciesnpm run startto run backend
cd frontendto go to the frontend directorynpm installto install dependenciesnpm run devto run frontend in development mode
This project has ESLint and Prettier set up to run linting and code formatting, respectively, whenever you run git commit. All of the following scripts are available for both the frontend and backend:
npm run lint-checkruns lint checks on your code.npm run lint-fixfixes any automatically fixable lint errors.npm run formatruns code formatting checks and fixes any formatting errors.
This project has unit tests for the frontend and backend, using the Jest testing framework. The tests are located in the __tests__ directories within both the frontend and backend directories. To run unit tests for either frontend or backend, run npm run test.