This project implements a RESTful API with authentication, MongoDB and PostgreSQL database connections, and various environment configurations.
To run this project, you need:
- Node.js (v18.x or later)
- npm (v8.x or later)
- MongoDB instance (one for each environment)
- PostgreSQL database (one for each environment)
- Git
- Clone the repository
git clone https://github.com/pineapple-EPITA/Software-Integration-Final-Project.git
cd Software-Integration-Final-Project- Install dependencies
npm install- Configure environment variables
Create environment files for the environment you want to run. Use the template in .env.template as a guide:
.env.dev- Development environment.env.release- Release environment.env.pprod- Pre-production environment.env.prod- Production environment
Example for dev environment:
# .env.dev
NODE_ENV=development
MONGO_URI=mongodb+srv://username:[email protected]/dev-database
DB_USER=postgres_user
DB_PASSWORD=your_password
DB_HOST=your_host
DB_PORT=5432
DB_NAME=dev_database
SESSION_SECRET=your_dev_session_secret
PORT=8080- Run the application in the desired environment
# Development
npm run start:dev
# Release
npm run start:release
# Pre-production
npm run start:pprod
# Production
npm run start:prod- Run tests
npm testYou need to set up four MongoDB databases (one for each environment):
- Create a MongoDB Atlas account or use a local MongoDB server
- Create separate databases for each environment
- Configure the connection strings in your environment files
You need to set up four PostgreSQL databases (one for each environment):
- Install PostgreSQL or use a cloud provider like AWS RDS
- Create separate databases for each environment
- Configure the connection details in your environment files
This project uses GitHub Actions for CI/CD. The workflows are configured to:
- Run tests and linting on pull requests
- Deploy to the appropriate EC2 instance on pushes to main (production) or develop (development)
├── .github/ # GitHub Actions workflows
├── dist/ # Compiled output
├── src/ # Source code
│ ├── boot/ # Application bootstrap code
│ ├── constants/ # Constants and enums
│ ├── controllers/ # Route controllers
│ ├── middleware/ # Express middleware
│ ├── models/ # Database models
│ ├── routes/ # Route definitions
│ ├── types/ # TypeScript type definitions
│ └── __tests__/ # Test files
├── .env.* # Environment configurations (not in repo)
├── .eslintrc.json # ESLint configuration
├── jest.config.cjs # Jest configuration
└── tsconfig.json # TypeScript configuration
- Create a feature branch:
git checkout -b feat/feature-name - Make your changes
- Follow commit message conventions:
type: description - Push and create a pull request
This project is licensed under the MIT License.
This project follows the Conventional Commits specification for commit messages. All commit messages must follow this format:
<type>: <description>
- Recommended types: ['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test']
For example:
chore: set up lint and prettier
docs: update installation instructions
test: add Unit tests using Jest
A git hook is in place to enforce this convention. See Commit Convention for details.
After cloning the repository, run this command to set up node.js
npm install
npm run prepareIf your commit message does not follow the format, the commit will be blocked.