Skip to content

a journey with a focus on exploration and discovery in backend nest development, how we can deal with variety of data sources, ideal foundation with high speed data processing. {{ NestJS, Redis, MongoDB, Docker }}

License

Notifications You must be signed in to change notification settings

DevSazal/backend-nest-sprint

Repository files navigation

Backend Nest Sprint

exploration of rest api with testable code

Requirements:

🎁 If you are a big fan of docker, just don't wait, clone the repository and use the following docker commands:

# to run with docker-compose.yml
docker-compose up

Let's clone the repository on your machine.

The application includes the following files and folders.

  • src - code for the application written in TypeScript, NestJS, Express.js.
  • cli - node cli script which can be performed from terminal.
  • test - to test all the features.
  • docker-compose.dev.yml - to run in develoment mode.
  • docker-compose.yml - to run in production mode.
  • .env.example - a sample of .env which can be helpful for configuration.
# architecture
# deep drive in src directory

src/
├── developer/
│   ├── dto/
│   │   ├── developer.dto.ts
│   │   └── index.ts
│   │
│   ├── schemas/
│   │   └── developer.schema.ts
│   │
│   ├── developer.controller.ts
│   ├── developer.module.ts
│   ├── developer.service.ts
│   └── in-memory-developer.service.ts
│
├── core/
│   ├── enums/
│   │   └── EDeveloper.ts
│   │
│   └── interfaces/
│       ├── IDeveloperService.ts
│       └── IService.ts
│
├── app.module.ts
└── main.ts

Installation and Configuration

Let's move to the cloned directory with your terminal.

To install, build, and start the application for the first time, run the following commands in your shell using makefile (only for macOS and Linux):

make install

Let's rename from .env.example to .env and make sure all the necessary information is correct:

PORT=3000

MONGODB_URI=<MongoDB_ATLAS_URI>
REDIS_URL=<REDIS_CLOUD_URL>
CACHE_TTL=180

Already done? Cool! You are almost ready to enjoy the app. ⛳️

Build:

make build

Run:

make start

# development mode
# with docker
make start-dev

# production mode
make start-prod

Test:

Oh! You wanna trigger testing for the application from terminal

# e2e test in production
make test

# e2e test development
make test-dev

Lint:

make lint

make eslint

🎯 I know, you liked it.

To learn more, you can use the following commands: 

make help

at the same time, you can use the default npm commands like:

npm i
npm run build

# run
npm run start
npm run start:dev
npm run start:prod

# production mode
npm run test:e2e
# development mode
npm run test:e2e:dev

# lint
npm run lint
npm run eslint

🎯 Have question about api endpoints? Please check out our details guide

🥇 Congrats!! You are good to go

🧑‍💻 Stay in touch

tada! 🎉

About

a journey with a focus on exploration and discovery in backend nest development, how we can deal with variety of data sources, ideal foundation with high speed data processing. {{ NestJS, Redis, MongoDB, Docker }}

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published