https://github.com/bharatkalluri/nestjs-starter
NestJS + TS + MongoDB using Mongoose + Firebase auth + AWS + Swagger + ESLint + Prettier + Git hooks
https://github.com/bharatkalluri/nestjs-starter
backend boilerplate mongodb mongoose nestjs nodejs template
Last synced: 3 months ago
JSON representation
NestJS + TS + MongoDB using Mongoose + Firebase auth + AWS + Swagger + ESLint + Prettier + Git hooks
- Host: GitHub
- URL: https://github.com/bharatkalluri/nestjs-starter
- Owner: BharatKalluri
- Created: 2020-12-14T09:56:13.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-03-18T06:32:19.000Z (over 2 years ago)
- Last Synced: 2025-03-06T02:56:51.262Z (over 1 year ago)
- Topics: backend, boilerplate, mongodb, mongoose, nestjs, nodejs, template
- Language: TypeScript
- Homepage:
- Size: 1010 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# An opinionated NestJS Typescript starter
## Features
Everything nest js gives out of the box (Hot Reloading, testing with `jest` etc), and
- A starter `User` mongoose schema with a get/create an endpoint using firebase user data
- JSON based config setup. Sample config at `config.json`
- JSON based Logging setup using [`Pino`](https://www.npmjs.com/package/pino)
- Per request UUID logging for easier traceability
- Docker setup
- Firebase auth setup! Along with decorators which can be used at endpoint levels.
- Sample module setup (`health-check`) with unit testing on service, and a sample e2e test.
- AWS SDK integration, sample s3 client as a starting point
- Rate limiting (pre configured to limit each IP to 100 requests per 15 minutes) using `express-rate-limit`
- OpenAPI/Swagger setup using `@nestjs/swagger`
- Data validation using `class-validator`
- Global exception handlers to capture `ServerError` with error codes and respond to client with corresponding error messages from `errorCodes.json`
- Connected to MongoDB using `@nestjs/mongoose`, using URL from config.
- Codebuild configuration setup (Uses `buildspec.yml` for build configuration and a env variable called `S3_BUCKET` for the bucket to retrieve `config.json` from. Go through the `buildspec.yml` for more information)
- `Procfile` setup for elastic beanstalk to start the nestJS node process at port 8080
- Pre commit hook which runs `tsc` and `prettier`
## TODO
- [ ] share local AWS config file with docker
## Installation
```bash
yarn
```
to set up hooks
```bash
yarn setuphooks
```
## Running the app
```bash
# development
$ yarn start
# watch mode
$ yarn start:dev
# production mode
$ yarn start:prod
```
## Running the app using docker
```bash
docker build -t server . && docker run -p 127.0.0.1:8080:8080 server
```
`server` is just the image tag name, it could be anything
## Verify if the server is up and running
```bash
~ ❯ curl http://localhost:3000/health-check
{"success":true}
```
## Test
```bash
# unit tests
$ yarn test
# e2e tests
$ yarn test:e2e
# test coverage
$ yarn test:cov
```