This is a boilerplate for Nodejs (Nestjs/typescript) that can be used to make http server application.

Overview

Hexagonal architecture

Table of Contents

Overview

The hexagonal architecture, or ports and adapters architecture, is an architectural pattern used in software design. It aims at creating loosely coupled application components that can be easily connected to their software environment by means of ports and adapters. This makes components exchangeable at any level and facilitates test automation.


Code architecture

Group 4 1svg


source code

git clone https://github.com/MoeidHeidari/nestjs-boilerplate
cd monetary-transaction

Service build information

There are different stages of building the application for this service. Based on the environment you want to deploy we have different ways to build the application. following information may help with building the service.

Regular user

npm install

npm run build

npm run test:ci

npm start:{dev || debug || prod}

Advanced user

cd scripts

bash run.sh -h

2022.05.30.14.43

Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-buildDocker] [-runDocker] [-runApp] [-runDoc] [-packageHelm]

This script helps you to run the application in different forms. below you can get the full list of available options.

Available options:

-h, --help Print this help and exit

-buildDocker Build the docker image called "imageName:latest"

-runDocker Build the docker image and run on local machine

-runApp Run application with npm in usual way for development

-runDoc Generate the code documentation

-packageHelm makes a helm package from the helm chart.

Deployment

Helm

with the following instruction you can install the helm chart on an up and running kubernetes cluster.

cd k8s

helm install {sample-app} {app-0.1.0.tgz} --set service.type=NodePort

Kubernetes manifests

Alternativelly you can deploy the application on an up an running kubernetes cluster using provided config files.

cd k8s/configFiles
kubectl apply -f app-namespace.yaml, app-configmap.yaml, app-deployment.yaml, app-service.yaml

it should give you following output

namespace/app created
configmap/app-config created
deployment.apps/app created
service/app created

Monitoring and alerting

Health check

by calling the following endpoint you can make sure that the application is running and listening to your desired port

http://localhost:{port_number}/health

most probably you will get a result back as follow

Example

{"status":"ok","info":{"alive":{"status":"up"}},"error":{},"details":{"alive":{"status":"up"}}}

mertics

to get the default metrics of the application you can use the following endpoint

http://localhost:{port_number}/metrics

OpenApi

by calling the following endpoint you can see the Swagger OpenApi documentation and explore all the available apis and schemas.

http://localhost:{port_number}/api

Documentation

By running following comman you can generate the full code documentation (Compodoc) and get access to it through port 7000

npm run doc

http://localhost:7000

ToDo list

  • add terraform infrastructure
You might also like...

It is a Discord bot whose goal is to make it easier for server owners to create a so-called Staff/Mode Application

It is a Discord bot whose goal is to make it easier for server owners to create a so-called Staff/Mode Application

Application Bot MeCodes Application Bot It is a Discord bot whose goal is to make it easier for server owners to create a so-called administration sub

Dec 12, 2022

This is a repository that contains an simple NestJS API about Movies developed at Blue EdTech.

NestJS Movies Technologies and requirements NestJS JavaScript TypeScript Prisma MySQL Project This is a repository that contains an simple NestJS API

Sep 28, 2021

Starter template for NestJS 😻 includes GraphQL with Prisma Client, Passport-JWT authentication, Swagger Api and Docker

Instructions Starter template for 😻 NestJS and Prisma. Checkout NestJS Prisma Schematics to automatically add Prisma support to your Nest application

Jan 4, 2023

around nestjs, with prisma and some graphql lib,write less code,create power api

around nestjs, with prisma and some graphql lib,write less code,create power api

介绍 这是一个 prisma + nestjs + graphql 的集成示例 对于开发者来说,特别是使用 graphql 的时候,只需要写非常少量的代码即可完成数据的各种操作,同时也支持接口透传。 开发&部署 本地开发 npm run start:dev swagger 地址:http://loc

Nov 24, 2022

The nestjs cache module based on cache-manager & decorators 🍃

A progressive Node.js framework for building efficient and scalable server-side applications. zirus-cache zirus-cache for Nest.JS - simple and modern

May 9, 2022

API developed using NestJS, TypeORM, PgMem and concepts of Clean Architecture

API developed using NestJS, TypeORM, PgMem and concepts of Clean Architecture

The Powerful NestJS A progressive Node.js framework for building efficient and scalable server-side applications. Clean Architecture The project has b

Jan 2, 2023

NestJS + MikroORM example repository for testing within transactional contexts. Achieve a much faster test suite.

Description Nest NestJS + MikroORM example repository for testing within transactional contexts. Running tests in transactions will speedup your test

Dec 20, 2022

An in-depth implementation of Clean Architecture using NestJS and type-script

Clean Architecture With NestJS Description It's been a while since my last article on how to implement clean architecture on Node.js applications, git

Dec 28, 2022

external eventbus module for @nestjs/cqrs

A Cqrs External EventBus module for Nest framework (node.js) Now available: Redis-EventBus Installation with npm npm install --save nest-external-even

Dec 23, 2022
Owner
Moeid Heidari
Backend Developer
Moeid Heidari
Nestjs boilerplate for beginners.

Description Nest framework boilerplate. Installation $ npm install Running the docker for postgres or simply update env with running postgres values $

Harris Gurung 18 Nov 30, 2022
API Back-End de NodeJS com NestJS

A progressive Node.js framework for building efficient and scalable server-side applications. Description Nest framework TypeScript starter repository

Glaucio Daniel 5 May 29, 2022
The Blog system developed by nest.js based on node.js and the database orm used typeorm, the development language used TypeScript

考拉的 Nest 实战学习系列 readme 中有很多要说的,今天刚开源还没来及更新,晚些慢慢写,其实本人最近半年多没怎么写后端代码,主要在做低代码和中台么内容,操作的也不是原生数据库而是元数据Meta,文中的原生数据库操作也当作复习下,数据库的操作为了同时适合前端和Node开发小伙伴,所以并不是很

程序员成长指北 148 Dec 22, 2022
Nodeparse - A lightweight, vanilla replacement for Express framework when parsing the HTTP body's data or parsing the URL parameters and queries with NodeJS.

nodeparse A lightweight, vanilla replacement for Express framework when parsing the HTTP body's data or parsing the URL parameters and queries with No

Trần Quang Kha 1 Jan 8, 2022
Simple CRUD application with Nestjs, Prisma and Docker with Postgres

A progressive Node.js framework for building efficient and scalable server-side applications. Description Nest framework TypeScript starter repository

Torr7s 5 Nov 6, 2022
ObjectionJS on steroids for your nestjs application!

Introduction Almost every application nowadays, requires a database to persist data. We have integrated ObjectionJS as our supported ORM. ObjectionJS

Squareboat 7 Dec 15, 2022
🦁 REST API for the NestJS + Next.js Todo application

Create new NestJS project $ npm i -g @nestjs/cli $ npm i -g yarn $ nest new api-lesson # set strict true in tsconfig.json Install packages # install

Udemy course repositories by Kazu T+ 21 Jan 4, 2023
First NestJS project powered by TypeScript (Simple CRUD)

First Nest TS (TypeScript) First NestJS project powered by TypeScript (Simple CRUD) Routes Get All GET http://localhost:3000/products/ Get one GET htt

Max Base 3 Feb 22, 2022
Nestjs + Typescript + GraphQL

Nestjs Boilerplate: Nestjs + Typescript + GraphQL How to run Install dependencies yarn install Start server for development yarn start:dev Start ser

doankhoi 3 Jun 27, 2022
ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.

TypeORM is an ORM that can run in NodeJS, Browser, Cordova, PhoneGap, Ionic, React Native, NativeScript, Expo, and Electron platforms and can be used

null 30.1k Jan 3, 2023