个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
在项目文件夹中运行 /nomorevibe verify,即可验证所有权并自行管理介绍。
一分钟完成验证NestJS 12 REST backend template: accounts (passwords, two-factor, OAuth, magic links, tokens, impersonation), roles with CASL, API keys, audit log, idempotency, outbox, webhooks, workflows, queues, mail, storage, realtime, i18n, Docker Compose for dev and production.
翻译准备中
取自仓库 README
正在加载完整 README。
查看完整 README ↗Start here: Documentation home · Nontechnical: evaluate the template · Technical: build and operate
New to this project? Read the decision guide before installing it. This is a customizable foundation, not a complete business application. Commercial-use rights are not granted by default: review the PolyForm Noncommercial license and obtain separate permission if required.
A production-ready starting point for NestJS 12 REST APIs: everything a
project would otherwise rebuild is here, so a new project only writes its own
features. JSON in, JSON out; Swagger UI at /api is the API's only page.
You choose the shape once, with the first-run wizard (pnpm setup: one
organization or many, which optional services and security switches are on);
you add features with a generator (pnpm feature:add) that writes everything
standard, so you write only the business logic; and you deploy without
downtime with Docker Compose (rolling or blue-green) or Docker Swarm.
A pnpm + Turborepo monorepo: the API in apps/api, its typed client in
packages/api-client, a web app on that client in apps/web (React, Vite,
TanStack Router and Query, shadcn/ui and Dice UI from packages/ui), and
room for more frontends in apps/ (monorepo).
| Area | What you get | Docs |
|---|---|---|
| Setup | pnpm setup: a first-run wizard that asks the deployment shape and the few choices, lets you disable unused modules and writes the env file with generated secrets | configuration |
| Choices | Deployment switches, set once: one tenant or many (TENANCY), IDEMPOTENCY (required or optional), WEBHOOKS, REPORTS, USAGE, REALTIME, AUTH_MFA, API_CLIENTS, IMPERSONATION (off by default); auth policies changed at runtime (auth.requireMfa, auth.passwordMinLength) under the env's ceiling | configuration, settings |
| Features | A generator (pnpm feature:add, the /add-feature skill for Claude Code) writes a feature from one declaration, <item>.record.ts: fields, recycle bin, organizational units, and capabilities (tags, comments, attachments, revisions, PDF, bulk, watch, search, export, custom fields, webhooks for its changes, gapless numbers), approvals and settings, plus API-key access, grants and idempotency; pnpm feature:sync applies a changed declaration later | adding a feature |
| Tenants | Many organizations in one deployment behind PostgreSQL row-level security (or one, with TENANCY=single), the tenant of every request, job, workflow and cron run, operators, independent tenants with strict isolation, break-glass (an operator reading a tenant read only), platform analytics on anonymized aggregates | tenancy |
| Accounts | Password sign-in, sessions and tokens (mobile), passkeys, sign-up (optional), invitations, email verification, forgot/reset/change password, TOTP two-factor with recovery codes, magic links, Google/Microsoft/GitHub, enterprise SSO (SAML 2.0, OpenID Connect per tenant) with SCIM 2.0 provisioning, bot protection (Turnstile), sessions list and sign-out everywhere, data export and account deletion, support impersonation (opt in) |
One example feature, notes, shows business logic on top of the platform:
a publish workflow with an approval, conditions and field-level permissions,
numbers, custom fields, webhooks through the outbox, an incoming webhook,
settings. It is there to read, then to remove (pnpm feature:remove notes;
CI proves the template stands without it): new features start from the
generator (pnpm feature:add), never from a copy.
pnpm install
pnpm setup # first run: a few questions, writes apps/api/.env.development (or the root .env: --target production)
pnpm services:up # PostgreSQL, Redis, Mailpit, Floci (AWS S3 and SES), Gotenberg (PDF)
pnpm dev # the API (http://localhost:3000/api) and the web app (http://localhost:5173)
pnpm db:seed:demo # optional, from a second terminal: demo users and organizational units, and each feature's demo data (passwords printed once)
Open http://localhost:5173 and sign in as the administrator (below) or a demo member the seed printed (monorepo).
pnpm setup asks what shapes a project (one organization or many, mail,
storage, sign-up, bot protection, the deployment switches), keeps the
rest off, and generates the secrets; without it, copy apps/api/env.development.example to
apps/api/.env.development by hand (configuration,
"First setup"). The first start creates the administrator (ADMIN_EMAIL; the password is
logged once unless ADMIN_PASSWORD is set, which pnpm setup does). Or open
the repository in its devcontainer (.devcontainer/): the same services,
nothing to install; pnpm dev runs the API and the web app there. More in
development.
git clone https://github.com/lamberto15/nestjs-monorepo-template my-app # keeps the history: template updates merge
cd my-app && git remote rename origin template
pnpm install
pnpm feature:remove notes # the example feature: the API's and the web app's (pages, tests, texts)
pnpm db:generate # the migration that drops its table
pnpm feature:add invoices --fields "number:string!unique,total:money,dueOn:date?" --with tags,comments,attachments,pdf
pnpm db:generate && pnpm client:generate
pnpm build # the web's build regenerates its route tree
Then run pnpm setup and rename it (the root package.json name, the @nestjs-monorepo-template/
scope, API_TITLE, API_KEY_PREFIX) and write only the business logic, where
the generated service says so. With Claude Code, /add-feature asks what the
feature needs and runs the generator. GitHub's "Use this template" works too,
but its fresh history makes template updates harder (upgrading).
More in adding a feature.
pnpm setup --target production # asks, writes .env (chmod 600) with every secret generated
docker compose up -d --build # the first start; later deploys: one of the three below
By hand instead: cp env.example .env && chmod 600 .env; env.example says
which values are required and how to generate each secret.
Caddy (HTTPS, and the web app's files) → api replicas; worker replicas
for the background work; PostgreSQL and Redis; migrations once per deploy. Later deploys keep serving
while the new version starts (deployment):
| Method | Command | Rollback |
|---|---|---|
| Rolling (Compose) | pnpm deploy:rolling | deploy the previous APP_IMAGE |
| Blue-green (Compose) | pnpm deploy:blue-green | pnpm deploy:blue-green rollback, instant |
| Docker Swarm | pnpm deploy:swarm | automatic on a failed health check, or pnpm deploy:swarm rollback |
See deployment for staging, scaling, managed services, backups and the published images.
The template keeps shipping fixes and modules as releases (v* tags, with
notes on their migrations and how to roll back). Start your project with
git clone (keeping the history), keep the template as a remote, and merge
each release tag: upgrading.
git remote add template https://github.com/lamberto15/nestjs-monorepo-template
git fetch template --tags && git merge v1.3.0
Getting started
pnpm setup and every variableBuilding features
<item>.record.ts declaration, the checklistPlatform modules
Operations and deploys
pnpm deploy:rollingpnpm deploy:blue-green, instant rollbackpnpm deploy:swarm, automatic rollbackReleases and the roadmap
PolyForm Noncommercial 1.0.0: free for personal, research, education and other noncommercial use. Commercial use needs a separate licence from the copyright holder.
| auth |
| Access | Roles of CASL permissions declared by features, conditions (mine, in my units…), field-level permissions, role grants that expire, organizational units, API clients with roles and rotating keys, an audit log with per-record diffs | permissions |
| API | /v1 versioning, RFC 9457 problem details, Zod validation and OpenAPI, cursor pagination, declared filters, idempotency keys, CORS, CSRF, security headers, rate limits, per-client daily quotas | conventions, usage |
| Background | BullMQ queues on workers, mail through a queue, transactional outbox, durable workflows, cron on one instance (locks), outgoing and incoming webhooks, realtime (socket.io), exports and imports (CSV, JSON, Excel), bulk operations as 202 jobs, scheduled reports, PDF documents of records (Gotenberg, RTL and CJK fonts), email deliverability (SES bounces and complaints, a suppression list) | background, webhooks and realtime, data, bulk, reports, documents, deliverability |
| Records | Tags, comments with @mentions, file attachments, revisions (history, diff, restore), custom fields added at runtime, notifications (in-app, realtime, mail, webhook, push, SMS; preferences, digests), saved views of lists, settings and feature flags (rollouts, kill switches), gapless human-readable numbers and naming series administrators define | tags, comments, attachments, revisions, custom fields, notifications, saved views, settings, sequences |
| Data protection | Encrypted columns for personal data (AES-256-GCM, blind indexes, key rotation with a re-encryption job), retention rules (purge or anonymise after N days, per tenant) and legal holds that block deletes and purges | encryption, retention |
| AI | An AI helper that summarizes or classifies a record on a queue worker (off until a key is set and a tenant turns it on), with a token quota and a cache | ai |
| Approvals | Declare "this action needs approval" once: multi-stage policies (any, all, quorum, your own modes), approvers by role, organizational unit, permission or your own rules, reminders and escalation, delegation, an inbox, policies changed at runtime and versioned, on durable workflows | approvals |
| Platform | PostgreSQL 18 (UUIDv7 keys), Redis 8, file storage (local or S3, signed URLs), http-client with resilience, i18n (en, de, ar, zh, ms), time zones | i18n and time |
| Money | Amounts as bigint minor units with their ISO 4217 currency (strings in the API), rounding modes (half-up by default, banker's), allocation without losing a cent, formatting in every locale, the ECB's daily rates and conversion through the euro | money |
| Web app | A React single-page app on the typed client, served by Caddy beside the API: sign-in with every method (SSO included), the account pages, users, roles, organization structure and grants, single sign-on and SCIM, tenants (operators), API clients and usage, webhooks, approvals and their policies, notifications, settings and flags, naming series, custom fields, tags, the audit log, operations, global search, saved views, exports, imports, scheduled reports, automation rules (built and simulated) and bulk operations, and the example feature's list and record pages (tags, comments, attachments, revisions) | monorepo |
| Clients | A typed client package for web, mobile and scripts: REST types generated from the OpenAPI document, the conventions applied (credentials, idempotency keys, problem details, pages, ETags), typed realtime events | api-client |
| Operations | Separate API and worker processes, health checks, JSON logs with request ids and redaction, Prometheus metrics and alert rules, backups, Docker Compose for development and production with resource limits, Caddy HTTPS, CI with scans, published images, Dependabot | deployment |
| Deploys | Zero-downtime deploys three ways, with graceful shutdown and Caddy holding requests while replicas restart: rolling (pnpm deploy:rolling), blue-green with an instant rollback (pnpm deploy:blue-green), Docker Swarm with automatic rollback (pnpm deploy:swarm) | deployment, rolling, blue-green, Swarm |