Scaffold a new squidcode app locally — Next.js (TS) frontend + NestJS/Prisma (TS) backend + Postgres container, wired with a root docker-compose using OrbStack magic domains (no host port conflicts), secrets in a per-app Doppler project or, with --secrets infisical, a local Infisical in the same docker compose (never a committed .env), husky pre-commit running lint/prettier/tsc/tests, and a GitHub Actions workflow running those four checks in parallel on every PR. Use when the user says "squi...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Squidapp?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/squidcode-squidapp)
---
name: squidapp
description: Scaffold a new squidcode app locally — Next.js (TS) frontend + NestJS/Prisma (TS) backend + Postgres container, wired with a root docker-compose using OrbStack magic domains (no host port conflicts), secrets in a per-app Doppler project or, with --secrets infisical, a local Infisical in the same docker compose (never a committed .env), husky pre-commit running lint/prettier/tsc/tests, and a GitHub Actions workflow running those four checks in parallel on every PR. Use when the user says "squidapp", "scaffold an app", "new squidcode app", "bootstrap a project", or describes wanting this FE/BE/Postgres stack.
---
# squidapp
Run the bundled script **from inside an empty, freshly-created folder** — it scaffolds in place into `$PWD`. It is the deterministic source of truth; don't hand-recreate the boilerplate.
```bash
mkdir -p ~/dev/squidcode/myapp && cd ~/dev/squidcode/myapp
"${CLAUDE_SKILL_DIR}/scaffold.sh" # app-name defaults to folder name
"${CLAUDE_SKILL_DIR}/scaffold.sh" --secrets infisical # secrets in a local Infisical instead of Doppler
"${CLAUDE_SKILL_DIR}/local-secrets.sh" # (infisical) a fresh clone / reset volume: start + bootstrap it again
```
⚠️ It writes into the current directory (including `CLAUDE.md`, `README.md`, `package.json`). **Never run it in a non-empty folder or an umbrella dir of projects** — it would bury existing files. The script refuses to run unless `$PWD` is empty (a `.git`/`.envrc` is tolerated), but always `mkdir && cd` into a new dir first.
`app-name` defaults to the current folder name; it's the Postgres DB name + `.local` domain base (kebab-case). Pass it as `$1` to override. Optional `doppler-project` (`$2`) overrides the Doppler project name. Reusing a project preserves its existing dev secrets and fills in missing defaults.
### Preflight (runs first)
The script checks tooling before scaffolding and offers `brew` installs (relay any prompt to the user):
- **Doppler** (the default, `--secrets doppler`) — must be installed and logged in (`doppler login`); secrets + every run depend on it. Exits if missing/unauthed. With `--secrets infisical` no Doppler account is needed locally (curl, jq, node, openssl, docker instead).
- **OrbStack** (required) — must be the active Docker provider (`docker context show` = `orbstack`); the `.local` HTTPS domains depend on it. Exits if Docker Desktop is active instead.
- **New Relic CLI** (optional, non-blocking) — only suggested; APM/logs stay dormant without a key.
If no `doppler-project` is given and a Doppler project named `<app-name>` already exists, the script prompts **before** scaffolding anything: `1) use existing 2) stop 3) enter a new name`. Relay this choice to the user. To run non-interactively, pass the project name as the 2nd arg.
### Versions are pinned — and a failure names its step
The script never installs a tool at whatever `latest` is that day. Every generator and package whose flags, output layout or API it relies on is pinned to a **major** in one block at the top of `scaffold.sh` (`NEXT_MAJOR`, `NEST_CLI_MAJOR`, `PRISMA_MAJOR`, `NEWRELIC_MAJOR`, `NESTJS_PINO_MAJOR`, `PINO_HTTP_MAJOR`, `DOTENV_MAJOR`, `HUSKY_MAJOR`, `PRETTIER_MAJOR`). To move to a new major, change the number there — deliberately, then scaffold a throwaway app and run its checks; the templates are written against these majors.
Each step is announced (`==> backend: prisma init (prisma@7)`). If one fails the script stops and ends with `✗ scaffold.sh FAILED in step: <step>` — relay that line and the error above it to the user. The folder then holds a half-built app: fix the cause and re-run in a new, empty folder; don't finish the scaffold by hand.
## What you get
```
<app>/
services/frontend Next.js, TS, App Router, Tailwind → <app>.local
services/backend NestJS (ES modules), TS, Prisma (postgresql) → <app>-api.local
+ GET /health + pino logging + New Relic APM (optional, dormant w/o keys)
+ migrate.sh: `prisma migrate deploy` from the production image
+ CORS for the origins in CORS_ORIGINS (http-security.ts) + HSTS in production
README.md run/secrets quickref + Doppler project name
docker-compose.yml frontend + backend + postgres:16 (OrbStack domains, no host ports;
the backend starts once Postgres is healthy)
package.json npm workspaces + root check scripts
CLAUDE.md "run npm/prisma inside the container" rule + migration rules (expand/contract)
.gitignore node_modules, .env (secrets never committed)
.husky/pre-commit lint → format:check → typecheck → test
.github/workflows/ci.yml 4 parallel jobs on every PR
```
Plus a Doppler project named `<app>` (config `dev`) holding `POSTGRES_PASSWORD` + `DATABASE_URL` (generated password) + `CORS_ORIGINS=https://<app>.local`. No `.env` file — Prisma's is deleted on scaffold.
**CORS and HSTS.** The dev frontend (`https://<app>.local`) and API (`https://<app>-api.local`) are different origins, so the backend allows the origins in `CORS_ORIGINS` (comma-separated, with credentials; both compose files default it to the frontend's). Unset = CORS off, which is right in production: App Platform serves the frontend and the API (`/api`) on one domain. `Strict-Transport-Security: max-age=31536000; includeSubDomains` (no `preload`) is sent by the backend and by the Next.js production build (`next.config.ts` `headers()`), only when `NODE_ENV=production` and never for `localhost` or a `*.local` host. No helmet.
## After scaffolding
```bash
doppler run -- docker compose up # FE https://<app>.local, API https://<app>-api.local
```
Dependencies and prisma always run **inside the container** (binary-compatible with prod), e.g. `docker compose exec backend npm i <pkg>`; prisma from the backend package: `doppler run -- docker compose exec -w /app/services/backend backend npx prisma migrate dev`. See the scaffolded app's `CLAUDE.md`.
The backend is what the pinned Nest CLI generates — today an **ES-module** package (`"type": "module"`): relative imports carry the `.js` suffix (`import { AppModule } from './app.module.js'`), tests run on vitest and lint on oxlint. The frontend's `typecheck` is `next typegen && tsc --noEmit`: Next generates the route types `tsc` needs, so it is green on a fresh clone.
## Migrations reach production
`prisma migrate dev` writes a migration into `services/backend/prisma/migrations/`; commit it. The production backend image can apply it itself: `prisma` (the CLI) and `dotenv` (imported by the prisma config file) are **runtime** dependencies of the backend, and the image carries `prisma/`, the prisma config file and `migrate.sh`. On DigitalOcean, squidinfra runs `sh services/backend/migrate.sh` as a PRE_DEPLOY job before every deployment (a failure stops the rollout); squidci checks the migrations in CI. `migrate.sh` prints JSON events (`migrate_start`, `migrate_waiting`, `migrate_ok`, `migrate_failed` with a UTC `restore_point`), waits up to `MIGRATE_WAIT_SECONDS` (60) for the database, uses `MIGRATE_DATABASE_URL` (a direct connection) when set, else `DATABASE_URL`, and under Doppler keeps those two from the environment (`doppler run --preserve-env`). The rules for writing migrations are in the app's `CLAUDE.md`.
## Secrets — Doppler or a local Infisical
Secrets never live in a committed `.env`. `${VAR}` in `docker-compose.yml` is interpolated from the injected shell:
- **Doppler** (default): every run is `doppler run -- …`; add a secret with `printf '%s' "$VALUE" | doppler secrets set KEY -p <app> -c dev`.
- **Infisical** (`--secrets infisical`, local dev only, free): three extra compose services (`secrets` = Infisical at `https://<app>-secrets.local`, `secrets-db`, `secrets-redis`), bootstrapped without prompts (admin, org, project `<app>-dev`, a read-only machine identity). Every run is `npm run secrets -- …` (`.squid/secrets.mjs`, plain Node; it starts the `secrets` service if needed). The instance's keys and logins are only in `.squid/local/` (0600, gitignored, never in an image). Production on Infisical is squidsecrets (premium).
## Deploying
This skill only scaffolds local dev. The rest of the lifecycle: **squidinfra** (registry + `.do/app.yaml` + managed Postgres) → **squidci** (GitHub Actions: push to `main` → test → build amd64 → push DOCR → deploy) → **squidmon** (New Relic APM, Browser, logs, /health, dashboard, alerts).
## New Relic (optional)
Backend preloads the agent the way New Relic documents for an ES-module app — `start.sh` runs `node --import newrelic/esm-loader.mjs -r newrelic …` only when `NEW_RELIC_LICENSE_KEY` is set (an in-app require/import loads too late to instrument; without the loader, code loaded through `import` is not instrumented) — plus `newrelic.cjs` config with log forwarding on (`.cjs`: the agent cannot read a `newrelic.js` inside an ES-module package). No key → plain `node`, fully dormant. To turn on: `doppler secrets set NEW_RELIC_LICENSE_KEY=… -p <app> -c prd` (squidmon does this) and redeploy. APM traces + pino logs then flow to NR.
## .squid manifest
Scaffolding writes `.squid/config.yml` — the app's choices, read by every squid skill (a missing file or key = the opinionated default, so a clean repo just works). Committed; never holds secrets. Edit it to deviate:
```yaml
app: myapp
secrets: doppler # doppler | infisical | dotenv (dotenv = tracked follow-up, not honored yet)
monitoring: newrelic # newrelic | none (none → squidmon skips)
realtime: none # pusher | none (squidpush sets pusher)
workflows: none # inngest | none (squidflow sets inngest)
dopplerProject: myapp
# added as you run the other skills:
infraProject: squidcode-infra # squidinfra/squidci
region: nyc # squidinfra
infra: digitalocean # squidinfra
ci: github # squidci
```
Every skill reads this for its defaults (so you don't re-pass `infra-project` / Doppler project to each one) and records its decisions back. Precedence: **explicit arg > env > manifest > built-in default**. Shared reader: `lib/squid.sh` (`squid_get` / `squid_set` / `squid_default`) — flat YAML, no `yq`.
## Notes
- Checks are uniform across both services via root workspace scripts (`npm run lint|format:check|typecheck|test`). Pre-commit and CI both call these, so they never drift.
- CI parallelism is a `fail-fast: false` matrix over the four check names — one job each.
- If the user wants a different stack (no Tailwind, pnpm, extra service), edit the script/templates rather than improvising per-run.