I was unable to retrieve the current README.md
file. Let's start with creating a new one. Here is a draft:
This repository is a starter template for NestJS applications. It includes several essential features and configurations to help you get started quickly.
- TypeORM Migration: Seamlessly manage database migrations using TypeORM.
- CLEAN Architecture: Implement a clean architecture to maintain scalable and maintainable code.
- gRPC: Integrate gRPC for efficient communication between microservices.
- GraphQL: Use GraphQL to build flexible and efficient APIs.
- Example API: Includes examples for pagination, create, update, delete, and read operations.
- Error Handling and Interceptors: Centralized error handling and custom interceptors for enhanced functionality.
- Node.js
- Bun
- Docker (optional for running databases)
-
Clone the repository:
git clone https://github.com/doannc2212/nestjs-starter.git cd nestjs-starter
-
Install dependencies:
bun install
-
Configure environment variables by copying
.dev.env
to.env
and updating the values as needed.
To start the application, use the following command:
bun start:dev
To run database migrations, use the following command:
bun migration:run
To create database migrations, use the following command:
NAME=<migration-name> bun migration:create
To use gRPC, configure your services and proto files, and start the gRPC server:
To use GraphQL, navigate to /graphql
endpoint in your browser to access the GraphQL playground.
Example code for pagination:
@Get()
async findAll(@Query() query: PaginationQueryDto) {
return this.service.findAll(query);
}
Example code for creating a record:
@Post()
async create(@Body() createDto: CreateDto) {
return this.service.create(createDto);
}
Centralized error handling and custom interceptors are configured to manage responses and errors efficiently.
- Infrastrucutre
- Aggregate
- Repository
- Presentation (graphql and grpc)
- Service communication
- Observability
- Linter config (commitlint and eslint)
- Formatter
- First api example
- Implement transaction chaning. Be aware that asynclocalstorage is currently not work with bun in some case oven-sh/bun#6393
- take an eye on this: https://github.com/SocketSomeone/nestjs-resilience
This project is licensed under the MIT License.
Feel free to update or add any specific details as needed.