Skip to content

Nestjs full backend monolith kickstarter containing all sensible defaults and following best practices for each implementation.

License

Notifications You must be signed in to change notification settings

endalk200/NestXcelerator-mon

Repository files navigation

NestXcelerator

Welcome to NestXcelerator, a powerful and flexible NestJS starter template designed to kickstart your backend monolith projects. NestXcelerator provides a solid foundation equipped with all the essential features and best practices to ensure scalability, maintainability, and developer happiness.

Motivation

Note

Internal Developer Platforms (IDPs) are tools that help teams within a company build and manage software more easily. Think of them as a one-stop shop for developers, providing everything they need to write, test, and deploy their applications. IDPs automate many tasks, making it faster and simpler for developers to work without getting bogged down in complicated processes. This boosts productivity and helps teams deliver better software more consistently.

The concept of internal developer platform (IDP) is something I am really interested in for a while. This projects is meant to server as template for an IDP I'm building. This template project will be used in the IDP to quickly kickstart backend projects with sensible defaults and best practices thus boosting developer productivity.

Table of Contents

Technologies

  • Typescript: Offers type safety when building backend APIs in nodejs
  • NestJs: Provides best in class developer experience building backend APIs using nodejs
  • Prisma: Database ORM
  • ts-rest: Provides excellent developer experience by empowering you to build fuly type safe API endpoints utilizing api contracts
  • Postgres: a powerful, open source object-relational database system with over 35 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance.
  • React Email: For building email templates
  • Resend: For sending emails

Getting Started

Install all dependencies

npm install

In order for the authentication endpoints to work, generate public/private key pair which will be used for generating and verifying JWTs.

# Generate private key using P-256 curve
openssl ecparam -genkey -name prime256v1 -noout -out ec-private.pem

# Generate corresponding public key
openssl ec -in ec-private.pem -pubout -out ec-public.pem

Features

General

  • API
    • Health check endpoints checking HTTP, memory health (rss and heap) and prisma database connection
    • Open API spec v3 support and UI using swagger
    • Typesafe API contract
    • Client SDK supporting fetch and react-query
  • Email integration
    • Email template support using react-email
    • Email service integration:
      • Resend
      • SendGrid
      • MailGun
      • AWS SES
  • File upload using uploadthing

Database

  • Database support
    • Postgres
    • MySQL
  • ORM
    • Prisma
    • Drizzle

Security

  • JWT based authentication. accessToken is secured by using ES256 hashing via private public key pair. (ES256 is an Elliptic Curve Digital Signature Algorithm (ECDSA) that uses the P-256 curve and SHA-256 hash function.)
  • Authentication guard verifying JWT expiration, issuer and audience for maximum security
  • Authorization guard that implements Role Based Access Conrtol (RBAC)
  • Securely stored password hashed using Blowfish cipher hashing algorithim.
  • Issued refresh token is unique to the device and is stored securely
  • Refresh token functionality while revoking used refresh token for one time use refresh tokens.
  • Active session management including revokation.
  • Rate limitter integration. Configured for:
    • Email verification endpoint
    • Password resent endpoint
  • Password reset functionality

Deployment

  • Production ready dockerfile
    • Multi stage build for small docker image
    • Health check mechanisim for monitoring
  • CI/CD

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

We welcome contributions! Please fork the repository, create a feature branch, and submit a pull request.

Maintainers

This module is maintained by Endalkachew Biruk.

About

Nestjs full backend monolith kickstarter containing all sensible defaults and following best practices for each implementation.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published