Microservice boilerplate for SamagraX
- Features
- Quick run
- Comfortable development
- Links
- Automatic update of dependencies
- Database utils
- Tests
- Database (Prisma).
- User-Service integration using npm package. (https://github.com/techsavvyash/user-service).
- Seeding.
- Config Service (@nestjs/config).
- Mailing (nodemailer).
- Sign in and sign up via email.
- Social sign in (Apple, Facebook, Google, Twitter).
- Admin and User roles.
- I18N (nestjs-i18n).
- File uploads. Support local and Amazon S3 drivers.
- Swagger.
- E2E and units tests.
- Docker.
- CI (Github Actions).
git clone --depth 1 https://github.com/ChakshuGautam/stencil.git my-app
cd my-app/
cp env-example .env
docker compose up setup
docker compose up -d
For checking status of containers run
docker compose logs
Stencil provides support for logging in 2 modes:
Axiom provides structured, customizable logging with features like custom log levels, log message formatting, filtering, and flexible storage options. Make sure to replace the values of DATASET_NAME
and TOKEN
in logging/logstash/pipeline/axiom.conf
ELK offers centralized log management using Elasticsearch for storage, Logstash for parsing and transformation, and Kibana for real-time analytics, custom dashboards, and scalability. Stencil provides out of the box support for ELK stack. Once all the containers are up, go to https://localhost:5601 to access kibana console. The default username is elastic
and password is changeme
which can be configured through .env .
git clone --depth 1 https://github.com/ChakshuGautam/stencil.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
Streamline your development process by running your project inside a Docker container. Follow these steps to get started:
-
Open the Project in Visual Studio Code
- Launch Visual Studio Code and open your project.
-
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.
- To work within a Docker container, press
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:
-
Disable Auto Attach in VS Code
- Open the command palette in Visual Studio Code.
- Type > Toggle Auto Attach and set it to "Disabled."
-
Re-enable Auto Attach
- Open the command palette again.
- Type > Toggle Auto Attach and set it to "Always" or "Smart".
- Swagger: http://localhost:3000/docs
- Adminer (client for DB): http://localhost:8080
- Maildev: http://localhost:1080
- Kibana: http://localhost:5601
If you want to automatically update dependencies, you can connect Renovate for your project.
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
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
You can follow the below steps for building the docs locally:
- Navigate to the docs directory
cd docs
- Install dependencies
npm install
- Run the docs website
npm start
Apart from accessing the docs locally, you can also refer to the online documentation of stencil