sooraj1002 / stencil

Microservices Boilerplate for SamagraX

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stencil

Microservice boilerplate for SamagraX

Open in Gitpod

github action status

Description

Microservice boilerplate for SamagraX

Full documentation here

Table of Contents

Features

Quick run

git clone --depth 1 https://github.com/brocoders/nestjs-boilerplate.git my-app
cd my-app/
cp env-example .env
docker compose up -d

For check status run

docker compose logs

Comfortable development

git clone --depth 1 https://github.com/brocoders/nestjs-boilerplate.git my-app
cd my-app/
cp env-example .env

Change DATABASE_HOST=postgres to DATABASE_HOST=localhost

Change MAIL_HOST=maildev to MAIL_HOST=localhost

Run additional container:

docker compose up -d postgres adminer maildev
npm install

npm run migration:run

npm run seed:run

npm run start:dev

Dockerized Development with Visual Studio Code

Streamline your development process by running your project inside a Docker container. Follow these steps to get started:

  1. Open the Project in Visual Studio Code

    • Launch Visual Studio Code and open your project.
  2. Open the Project in a Docker Container

    • To work within a Docker container, press Control+P to bring up the command palette.
    • Type in > Reopen in container and select it. This will open your project inside a Docker container.

Troubleshooting

If you encounter the following error upon starting the project:

node:internal/modules/cjs/loader:1080
  throw err;
  ^

Error: Cannot find module '/root/.vscode-server/data/User/workspaceStorage/b2d44a48cb3eb862caab3a51d86d99df/ms-vscode.js-debug/bootloader.js'
Require stack:
- internal/preload

You can resolve it by following these steps:

  1. Disable Auto Attach in VS Code

    • Open the command palette in Visual Studio Code.
    • Type > Toggle Auto Attach and set it to "Disabled."
  2. Re-enable Auto Attach

    • Open the command palette again.
    • Type > Toggle Auto Attach and set it to "Always" or "Smart".

Links

Automatic update of dependencies

If you want to automatically update dependencies, you can connect Renovate for your project.

Database utils

Generate migration

npm run migration:generate -- src/database/migrations/CreateNameTable

Run migration

npm run migration:run

Revert migration

npm run migration:revert

Drop all tables in database

npm run schema:drop

Run seed

npm run seed:run

Tests

# unit tests
npm run test

# e2e tests
npm run test:e2e

Tests in Docker

docker compose -f docker-compose.ci.yaml --env-file env-example -p ci up --build --exit-code-from api && docker compose -p ci rm -svf

Test benchmarking

docker run --rm jordi/ab -n 100 -c 100 -T application/json -H "Authorization: Bearer USER_TOKEN" -v 2 http://<server_ip>:3000/api/v1/users

About

Microservices Boilerplate for SamagraX

License:MIT License


Languages

Language:TypeScript 75.9%Language:Shell 10.4%Language:Python 5.1%Language:Handlebars 3.7%Language:JavaScript 2.7%Language:Dockerfile 1.9%Language:Procfile 0.2%