• Stars
    star
    532
  • Rank 83,377 (Top 2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 4 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

NestJS Starter Kit. Monolithic Backend. REST API.

NestJS Starter Kit [v2]

License: MIT Build Badge Tests Badge Quality Gate Status Coverage Code Smells

This starter kit has the following outline:

  • Monolithic Project.
  • REST API

This is a Github Template Repository, so it can be easily used as a starter template for other repositories.

Sample implementations

To view sample implementations based on this starter kit, please visit the nestjs-sample-solutions repository.

Starter kit Features

One of our main principals has been to keep the starter kit as lightweight as possible. With that in mind, here are some of the features that we have added in this starter kit.

Feature Info Progress
Authentication JWT Done
Authorization RBAC (Role based) Done
ORM Integration TypeORM Done
DB Migrations TypeORM Done
Logging winston Done
Request Validation class-validator Done
Pagination SQL offset & limit Done
Docker Ready Dockerfile Done
Auto-generated OpenAPI - Done
Auto-generated ChangeLog - WIP

Apart from these features above, our start-kit comes loaded with a bunch of minor awesomeness like prettier integration, commit-linting husky hooks, package import sorting, SonarCloud github actions, docker-compose for database dependencies, etc. :D

Consulting

Most of the features added to this starter kit have already been tried out in production applications by us here at MonstarLab. Our production applications are more feature rich, and we constantly strive to bring those features to this OSS starter kit.

If you would like to use a more feature rich starter kit, with more awesome features from Day 1, then please reach out to us and we can collaborate on it together as technology partners. :)

Installation

Note: when using docker, all the npm commands can also be performed using ./scripts/npm (for example ./scripts/npm install). This script allows you to run the same commands inside the same environment and versions than the service, without relying on what is installed on the host.

$ npm install

Create a .env file from the template .env.template file.

Generate public and private key pair for jwt authentication:

With docker

Run this command:

./scripts/generate-jwt-keys

It will output something like this. You only need to add it to your .env file.

To setup the JWT keys, please add the following values to your .env file:
JWT_PUBLIC_KEY_BASE64="(long base64 content)"
JWT_PRIVATE_KEY_BASE64="(long base64 content)"

Without docker

$ ssh-keygen -t rsa -b 2048 -m PEM -f jwtRS256.key
# Don't add passphrase
$ openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub

You may save these key files in ./local directory as it is ignored in git.

Encode keys to base64:

$ base64 -i local/jwtRS256.key

$ base64 -i local/jwtRS256.key.pub

Must enter the base64 of the key files in .env:

JWT_PUBLIC_KEY_BASE64=BASE64_OF_JWT_PUBLIC_KEY
JWT_PRIVATE_KEY_BASE64=BASE64_OF_JWT_PRIVATE_KEY

Running the app

We can run the project with or without docker.

Local

To run the server without Docker we need this pre-requisite:

  • Postgres server running

Commands:

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Docker

# build image
$ docker build -t my-app .

# run container from image
$ docker run -p 3000:3000 --volume 'pwd':/usr/src/app --network --env-file .env my-app

# run using docker compose
$ docker compose up

Learn more about Docker conventions here. (WIP - Currently this is an internal org link.)

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Migrations

# using docker
$ docker compose exec app npm run migration:run

# generate migration (replace CreateUsers with name of the migration)
$ npm run migration:generate --name=CreateUsers

# run migration
$ npm run migration:run

# revert migration
$ npm run migration:revert

Architecture

Contributors

External Links

Nest Logo

SonarCloud

More Repositories

1

reality-check

Level up your AR development workflow with RealityCheck: an open-source Mac app for streamlined debugging and real-time preview of AR projects built with RealityKit
Swift
64
star
2

flutter-template

Flutter template using CLEAN architecture ๐ŸŽฏ
Dart
31
star
3

ios-template

CleanArchitecture Combine+UIKit template with MVVM Coordinator support
Swift
28
star
4

admin-panel-template-reactjs

TypeScript
25
star
5

deepl-for-slack-elixir

Elixir
20
star
6

android-template

Kotlin
14
star
7

ml-frontend

A monorepo created to provide a starter kit for front-end projects at Monstar Lab, Inc.
TypeScript
14
star
8

flutter-template-riverpod

flutter-template-riverpod
Dart
12
star
9

nestjs-sample-solutions

NestJS sample implementations. Solutions to defined Problem Statements.
TypeScript
10
star
10

ui_dynamo

A Flutter library to assist in rapid development for scalable mobile applications visually using component-driven design.
Dart
9
star
11

swiftui-template-tca

Swift
8
star
12

kedux

A kotlin multiplatform Redux implementation utilizing Kotlin Coroutines and Flow โค๏ธ
Kotlin
7
star
13

ui-manifesto

7
star
14

nestjs-starter-graphql-api

TypeScript
6
star
15

sonarqube-github-action

Sonarqube in Github Action
Dockerfile
6
star
16

n-meta-php

PHP
6
star
17

API-manifesto

Documents how to write APIs
5
star
18

honkit-ghpages-action

GitHub Action for build gitbook documents by honkit and publish to GitHub Pages
Shell
5
star
19

web-frontend-readme

This document acts as the index.html of everything relevant for doing Frontend in Monstarlab.
4
star
20

deepl-for-slack

Slack app for DeepL Translate API users
TypeScript
4
star
21

numba-solidjs

This tool provides easy assigning the numbers to your designs.
TypeScript
4
star
22

readme-jp

Monstarlab Japan Technology Documentation
4
star
23

lib-log-viewer

A library for storing and analysing logs within a debugged application
Kotlin
4
star
24

n-meta-laravel

PHP
3
star
25

KMP-Template

Kotlin
3
star
26

vuejs-boilerplate

TypeScript
2
star
27

multipass-docker

Shell
2
star
28

bitrise-changelog-step

JavaScript
2
star
29

flutter_lints

Strict and efficient Flutter linter rules used by Monstarlab : :
Dart
2
star
30

android-mosaic

Collection of UI Components for Android
Kotlin
2
star
31

flutter-apple-privacy-policy-related

Information and tooling to detect plugins requiring privacy policy manifest
Shell
2
star
32

flutter-bricks

Flutter project scaffold with Mason CLI for efficient feature creation from bricks. ๐Ÿงฑ
Dart
2
star
33

android-arch

1
star
34

security

Resources, guides, documentation and everything else related to security.
1
star