{"id":46152483,"url":"https://github.com/typv/nest-turbo-starter","last_synced_at":"2026-04-22T06:10:00.398Z","repository":{"id":323993285,"uuid":"1095462403","full_name":"typv/nest-turbo-starter","owner":"typv","description":"A NestJS monorepo starter kit for building scalable microservices with Turborepo and pnpm.","archived":false,"fork":false,"pushed_at":"2026-04-21T17:05:49.000Z","size":43879,"stargazers_count":177,"open_issues_count":0,"forks_count":36,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-21T18:25:48.250Z","etag":null,"topics":["api-gateway","apisix","boilerplate","microservices","nest-turbo-starter","nestjs","nestjs-boilerplate","nestjs-microservices","nestjs-monorepo","nestjs-monorepo-starter","nestjs-starter","nestjs-turborepo","nestjs-turborepo-starter","turborepo","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/typv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-13T04:45:31.000Z","updated_at":"2026-04-21T17:02:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/typv/nest-turbo-starter","commit_stats":null,"previous_names":["typv/nest-turbo-starter"],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/typv/nest-turbo-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typv%2Fnest-turbo-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typv%2Fnest-turbo-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typv%2Fnest-turbo-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typv%2Fnest-turbo-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typv","download_url":"https://codeload.github.com/typv/nest-turbo-starter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typv%2Fnest-turbo-starter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32123642,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T00:31:26.853Z","status":"online","status_checked_at":"2026-04-22T02:00:05.693Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-gateway","apisix","boilerplate","microservices","nest-turbo-starter","nestjs","nestjs-boilerplate","nestjs-microservices","nestjs-monorepo","nestjs-monorepo-starter","nestjs-starter","nestjs-turborepo","nestjs-turborepo-starter","turborepo","typescript"],"created_at":"2026-03-02T09:03:55.217Z","updated_at":"2026-04-22T06:10:00.392Z","avatar_url":"https://github.com/typv.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧠 Nest Turbo Starter\n\nA high-performance, monorepo microservices platform built with NestJS, optimized for speed using Turborepo and the pnpm package manager. The system is containerized with Docker and features dynamic traffic management and security via API Gateway (Apache APISIX / Kong).\n\n# 📑 Table of Contents\n\n* [🚀 Getting Started](#-getting-started)\n* [🏗️ System Architecture](#-system-architecture)\n* [📦 Monorepo Structure](#-monorepo-structure)\n* [✅ Tech Stacks](#-tech-stacks)\n* [🛠️ Installation Preparation](#-installation-preparation)\n* [🧑‍💻 Build](#-build)\n  * [Prerequisites](#prerequisites)\n  * [Environment Setup](#environment-setup)\n  * [Install Dependencies](#install-dependencies-1)\n  * [Build Applications](#build-applications)\n  * [Run Database Migrations](#run-database-migrations-1)\n  * [Start Microservices](#start-microservices-1)\n* [🌐 API Gateway Configuration](#-api-gateway-configuration)\n  * [Apache APISIX (Default Gateway)](#apache-apisix-default-gateway)\n  * [Kong Gateway (Alternative Option)](#kong-gateway-alternative-option)\n* [🌍 Access URLs](#-access-urls)\n  * [🧭 API Gateways](#-api-gateways)\n  * [⚙️ Microservices](#-microservices)\n  * [🧰 Tools \u0026 Management UI](#-tools--management-ui)\n* [🔐 Demo API — Sign-Up \u0026 Login (cURL)](#-demo-api--sign-up--login-curl)\n  * [Sign-Up](#sign-up)\n  * [Login](#login)\n* [📘 Notes](#-notes)\n\n# 🚀 Getting Started\n\n## ✨ Key Concepts (Monorepo \u0026 Performance)\nThis starter uses a Monorepo structure managed by **Turborepo** and **pnpm** to maximize performance and simplify development across multiple microservices.\n\n---\n\n## 🏗️ System Architecture\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/images/architecture.png\" alt=\"Nest Turbo Starter Microservices Architecture\" width=\"342\"/\u003e\n\u003c/p\u003e\n\nThis project implements a robust, containerized microservices architecture designed for high availability and scalability. All core services-built on NestJS and Node.js-reside within a secure Private Subnet, adhering to the principle of service autonomy where each microservice owns its PostgreSQL database. External client requests are strictly managed by Apache APISIX, which serves as the central API Gateway for routing, security, and policy enforcement via HTTP. Internal service-to-service communication is handled via efficient TCP connections, while Kafka is optionally integrated to enable scalable, asynchronous communication and event-driven processing, minimizing service coupling.\n\n---\n\n## 📦 Monorepo Structure\n```bash\n  apps/\n    auth-service/\n    user-service/\n    ...\n  libs/\n    common/\n    core/\n    ...\n  config/\n    apisix/\n    kong/\n```\n---\n\n## ✅ Tech Stacks\n\n### 🚀 Core Backend\n| Component        | Version | Description                           |\n|------------------|---------|---------------------------------------|\n| Node.js          | 22.15   | JavaScript runtime                    |\n| NestJS           | 11      | Backend framework                     |\n| TypeScript       | 6.x     | Type-safe language                    |\n| PostgreSQL       | 16      | Main relational DB                    |\n| MikroORM         | 7.x     | ORM                                   |\n| Redis            | 8.0     | Cache \u0026 queue backend                 |\n| pnpm             | 10.x    | Monorepo package manager              |\n| Kafka (optional) | 4.x     | Event streaming \u0026 async communication |\n\n\n### 🌐 API Gateway \u0026 Service Mesh\n| Component | Version | Description |\n|------------|----------|-------------|\n| Apache APISIX | 3.14 | Default API Gateway |\n| Etcd | 3.5.1 | APISIX config store |\n| Kong | 3.12 | Optional alternative gateway |\n\n### Infrastructure \u0026 DevOps\n| Component | Version | Description |\n|------------|----------|-------------|\n| Docker / Compose | latest | Containerization |\n| ADC | latest | APISIX config sync |\n| deck | latest | Kong config sync |\n| Redis Insight | latest | Redis visualization |\n| Kafka UI | latest | Kafka management UI |\n| Kong Manager | 3.12 | Kong dashboard |\n\n### 🧰 Developer Tools\n| Tool | Description |\n|------|--------------|\n| ESLint / Prettier | Linting \u0026 formatting |\n| Jest | Unit testing |\n| Swagger | API documentation |\n| Husky + lint-staged | Git pre-commit checks |\n| Dotenv | Env management |\n---\n\n## 🛠️  Installation Preparation\n\n1. **Default Base Path**\n\n   ```bash\n   /home/app.user/nest-turbo-starter\n   ```\n\n2. **Environment Variables**\n\n   Copy the sample environment file:\n\n  ```bash\n  cp .env.example .env\n  ```\n\n  ```bash\n  cd apps/service_name \u0026 cp .env.example .env\n  ```\n\u003e ⚠️ **Note:**\n\u003e - The project require additional environment variables both at the **root** of the monorepo/turborepo and for each individual microservice\n\u003e - Make sure to add these variables of **root** to turbo.json (or your monorepo configuration)\n---\n\n# 🧑‍💻 Build\n\n---\n\n### Prerequisites\n\n#### Setup Docker\n\nBuild and start all containers:\n\n```bash\ndocker compose up -d --build\n```\n\n#### `pnpm` installed globally:\n  ```bash\n  npm install -g pnpm\n  ```\n\n\n#### Environment Setup\n\nCopy and configure environment variables:\n\n```bash\ncp .env.example .env\n```\n\nEdit `.env` with correct values for database, Redis, Kafka, and gateway settings.\n\n---\n\n### Install Dependencies\n\nInstall all workspace dependencies:\n\n```bash\npnpm install\n```\n\nOr install only for a single service:\n\n```bash\npnpm --filter=auth-service install\n```\n\n---\n\n### Build Applications\n\nBuild all microservices:\n\n```bash\npnpm build\n```\n\nOr build one specific service:\n\n```bash\npnpm --filter=auth-service build\n```\n\n---\n\n### Run Database Migrations\n\nRun migrations for all services:\n\n```bash\npnpm migration:up\n```\n\nOr for one service:\n\n```bash\npnpm --filter=auth-service migration:up\n```\n\n---\n\n### Start Microservices\n\n#### Development mode\n\nStart all services:\n\n```bash\npnpm dev\n```\n\nStart one specific service:\n\n```bash\npnpm dev --filter=auth-service\n```\n\n#### Production mode\n\n### 1. Check types\n\nTo ensure type safety while using the high-speed SWC compiler (which skips type-checking during transpilation), you should run the following command before building or committing code:\n\nCheck all services:\n\n```bash\npnpm check-types\n```\n\nCheck a specific service:\n```bash\npnpm --filter=service_name check-types\n```\n\n---\n\n### 2. [Build Applications](#build-applications)\n\n### 3. Run production mode\nStart all services:\n\n```bash\npnpm prod\n```\n\nStart one specific service:\n\n```bash\npnpm prod --filter=auth-service\n```\n\n---\n\n## 🌐 API Gateway Configuration\n\n\u003e ⚠️ **Note:**\n\u003e - The current setup uses **Kong Gateway (Free / OSS Edition)**, which lacks several advanced enterprise features such as rate limiting, JWT key rotation, analytics, and RBAC management.\n\u003e - To address these limitations and support more advanced features, **Apache APISIX** is chosen as the **default API gateway** for this system.  \n\u003e - Key reasons include:\n\u003e   - Free \u0026 open source\n\u003e   - High performance and low latency\n\u003e   - Easy integration with etcd for declarative configuration\n\u003e   - Rich plugin ecosystem (rate limiting, JWT auth, logging, etc.)\n\u003e   - Active community and rapid development\n\u003e - The system is currently under active development to integrate and extend these features.\n\n### Apache APISIX (Default Gateway)\n\n#### Sync configuration from file\n\n```bash\ndocker compose run --rm adc adc sync -f conf/apisix-${environment}.yaml\n# Example:\ndocker compose run --rm adc adc sync -f conf/apisix-dev.yaml\n```\n\n#### Dump configuration from DB for verification\n\n```bash\ndocker compose run --rm adc adc dump -o adc/adc.yaml\n```\n\n---\n\n### Kong Gateway (Alternative Option)\n\nSync configuration using `deck`:\n\n```bash\ndocker compose run --rm kong-deck gateway sync /app/kong-dev.yaml\n```\n\n---\n\n# 🌍 Access URLs\n\n## 🧭 API Gateways\n\n| Gateway          | URL Example                                                                    |\n|------------------| ------------------------------------------------------------------------------ |\n| **APISIX Node**  | [http://localhost:`APISIX_NODE_LISTEN`](http://localhost:`APISIX_NODE_LISTEN`) |\n| **Kong Gateway** | http://localhost:18088 |\n\n---\n\n## ⚙️ Microservices\n\n| Type             | Example                                                                                  |\n|------------------|------------------------------------------------------------------------------------------|\n| **Direct Access** | http://localhost:port/api                                                                |\n| **Via APISIX**   | http://localhost:`APISIX_NODE_LISTEN`/`service_name`/api                                 |\n| Example          | [http://localhost:9080/auth-service/api](http://localhost:9080/auth-service/api)         |\n| Swagger          | [http://localhost:9080/auth-service/swagger](http://localhost:9080/auth-service/swagger) |\n\n---\n\n## 🧰 Tools \u0026 Management UI\n\n| Tool          | URL                                              |\n| ------------- | ------------------------------------------------ |\n| Redis Insight | [http://localhost:5534](http://localhost:5534)   |\n| Kafka UI      | [http://localhost:18082](http://localhost:18082) |\n| Kong Manager  | [http://localhost:18086](http://localhost:18086) |\n| APISIX Dashboard| http://localhost:`APISIX_DEPLOYMENT_ADMIN_LISTEN`/ui |\n\n\n---\n# 🔐 Demo API — Sign-Up \u0026 Login (cURL)\n\n## Sign-Up\n```bash\n    curl --location --request POST 'http://0.0.0.0:9080/auth-service/api/auth/sign-up' \\\n    --header 'Content-Type: application/json' \\\n    --data-raw '{\n        \"email\": \"test@example.com\",\n        \"password\": \"12345678Aa@\"\n    }'\n```\n## Login\n```bash\n    curl --location --request POST 'http://0.0.0.0:9080/auth-service/api/auth/login' \\\n    --header 'Content-Type: application/json' \\\n    --data-raw '{\n        \"email\": \"test@example.com\",\n        \"password\": \"12345678Aa@\"\n    }'\n```\n---\n\n# 📘 Notes\n\n* Make sure `.env` and configuration files (`apisix-*.yaml`, `kong-*.yaml`) are properly set before running migrations or gateway sync commands.\n* Use `pnpm --filter=\u003cservice\u003e` to target specific microservices efficiently.\n* If using Docker, ensure Docker and Docker Compose are running before executing commands.\n* If Git Pre-commit (Husky) is not working:\n  * Run `pnpm prepare`.\n  * For Linux/macOS users, grant execution permission: chmod +x .husky/pre-commit.\n  * Verify the hooks path by running: git config core.hooksPath. It should return .husky.\n---\n\n**© Nest Turbo Starter — Monorepo, Microservice Backend System**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypv%2Fnest-turbo-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftypv%2Fnest-turbo-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypv%2Fnest-turbo-starter/lists"}