- Nest.js framework for building scalable and modular applications
- PostgreSQL as the relational database management system
- Prisma as the database toolkit for type-safe database access and migrations
- Fully configured for development and production environments
- Includes example code for creating users using controllers, services, and DTOs
- Docker Compose setup for easy deployment and containerization
Before running the project, ensure that you have the following software installed on your machine:
- Docker and Docker Compose (for containerization)
- Node.js (version 14 or higher)
- PostgreSQL (optional, if you want to run the database locally instead of using Docker)
- Clone the repository and navigate to the project directory.
- Create a
.env
file in the project root and set the necessary environment variables. Refer to the provided example in the README for the required variables. - There's a .env.example with example of required envs to start the project =)
- Run
docker-compose up
to start the project with Docker, or manually start the PostgreSQL database and run the project locally usingnpm run start:prod
. - Access the application by visiting http://localhost:3000 in your browser.
The project follows a structured folder hierarchy to maintain a clean and organized codebase. Here's an overview of the main directories:
src/infra
: Contains infrastructure-related code, such as configuration files for Prisma.src/user
: Represents the user domain module, including application-specific code.src/user/application
: Contains the controllers and services related to user management.src/user/data
: Includes repositories and use cases for data access and business logic.src/domains
: Contains shared domain-related entities, interfaces, and repositories.src/dtos
: Contains Data Transfer Objects (DTOs) used for data validation and input/output.src/user.module.ts
: Defines the user module and its dependencies.src/app.module.ts
: Main module file that imports all the required modules and sets up the application.test/
: Contains test files and configurations.
Feel free to modify the project structure according to your specific requirements.
- prisma
- migrations
- schema.prisma
- src
- infra
- config
- prisma.module
- prisma.service
- config
- user (context)
- application
- controllers
- services
- data
- repositories
- use-cases
- application
- domains
- entities
- interfaces
- repositories
- dtos
- user.module.ts
- infra
- app.module.ts
- test
Contributions to this boilerplate project are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
This project is licensed under the MIT License.
Enjoy building amazing applications with Nest.js, PostgreSQL, and Prisma!