auth-security
Best practices for implementing JWT, API Keys, OAuth 2.1, and RBAC in a NitroStack application.
Set up a new Prisma Postgres database and connect it to a local project using the Management API. Use when asked to "set up a database", "create a Prisma Postgres project", "get a connection string", "connect my app to Prisma Postgres", or "provision a database".
$ npx -y skills add nitrocloudofficial/nitrostack --skill prisma-postgres-setup --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/prisma-postgres-setupContext preview
The summary Claude sees to decide when to auto-load this skill.
Set up a new Prisma Postgres database and connect it to a local project using the Management API. Use when asked to "set up a database", "create a Prisma Postgres project", "get a connection string", "connect my app to Prisma Postgres", or "provision a database".
name: prisma-postgres-setup description: Set up a new Prisma Postgres database and connect it to a local project using the Management API. Use when asked to "set up a database", "create a Prisma Postgres project", "get a connection string", "connect my app to Prisma Postgres", or "provision a database". license: MIT metadata: author: prisma version: "1.1.0"
Procedural skill that guides you through provisioning a new Prisma Postgres database via the Management API and connecting it to a local project.
Use this skill when:
Do **not** use this skill when:
When presenting choices to the user (region selection, project deletion, etc.), **use your platform's interactive selection mechanism** (e.g., `ask` tool in Claude Code, structured prompts in other agents). Do not print static tables and ask the user to type a value — present selectable options so the user can pick with minimal effort.
Follow these steps in order. Each step includes the API call to make and how to handle the response.
You need a service token. Try these methods in order:
**1a. Token in the user's prompt**
Check if the user included a service token in their initial message (e.g., "Set up Prisma Postgres with token eyJ..."). If so, use it **exactly as provided** — do not truncate, re-encode, or round-trip it through a file. Store it in a shell variable for subsequent calls.
**1b. Token in the environment**
Check for `PRISMA_SERVICE_TOKEN` in the environment or `.env` file.
**1c. Ask the user to create one**
If no token is available, instruct the user:
> Create a service token in Prisma Console → Workspace Settings → Service Tokens. > Copy the token and paste it here.
Read `references/auth.md` for details on service token creation.
Once you have a token, store it in a shell variable (`PRISMA_SERVICE_TOKEN`) and use it for all subsequent API calls.
Fetch the list of available Prisma Postgres regions to let the user choose where to deploy.
curl -s -H "Authorization: Bearer $PRISMA_SERVICE_TOKEN" \ https://api.prisma.io/v1/regions/postgres
The response contains an array of regions with `id`, `name`, and `status`. Only present regions where `status` is `available`.
**Present the regions as an interactive menu** — let the user pick from options rather than typing a region ID manually.
Read `references/endpoints.md` for the full response shape.
curl -s -X POST https://api.prisma.io/v1/projects \
-H "Authorization: Bearer $PRISMA_SERVICE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "<project-name>",
"region": "<region-id>",
"createDatabase": true
}'Use the current directory name as the project name by default.
The response is wrapped in `{ "data": { ... } }`. Extract:
Use the **direct** connection string (`endpoints.direct.connectionString`). Do not use the pooled or accelerate endpoints — those are for legacy Accelerate setups and not needed for new projects.
If the response status is `provisioning`, wait a few seconds and poll `GET /v1/databases/<database-id>` until `status` is `ready`.
**If creation fails due to a database limit**, list the user's existing projects and present them as an interactive menu for deletion. After the user picks one, delete it and retry.
Read `references/endpoints.md` for the full request/response shapes.
If you need a dedicated connection (e.g., per-developer or per-environment), create one:
curl -s -X POST https://api.prisma.io/v1/databases/<database-id>/connections \
-H "Authorization: Bearer $PRISMA_SERVICE_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "name": "dev" }'Extract the direct connection string from `data.endpoints.direct.connectionString`.
1. Install dependencies:
npm install prisma @prisma/client @prisma/adapter-pg pg dotenv
All five packages are required:
2. Write the direct connection string to `.env`. **Append** to the file if it already exists — do not overwrite existing entries:
DATABASE_URL="<direct-connection-string>"
3. Verify `.gitignore` includes `.env`. Create `.gitignore` if it does not exist. Warn the user if `.env` is not gitignored.
4. Ensure `package.json` has `"type": "module"` set (Prisma 7 generates ESM output).
5. If `prisma/schema.prisma` does not exist, run `npx prisma init` to scaffold the project. This creates both `prisma/schema.prisma` and `prisma.config.ts`.
6. Ensure `schema.prisma` has the `postgresql` provider and **no** `url` or `direc
The full-stack TypeScript framework to build, test, and deploy production-ready MCP servers and AI-native apps.
Repo: nitrocloudofficial/nitrostack
Best practices for implementing JWT, API Keys, OAuth 2.1, and RBAC in a NitroStack application.
Best practices and guidelines for bootstrapping, defining modules, using dependency injection, managing server lifecycles, and handling events in the…
Best practices for implementing and applying Guards, Interceptors, Middleware, Pipes, and Exception Filters in the NitroStack SDK.
Guidelines and patterns for defining Tools, Resources, and Prompts in a NitroStack application with schema validation via Zod, including caching,…
Best practices for linking tools to interactive frontend widgets using @Widget and @nitrostack/widgets SDK (including state sync, tool calling, display modes,…
Prisma ORM CLI commands reference covering init, generate, migrate, db, dev, studio, validate, format, debug, and mcp. Use for ORM/database CLI workflows, not…