Skip to content

Latest commit

 

History

History
145 lines (105 loc) · 4.36 KB

README.md

File metadata and controls

145 lines (105 loc) · 4.36 KB

NestJS Backend Architecture Project

Docker Compose CI

WhereIsMyMotivation

Cover

This is a complete production ready project to learn modern techniques and approaches to build a performant and secure backend API services. It is designed for web apps, mobile apps, and other API services.

Framework

  • NestJS
  • Express Node
  • Typescript
  • Mongoose
  • Mongodb
  • Redis
  • JsonWebToken
  • Jest
  • Docker
  • Multer

Highlights

  • API key support
  • Token based Authentication
  • Role based Authorization
  • Database dump auto setup
  • vscode template support
  • Unit Tests
  • Integration Tests
  • 75% plus Test Coverage
  • Clean and modular codebase

Notes

A few things are added to aid the learning process

  • disk submodule is added to provide images
  • database dump is added to seed the database

About Project

WhereIsMyMotivation is a concept where you see videos and quotes that can inspire you everyday. You will get information on great personalities and make them your perceived mentors. You can also subscribe to topics of your interests.

You can track your happiness level and write down daily journals. You can also share things of interest from web to store in your motivation box.

Using this app can bring a little bit of happiness and energy to live an inspired life.

Read the Article to understand this project

Mastering NestJS — Building an Effective REST API Backend

Android App using this backend

Screenshot-Light

The Android App using this backend is also open-sourced. You can find the project here: Modern Android Development - WhereIsMyMotivation

Request-Response Flow

Request-Response-Design

Installation Instruction

vscode is the recommended editor - dark theme

Get the repo

# clone repository recursively
git clone https://github.com/unusualcodeorg/wimm-node-app.git --recursive

Install libraries

$ npm install

Run Docker Compose

# install and start docker containers
docker-compose up --build

Run Tests

docker exec -t tester npm run test:cov

If having any issue

  • Make sure 3000 port is not occupied else change PORT in .env file.
  • Make sure 27017 port is not occupied else change DB_PORT in .env file.
  • Make sure 6379 port is not occupied else change REDIS_PORT in .env file.

Run on the local machine

Change the following hosts in the .env and .env.test

  • DB_HOST=localhost
  • REDIS_HOST=localhost

Best way to run this project is to use the vscode Run and Debug button. Scripts are available for debugging and template generation on vscode.

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

API DOC

API Documentation

Minimalistic version of this project

If you want to use plain Express.js to create the same project explore the Minimalistic version of this project

Minimalistic Backend Development - WhereIsMyMotivation

Find this project useful ? ❤️

  • Support it by clicking the ⭐ button on the upper right of this page. ✌️

More on YouTube channel - Unusual Code

Subscribe to the YouTube channel UnusualCode for understanding the concepts used in this project:

YouTube

Contribution

Please feel free to fork it and open a PR.