This project serves as a comprehensive template for building scalable and maintainable backend services using NestJS. It incorporates best practices and provides a solid foundation for developing robust applications.
- Modular Architecture: Organized around feature modules to keep the codebase clean and scalable.
- Authentication and Authorization: Built-in support for user authentication and role-based authorization.
- Email Service: Integrated email service for user verification, password reset, and other notifications.
- Database Migrations: TypeORM migrations for easy database schema management.
- Docker Support: Containerization support with Docker for development and production environments.
- Continuous Integration and Deployment: Pre-configured GitHub Actions workflows for CI/CD.
- Comprehensive Testing: Unit and e2e testing setup with Jest.
- Node.js (v14 or later)
- Docker and Docker Compose (for containerized environments)
- (Optional) Remove from .gitignore /migrations folder, if you want to share your migrations at git.
- (Optional) Add .env.production for some prod env or just add required env, at your environment.
- Install dependencies:
yarn install
- Copy the
.env.development
and.env.test
files and configure them according to your environment:
cp .env.development .env
For run additional services like PostgreSQL and email service for local development, run docker-compose:
docker-compose up --build
To run the application in development mode:
npm run start:dev
Generating init migrations:
yarn run typeorm migration:generate -d src/ormconfig.ts migrations/MIGRATION_NAME
To apply database migrations:
yarn run typeorm migration:run
All scripts for migrations also have in package.json
Once the application is running, you can access the API at http://localhost:3000.
After starting the application, API docs will be available at http://localhost:3000/api/
-
pgAdmin: Access pgAdmin for database management at http://localhost:5050/browser/. Default authentication data:
- Login: admin@example.com
- Password: qwerty123
-
MailHog: Access MailHog for local email testing at http://localhost:8025/.
All credentials for local development can be viewed and modified in the .env.development
file.
To run unit tests:
npm run test
To run e2e tests:
npm run test:e2e
Contributions are welcome! Please open an issue or submit a pull request with your improvements.
This project is licensed under the MIT License - see the LICENSE file for details.