Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/doannc2212/nestjs-starter
https://github.com/doannc2212/nestjs-starter
bun clean-architecture cqrs cqrs-architectural-pattern docker domain-driven-design graphql grpc javascript nestjs schema-first typeorm typescript
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/doannc2212/nestjs-starter
- Owner: doannc2212
- Created: 2025-01-02T03:34:09.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2025-02-11T05:45:56.000Z (3 days ago)
- Last Synced: 2025-02-11T06:28:48.754Z (3 days ago)
- Topics: bun, clean-architecture, cqrs, cqrs-architectural-pattern, docker, domain-driven-design, graphql, grpc, javascript, nestjs, schema-first, typeorm, typescript
- Language: TypeScript
- Homepage:
- Size: 335 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
I was unable to retrieve the current `README.md` file. Let's start with creating a new one. Here is a draft:
---
# NestJS Starter
## Overview
This repository is a starter template for NestJS applications. It includes several essential features and configurations to help you get started quickly.
## Features
- **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.## Getting Started
### Prerequisites
- Node.js
- Bun
- Docker (optional for running databases)### Installation
1. Clone the repository:
```bash
git clone https://github.com/doannc2212/nestjs-starter.git
cd nestjs-starter
```2. Install dependencies:
```bash
bun install
```3. Configure environment variables by copying `.dev.env` to `.env` and updating the values as needed.
### Running the Application
To start the application, use the following command:
```bash
bun start:dev
```### Database Migration
To run database migrations, use the following command:
```bash
bun migration:run
```To create database migrations, use the following command:
```bash
NAME= bun migration:create
```### Using gRPC
To use gRPC, configure your services and proto files, and start the gRPC server:
### Using GraphQL
To use GraphQL, navigate to `/graphql` endpoint in your browser to access the GraphQL playground.
## Example API
### Pagination
Example code for pagination:
```typescript
@Get()
async findAll(@Query() query: PaginationQueryDto) {
return this.service.findAll(query);
}
```### Create, Update, Delete, Read Operations
Example code for creating a record:
```typescript
@Post()
async create(@Body() createDto: CreateDto) {
return this.service.create(createDto);
}
```## Error Handling and Interceptors
Centralized error handling and custom interceptors are configured to manage responses and errors efficiently.
## Todo
- [x] Infrastrucutre
- [x] Aggregate
- [x] Repository
- [x] Presentation (graphql and grpc)
- [x] Service communication
- [ ] Observability
- [x] Linter config (commitlint and eslint)
- [x] Formatter
- [x] First api example
- [ ] Implement transaction chaning. Be aware that asynclocalstorage is currently not work with bun in some case
https://github.com/oven-sh/bun/issues/6393
- [ ] take an eye on this: https://github.com/SocketSomeone/nestjs-resilience## License
This project is licensed under the MIT License.
---
Feel free to update or add any specific details as needed.
---