DEV3 Technologies home

DEV3 Rivetpath – NestJS API Starter with Prisma, JWT Auth, API Keys, OpenAPI & Gemini AI Admin Tools

NestJS 11 and Prisma 6 REST API starter on MySQL with Gemini AI admin tools (bring your own key): JWT with rotating refresh tokens, 2FA, scoped API keys, organisations and roles, idempotent writes, signed webhooks, job queue, OpenAPI, e2e tests, Docker and CI. Demo data included. No mobile apps.
by DEV3 TechnologiesVerified Author(0) 0 sales 0 viewsUpdated 14 Nov 2026

Video tour. Pick a section below to browse 32 screenshots in 5 sections.

App & phone tours

Tap play to watch each app. Nothing downloads until you do.

  • Mobile web0:07

Rivetpath is a REST API starter that you host yourself, built by DEV3 Technologies on NestJS 11, TypeScript, Prisma 6 and MySQL 8. It is for backend developers, agencies and startups who want to begin a production API with the parts everyone rewrites already done and tested: sign-in, refresh tokens, API keys, organisations and roles, validation, docs, rate limits, jobs and webhooks. A small web console manages users, organisations, keys and webhooks. There is no end-user front end. The demo is a fictional supply company, Stockrill, with three organisations, 1,800 items and about 40,000 stock movements.

No live demo: grouped screenshots and two video tours show the marketing page, the console, the Swagger and Redoc references, the guides and the test runs. Install it with the demo data to try everything on your own server. This is a web API with a console: there are no mobile apps.

What is in the API

  • Authentication: email and password with argon2id, email verification, password reset, TOTP two-factor sign-in with recovery codes, 15-minute JWT access tokens and rotating refresh tokens with reuse detection (a replayed token revokes the whole family). A session list lets users revoke devices.
  • API keys: rpk_ keys shown once and stored as a hash, with scopes that can never exceed their creator's abilities, per-key rate limits, expiry and revoke.
  • Organisations and roles: multi-tenant by default. A Prisma extension adds the organisation to every query and fails closed, and a test fails when a tenant model is missing from the list. Built-in and custom roles, invitations, and policy checks written in plain TypeScript.
  • Idempotency and pagination: Idempotency-Key on writes (ten parallel duplicates create one record) and cursor pagination helpers.
  • Webhooks: outbox rows written in the same transaction as the change, signed t=...,v1=... payloads, 9 attempts (1 + 8 retries) with backoff, delivery log, replay, and a pinned outbound fetch that refuses private and metadata addresses.
  • Jobs: a persistent queue with leases and unique keys that runs inside the API process; a BullMQ adapter is a documented swap.
  • Also included: uploads (local disk or S3-compatible, magic-byte allow-list, signed URLs), mail (log or SMTP), audit log, rate limiting, health and Prometheus metrics, request ids and structured logs, stable error codes with English and Spanish messages, OpenAPI 3.1 with Swagger UI and Redoc, a billing skeleton with a simulated gateway, and an example Inventory module you can delete.
  • Gemini AI admin tools (bring your own key): AI actions on most console pages: explain an API error or log entry, summarise the audit trail, draft webhook payload docs, flag anomalies in request rates and errors, ask in plain English over users, keys and jobs (allow-listed filters only), generate OpenAPI descriptions for a generated module and draft release notes. Every answer is a preview you edit and accept; nothing is saved automatically. Prompts are redacted before they leave the server, a daily limit and usage log are built in, and POST /v1/ai/complete (scope-guarded and rate limited) is a starting point for your own AI features. The package contains no Gemini key: you add your own and Google bills it; without one the buttons say "Add your Gemini key in Settings". A Google Translate switcher sits in the console and docs header; keys, secrets, users and the audit trail are excluded from translation.
  • Generator: npm run rivet:module -- Orders creates a tenant-safe module with schema, migration, controller, service and e2e tests, and refuses to overwrite files.

The console and the docs

The console (React, 70 KB gzipped, served by the API) has an overview with the Rivet Line, users and sessions, organisations, roles, API keys, webhooks with delivery detail and replay, jobs, audit, AI tools, settings and an inventory browser. Thirty-six guides cover getting started, configuration, every feature above, deployment, CI, security and upgrading.

What you get

The complete source (API, console, Prisma schema and migrations, tests, scripts), Dockerfile and docker-compose, GitHub Actions and GitLab CI templates, a setup wizard (npm run setup), demo data (npm run seed), Documentation/index.html (the guides, readable offline), START-HERE.txt and LICENSE.txt. Support is included for 6 months.

Good to know

  • Tested on MySQL; PostgreSQL schema validated. The test suite and the demo run on MySQL 8. The Prisma schema validates on PostgreSQL and the guide lists the two raw statements to port; PostgreSQL is not a tested target.
  • One process by default. The API, job runner and webhook dispatcher run together. Redis and BullMQ are a documented swap, not shipped. Rate limits use the database or memory.
  • Billing is a skeleton. Plans, subscriptions, proration and a signature-check sample, with a simulated gateway. It is not a billing engine.
  • No GraphQL in version 1.
  • APP_SECRET is required (32 or more characters) and signs tokens and encrypts stored secrets: keep it. Webhook targets on private networks are refused unless you set a switch that is blocked in production.
  • Email goes to the log until you configure SMTP.
  • Name: Rivetpath is a working name checked by a web search only, not a trademark clearance.
  • No hosted demo. All organisations, people and data in the screenshots are fictional.

Quality checks

Rivetpath 1.0.0 passed its seven release checks on the final code: type-checking, linting and schema validation (0 errors), 119 unit tests and 78 end-to-end tests on a real MySQL database including races (parallel refreshes, parallel withdrawals of the last units, parallel idempotent writes, one job claimed by three runners), a production build with a 70 KB gzipped console and 36 guides, demo seeding in under a minute, an install test from the packaged zip, and a secret scan.

How it's built

Architecture, stack, key decisions and the quality gates DEV3 Rivetpath passed before release.

The engineering behind Rivetpath: refresh tokens that rotate with reuse detection, a Prisma extension that scopes every query by organisation, idempotent writes and an outbox that delivers each webhook once per endpoint.

The problem it solves

An API starter is copied into products that handle real customers, so its defaults must hold under concurrency. Five parallel refreshes with one token must produce one child and keep the family alive. Ten parallel withdrawals of the last five units must give five successes and a level of zero. A repeated POST must not create two records. A webhook target that resolves to a private address must never be called, and one organisation must never read another's rows.

Architecture and approach

Rivetpath is a NestJS 11 application on Prisma 6 and MySQL 8, with each concern in its own module and every rule backed by a test on a real database.

Refresh rotation

Each refresh token belongs to a family. Rotation elects one winner with a conditional update inside the transaction that creates the child, so parallel requests see exactly one child. The child secret is derived, not stored, which allows a short retry window without keeping plaintext. Presenting a spent token outside that window revokes the family.

Tenancy

A Prisma client extension adds the organisation to every query and create on tenant models and fails closed when no organisation is in context. An enumerated test fails when a model with an organisation column is not on the list, and a walk test calls every route with another organisation's ids and expects 404.

Idempotency and stock

Writes carry an idempotency key scoped to principal, organisation, method and path. Parallel duplicates get a clear conflict and the first response is replayed afterwards. Stock movements lock the level row, so the last units can only be taken once.

Webhooks and jobs

An outbox row is written in the same transaction as the change. The dispatcher signs the payload, resolves the target once, validates every address, pins it for the connection and re-validates each redirect hop. Jobs are claimed with SKIP LOCKED and a lease.

Quality gates and results

The unit suite (119 tests) and the end-to-end suite (78 tests, eight suites on a real MySQL database) pass, together with a data-invariants command that checks stock levels, tenant scoping, refresh families and the outbox after the demo seed. Known limits: tested on MySQL only (the schema validates on PostgreSQL), one process runs the API and the workers by default, and billing is a skeleton with a simulated gateway.

Tech stack

Area Technologies
API NestJS 11, TypeScript, zod, OpenAPI 3.1
Data Prisma 6, MySQL 8
Security argon2id, Rotating refresh tokens, Pinned outbound fetch, AES-256-GCM vault
Console React 19, Vite, Tailwind 4

Inside the build

Hero: Auth, keys, orgs, webhooks and tests, with the e2e run green beside the API reference. Hero — Auth, keys, orgs, webhooks and tests, with the e2e run green beside the API reference.

Security that is tested: Rotating refresh tokens, scoped keys, tenancy that fails closed and policies without escalation. Security that is tested — Rotating refresh tokens, scoped keys, tenancy that fails closed and policies without escalation.

Guides & articles

Practical guides and engineering write-ups for DEV3 Rivetpath.

NestJS API starter: 7 things to check before you pick one

Last updated
NestJS API starter: 7 things to check before you pick one: DEV3 Rivetpath

Most API starters get you to a working login in a day. The questions that matter come later, when two requests arrive at once. Here are seven things to check before you pick a NestJS starter, with DEV3 Rivetpath as the worked example.

The Rivetpath home page with the e2e run beside the API reference

1. What happens when a refresh token is used twice?

A mobile app retries; an attacker replays. Check that refresh tokens rotate, that parallel refreshes with one token produce one child, and that a spent token outside a short window revokes the family.

Guide: refresh rotation and reuse detection

2. How are API keys stored?

A key you can show again is a key you can leak. Look for a hash at rest, the secret shown once, scopes, expiry and a rule that a key can never hold more than the person who made it.

API keys with the secret shown once

3. Does tenancy fail closed?

If a developer forgets a filter, the query should fail, not return another customer's rows. Rivetpath scopes tenant models in a Prisma extension and has a test that fails when a model is missing from the list.

Organisations in the console

4. Are writes idempotent?

Ten parallel POSTs with the same key should create one record. Ask what a client sees while the first request is still running.

The API reference in Redoc

5. Do webhooks survive failure?

An outbox written in the same transaction, signed payloads, retries with backoff, a delivery log with replay, and a fetch that refuses private addresses.

A webhook delivery with its signed payload

Video tour of Rivetpath

6. Do the tests include the races?

Passing unit tests do not prove the last five units can only be taken once. Look for tests against a real database that run requests in parallel.

The end-to-end run, all green

7. Can you add a module without copying one?

A generator that creates the module, migration and tests, and refuses to overwrite your files, keeps the layout consistent.

The module generator output

Limits to weigh

Rivetpath is tested on MySQL; the schema validates on PostgreSQL but is not a tested target. One process runs the API and the workers by default. Billing is a skeleton with a simulated gateway. There is no GraphQL in version 1. Check each against your needs.

Frequently asked questions

The complete source code (version 1.0.0) as a download from your account, with the setup and usage guides shown on this page. You can modify the code to suit your product.

Questions about this product (0)

Answers from the DEV3 team and the community.

Ask a question

No questions yet.

Wondering about setup, licensing or customisation? Ask, and the DEV3 team will help.

More from this author

View all

Related in Enterprise SaaS Starters

View all