nfs-architecture-patternslisted
Install: claude install-skill juncoding/nextjs-fullstack-starter
# Architecture patterns for ongoing development
For projects already scaffolded with `nextjs-fullstack-starter`. Explains the patterns to follow when adding features. Companion to the `nfs-scaffold-app` skill which only handles initial setup.
## Use this skill when
- Adding a new business module (e.g. `customer`, `order`, `invoice`).
- Writing a new page, Server Action, or route handler.
- Deciding whether something belongs in a page, a Server Action, a route handler, an MCP tool, or a cron job.
- Wiring permissions on a new resource.
- Structuring a service that touches multiple modules.
- Caching with `cacheTag` / `updateTag` and not sure when to use which.
- Handling errors at any layer.
- Reviewing whether a PR follows project conventions.
## The four-rule cheat sheet
1. **`src/app/` is a thin delivery layer.** No business logic. No DB queries. Just: validate, call a service, return.
2. **`src/server/` is the entire backend.** Every file starts with `import "server-only";`.
3. **Permissions live in services.** Every service method touching user-owned data takes `userId` first and calls `requirePermission`.
4. **Audit calls live in services**, inside the same transaction as the mutation.
If you remember nothing else, remember these four.
## Reference index
Read the file matching your task:
| Doing this... | Read this |
|---|---|
| Creating a new business module (service, schema, types) | `references/service-layer.md` |
| Writing a Server Component page that reads