Nfs scaffold app
Skill juncoding/nextjs-fullstack-starter/skills/nfs-scaffold-app
Claude Code plugin: scaffold and maintain lightweight back-office apps on pure Next.js (App Router) — Server Components for reads, Server Actions for writes, services in src/server/modules/. No tRPC.
npx -y skills add juncoding/nextjs-fullstack-starter --skill nfs-scaffold-appAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Scaffold a brand-new fullstack back-office app on pure Next.js (App Router) — Server Components for reads, Server Actions for writes, services in src/server/modules/. Use this whenever the user wants to start a new internal tool, admin dashboard, back-office app, line-of-business system, lightweight ERP, or CRUD app on Next.js without a separate API service — even if they don't name the stack. Walks the user through an interactive Q&A (project name, location, database, auth, cache, MCP, deployment target), then generates the canonical folder structure, dependencies, sample Server Action, sample service, Prisma schema starter, .env.example, and CLAUDE.md. Always trigger when the user wants a Next.js fullstack starter without tRPC, when they describe building a back office with Server Components, or when they say 'one Next.js app does everything'.
SKILL.md
17.5 KB, as published. Nobody here has run it
Scaffold a new fullstack back-office app
This skill bootstraps a brand-new project on the pure Next.js (App Router) fullstack stack — no tRPC, no separate API service, no SPA shell. It is the entry point for the nextjs-fullstack-starter plugin and is invoked either explicitly via /nfs-scaffold-app or when the user expresses intent to start a new back-office system on plain Next.js.
When to use this skill
Use this skill when the user is starting a brand-new project in one of these shapes:
- Internal admin dashboard / management system
- Back-office tool for staff
- Line-of-business app with CRUD over rich domain models
- Lightweight ERP / operational tool
- Solo or small-team SaaS where the main app is auth-walled
- Any "one Next.js app does everything" project
Do NOT use this skill for:
- Adding a feature to an existing project (those have their own skills —
nfs-add-auth,nfs-add-cache,nfs-add-mcp). - Projects where the user wants tRPC + SPA mode — use the sibling plugin
nextjs-trpc-prisma-starterinstead. - Public-facing marketing sites or content sites where the patterns don't apply.
- Mobile-first products that need a typed HTTP API surface — Server Actions are web-only.
Why an interactive flow
The stack is opinionated but the project has variables (database, auth provider, whether to wire cache from day one, MCP, deploy target). Asking up front means the generated project is complete and consistent rather than half-configured. The user can always add things later via the nfs-add-* skills.
Use the AskUserQuestion tool for each step so the user gets a clean UI with options. Ask one question per call, not all at once — they shape later questions (e.g. answering "PostgreSQL" determines which Prisma adapter to install).
Conversation flow
Walk the user through these questions in this order. Stop and confirm before any file write.
1. Project name
Open-ended. Validate: lowercase, hyphens-only, no spaces, valid as both a folder name and an npm package name.
2. Project location
Options:
- New directory under current working directory (e.g.
./<project-name>/) - Use current working directory (must be empty — check first with
ls -A) - Custom absolute path
If "current directory" is chosen, run ls -A and abort if anything other than .git/ is present. Don't overwrite the user's stuff.
3. Database
Options:
- PostgreSQL (recommended) — production default. Uses
@prisma/adapter-pgdriver. - SQLite — for prototyping / very small deployments. No driver adapter needed.
- MySQL — if the team has existing MySQL infrastructure.
Skip MongoDB — Prisma supports it but the patterns in architecture-patterns assume relational. Tell the user that if they ask.
4. Auth
Options:
- Better Auth (recommended) — modern, RBAC built-in, MCP plugin available, credentials + magic-link + OAuth providers.
- Skip for now — generate without auth wiring; user can run
/nfs-add-authlater.
Don't offer NextAuth here — Better Auth is the locked default for this stack because it integrates cleanly with the MCP plugin and has a simpler RBAC story. If the user pushes back, talk it through, but don't generate a NextAuth scaffold.
5. Cache
Options:
- Next.js default cache (recommended for start) — built-in
cacheTag+cacheLife+updateTag. In-process. Fine until measurably not. - Add Redis on top — wire
ioredis+ a Next.js cache handler from day one. Useful if multi-process / multi-deploy cache coherence matters.
6. MCP entry point
Options:
- Yes (recommended) — wires
/api/mcp/route.tswith Better Auth'smcpplugin acting as OAuth provider. Adds one example tool. Requires Better Auth (from step 4) — if user skipped auth, warn and offer to enable both. - Skip — easy to add later via
/nfs-add-mcp.
7. Deployment target
Options:
- Self-hosted Docker (e.g. on EC2) — adds
Dockerfile,docker-compose.yml,next.config.tswithoutput: 'standalone'. - Vercel — adds
vercel.tsconfig, no Dockerfile, adjusts a couple of patterns (e.g. cron via Vercel Crons instead of in-processnode-cron). - Both / undecided — adds the Docker bits but doesn't strip Vercel compat.
8. Email / templates (optional)
Options:
- Skip
- Resend + Handlebars — wires
src/server/integrations/resend/, outbox pattern, retry cron.
9. PDF generation (optional)
Options:
- Skip
- Gotenberg — adds
src/server/integrations/gotenberg/+docker-compose.ymlservice.
10. Confirm
Show a summary of all choices and the file/folder list that will be generated. User confirms or backs up.
Generated structure
Files generated are derived from the answers plus the templates in assets/. The canonical layout is documented in references/folder-structure.md — read it before writing.
Top level:
<project-name>/
├── src/
│ ├── app/
│ │ ├── (auth)/login/page.tsx
│ │ ├── (dashboard)/
│ │ │ ├── layout.tsx # sidebar + requireSession()
│ │ │ ├── page.tsx # placeholder home
│ │ │ └── _example/ # sample CRUD page (list + new + [id])
│ │ ├── (mcp)/mcp/route.ts # if MCP=yes
│ │ ├── api/
│ │ │ ├── auth/[...all]/route.ts # if Better Auth
│ │ │ ├── health/route.ts
│ │ │ └── webhooks/ # placeholder folder
│ │ ├── layout.tsx
│ │ └── globals.css
│ ├── server/
│ │ ├── db/client.ts
│ │ ├── auth/
│ │ │ ├── index.ts
│ │ │ ├── session.ts # requireSession()
│ │ │ └── permissions.ts # requirePermission()
│ │ ├── modules/
│ │ │ └── _example/ # sample service + schema
│ │ │ ├── _example.service.ts
│ │ │ └── _example.schema.ts
│ │ ├── actions/
│ │ │ └── _example.actions.ts # sample Server Action
│ │ ├── jobs/ # cron registration
│ │ │ └── index.ts
│ │ ├── lib/
│ │ │ ├── logger.ts
│ │ │ ├── errors.ts
│ │ │ └── cache.ts # if cache=Redis
│ │ ├── mcp/ # if MCP=yes
│ │ │ ├── registry.ts
│ │ │ └── tools/_example.ts
│ │ └── integrations/ # placeholder folder
│ ├── components/ui/ # shadcn primitives (added as needed)
│ ├── lib/utils.ts
│ ├── hooks/
│ └── env.ts # @t3-oss/env-nextjs
├── prisma/
│ ├── schema.prisma
│ ├── migrations/
│ └── seed.ts
├── tests/
│ └── e2e/ # Playwright placeholder
├── public/
├── docs/
│ ├── handoff.md # session-handoff doc (start-here for Claude)
│ └── architecture.md # link to plugin's docs/
├── instrumentation.ts # boots cron in production
├── .env.example
├── .gitignore
├── CLAUDE.md # generated, reflects choices
├── Dockerfile # if deploy=docker
├── docker-compose.yml # postgres + (gotenberg + redis if enabled)
├── next.config.ts
├── tsconfig.json
├── package.json
├── jest.config.js
└── README.md
Generation steps in order
Execute these steps sequentially. After each step, briefly confirm completion before moving on.
- Create root + directory tree.
mkdir -pthe full tree. - Write
package.jsonfromassets/package.json.template, filling in dependencies based on choices. (Dropioredisif cache=skip; dropresendif email=skip; etc.) - Write
tsconfig.json(assets/tsconfig.json.template),next.config.ts(assets/next.config.ts.template),jest.config.js(assets/jest.config.js.template). - Write
.eslintrc.json(assets/eslintrc.template) and.prettierrc.json(assets/prettierrc.template) — the verification gate uses both. - Write
.gitignorefromassets/gitignore.template. - Write
prisma/schema.prismafromassets/prisma-schema.starter.prisma, swapping the datasource provider per the DB choice. Includes User / Session / Account / Verification / Role / Permission / RolePermission / UserRole / AuditLog / Example models out of the box. - Write
src/env.tsfromassets/env.ts.template, only including the env keys the project's enabled features need (dropREDIS_URLif cache=skip, etc.). - Write
.env.exampleusingreferences/env-example-template.md— block-assembled from feature flags. - Write
src/server/db/client.tsfromassets/db-client.ts.template. - Write the auth scaffolding (if not skipped):
src/server/auth/index.tsfromassets/auth-index.ts.templatesrc/server/auth/session.tsfromassets/auth-session.ts.templatesrc/server/auth/permissions.tsfromassets/auth-permissions.ts.templatesrc/lib/auth-client.tsfromassets/auth-client.ts.templatesrc/app/(auth)/login/page.tsxfromassets/login-page.tsx.templatesrc/app/api/auth/[...all]/route.tsfromassets/api-auth-route.ts.template
- Write
src/server/lib/logger.ts(assets/logger.ts.template) andsrc/server/lib/errors.ts(assets/errors.ts.template). - Write
src/server/modules/audit/audit.service.tsfromassets/audit-service.ts.templateso the example service's audit calls actually resolve. - Write the service-layer scaffolding —
src/server/modules/_example/_example.service.ts(assets/example-service.ts.template) +_example.schema.ts(assets/example-schema.ts.template). ShowsuserId-first, permission check, audit-inside-transaction. - Write the Server Action scaffolding —
src/server/actions/_example.actions.tsfromassets/example-action.ts.template. Shows'use server'+ safeParse +revalidatePath+updateTag+redirect. - Write the styling roots:
src/app/globals.cssfromassets/globals.css.templatepostcss.config.mjsfromassets/postcss.config.template- (No
tailwind.configneeded — Tailwind v4 reads@themeblocks fromglobals.css.)
- Write the root layout —
src/app/layout.tsxfromassets/root-layout.tsx.template(importsglobals.css, renders<html>/<body>, wires<Toaster />). - Write the dashboard layout + home —
src/app/(dashboard)/layout.tsxfromassets/dashboard-layout.tsx.template(callsrequireSession(), renders sidebar)src/app/(dashboard)/page.tsxfromassets/dashboard-home-page.tsx.template
- Write the sample page tree —
src/app/(dashboard)/_example/page.tsxfromassets/example-list-page.tsx.templateandnew/page.tsxfromassets/example-new-page.tsx.template. - Write the health route —
src/app/api/health/route.tsfromassets/api-health-route.ts.template. This is the documented exception to Rule 1 (the route does a direct DB call — necessary for ALB / Caddy probes). - Write the MCP route + registry + one example tool (if requested) — inline the code blocks from
nfs-add-mcp/SKILL.mdintosrc/app/(mcp)/mcp/route.ts,src/server/mcp/registry.ts,src/server/mcp/tools/_example.ts, plus the two.well-knownOAuth discovery routes. Add the three OAuth tables toprisma/schema.prisma. (The MCP files don't haveassets/templates — they live in the add-mcp skill as the canonical reference.) - Write
instrumentation.ts(assets/instrumentation.ts.template) +src/server/jobs/index.ts(assets/jobs-index.ts.template) so cron registers once at boot. - Write the seed + admin-bootstrap scripts —
prisma/seed.tsfromassets/seed.ts.template(seeds default roles + permissions + role-permission joins)prisma/grant-sysadmin.tsfromassets/grant-sysadmin.ts.template(one-shot CLI to grant sysadmin after a user signs up)
- Write
Dockerfile(assets/dockerfile.template) +docker-compose.yml(assets/docker-compose.yml.template) if Docker deploy. - Write
CLAUDE.mdfromassets/claude-md.template, substituting{{PROJECT_NAME}},{{ONE_LINE_DESCRIPTION}},{{DB_NAME}},{{AUTH_BLOCK}},{{DEPLOY_NOTE}},{{DEPLOY_BLOCK}}. This is the contract for future Claude sessions. - Write
docs/handoff.mdfromassets/handoff.md.template, substituting today's date and the per-feature state lines. - Write
docs/architecture.md— copy from<plugin-root>/docs/architecture.md(at the plugin's root, not under any skill folder). - Write
README.mdfromassets/readme.template. git init+ first commitchore: initial scaffold from nextjs-fullstack-starter. Tell the user explicitly: "I'm creating a nested independent git repo here — it's not a submodule of any outer repo."- Verification step — run
pnpm install,pnpm prisma generate,pnpm tsc --noEmit,pnpm lint. Report results. Do not try to run migrations (no DB yet); the user owns that.
{{VARIABLE}} substitution reference
Many templates carry {{...}} slots. The full table:
| Variable | Source / value |
|---|---|
{{PROJECT_NAME}} | Q1 answer (e.g. inventory-tracker) |
{{PROJECT_NAME_SNAKE}} | {{PROJECT_NAME}} with - → _ (e.g. inventory_tracker); used for DB names |
{{ONE_LINE_DESCRIPTION}} | Asked separately or defaulted to "An internal back-office app." |
{{DB_NAME}} | PostgreSQL / SQLite / MySQL (Q3) |
{{PRISMA_PROVIDER}} | postgresql / sqlite / mysql (lowercase form for datasource db) |
{{AUTH_BLOCK}} | Better Auth if enabled, (no auth wired yet — run /nfs-add-auth to add) if skipped |
{{AUTH_DEP}} | better-auth if auth enabled, else removed from package.json |
{{AUTH_DEP_VERSION}} | ^1.0.0 (current major as of this plugin's release) |
{{DEPLOY_NOTE}} | Self-hosted in Docker. / Deployed to Vercel. / empty |
{{DEPLOY_BLOCK}} | Short paragraph describing the deploy setup matching the choice |
{{TODAY_ISO_DATE}} | YYYY-MM-DD |
{{AUTH_STATE_LINE}} | E.g. Better Auth wired. Credentials login at /login. or Auth skipped — run /nfs-add-auth to add. |
{{MCP_STATE_LINE}} | E.g. MCP route at /mcp with one example tool. or MCP skipped. |
{{CACHE_STATE_LINE}} | E.g. Using Next.js default cache. or Redis wired via src/server/lib/cache.ts. |
Key templates and references
The work is data-driven from the answers + these files:
references/stack-rationale.md— explains why this stack (read if user asks "why not X").references/folder-structure.md— the canonical layout, expanded with comments.references/claude-md-template.md— theCLAUDE.mdtemplate with variable slots.references/env-example-template.md— the.env.exampletemplate, keyed by which optional features were enabled.assets/*.template— actual file bodies to drop in, with{{VARIABLE}}slots.
When writing a file, read the corresponding template, substitute variables, then write. Don't generate from scratch — the templates carry hard-won decisions.
Post-scaffold
After the scaffold lands, point the user at the next moves:
pnpm devto start the dev server.- Edit
prisma/schema.prismato add their first real model. pnpm prisma migrate dev --name initto apply.- Replace
_examplewith their first real business module — copy the shape verbatim. /nfs-add-cache,/nfs-add-mcp,/nfs-add-authto retrofit later.- See
docs/architecture.mdin the project for ongoing patterns.
Sanity guards
- Never overwrite an existing file without explicit confirmation. Always
lsthe target directory first. - Never run
pnpm installin the user's current directory if the project location is "new subdirectory" —cdinto the new dir first. - Never push to a remote automatically. The user owns that.
- Never invent dependencies — every dep in
package.json.templateexists and is on a real version. - Never skip the CLAUDE.md step — it's the most load-bearing file in the project's future, since every future Claude session reads it first.
- Never wire Server Actions without
revalidatePathorupdateTag— the cache won't refresh and the user will think the action did nothing. The example action template demonstrates the right pattern; preserve it.