scaffold-fullstack-app
Skill1 starsChanged 7 months agoMITView on GitHub
Scaffold a single-tenant full-stack app — Next.js (App Router) + Postgres + Auth.js + Brevo email + Razorpay/Stripe + observability. Use for solo or small-team apps where every user owns their own data, not multi-tenant SaaS. Less ceremony than scaffold-saas-starter; no orgs, no RLS.
- Reads credentials
In this repository50 other files it gives its agents.
- algolia-searchSkill
- audit-tautological-testsSkill
- blame-archaeologySkill
- brevo-emailSkill
- bun-runtimeSkill
- clerk-authSkill
- cloudflare-workersSkill
- dbt-data-modelingSkill
- explain-this-diffSkill
- extract-skill-from-sessionSkill
- fastapi-productionSkill
- find-dead-codeSkill
- find-real-bugSkill
- gdpr-dpiaSkill
- github-actions-ciSkill
- graphql-relaySkill
- grpc-servicesSkill
- hipaa-auditSkill
- india-dpdp-actSkill
- java-8-to-21Skill
- jest-to-vitestSkill
- kubernetes-helmSkill
- mongo-to-postgresSkill
- nextjs-pages-to-appSkill
- node-version-upgradeSkill
- opentelemetry-instrumentSkill
- pci-dss-checklistSkill
- plan-the-rollbackSkill
- python-2-to-3Skill
- razorpay-integrationSkill
- react-native-expoSkill
- scaffold-cli-toolSkill
- scaffold-go-microserviceSkill
- scaffold-new-appSkill
- scaffold-saas-starterSkill
- sentry-monitoringSkill
- shrink-this-prSkill
- soc2-evidenceSkill
- spec-from-conversationSkill
- stripe-integrationSkill
- supabase-backendSkill
- terraform-patternsSkill
- threat-modeling-strideSkill
- triage-stack-traceSkill
- wcag-accessibility-auditSkill
- webpack-to-viteSkill
- write-adrSkill
- write-commit-messageSkill
- write-pr-descriptionSkill
- write-runbookSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 124
Discipline (no RLS net): every query against projects MUST filter by userId.
- Very specific: line 135
Don't expose raw db to route handlers — only helpers that have already filtered by user.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Scaffold a Single-Tenant Full-Stack App
The lighter cousin of scaffold-saas-starter. For apps where the tenancy boundary is the user, not an organization — internal tools, indie SaaS, side projects, B2C consumer apps. No row-level security ceremony, no Clerk billing, just enough structure to ship.
When to use
- Indie SaaS / side project — you want production-quality but not enterprise scaffolding.
- Internal tool — small team, single org effectively.
- B2C consumer app where each user owns their own data.
- Pre-PMF, want to ship in days.
When NOT to use
- B2B with teams/orgs/invites →
scaffold-saas-starter. - Need shared workspaces / collaboration →
scaffold-saas-starter. - Multi-region or compliance constraints (HIPAA, regulated) — needs more than this scaffold.
Decisions made for you
| Decision | Choice | Why |
| Auth | Auth.js (NextAuth v5) | Free, no vendor lock-in, magic-link + OAuth out of box |
| DB | Postgres + Drizzle | Same as SaaS scaffold, less the RLS overhead |
| Tenancy | user_id column on owned rows | No RLS needed; single-tenant boundary |
| Web | Next.js 16 App Router | Matches SaaS scaffold for muscle memory |
| Brevo | Free tier covers most indie launches | |
| Payments | Razorpay or Stripe (skip if not needed) | Don't wire until you charge |
| Background jobs | pg-boss on same DB | Avoid Redis until needed |
| Deploy | Vercel + Neon (free tiers) | $0 to first user |
File structure
my-app/
src/
app/
(marketing)/page.tsx # public landing
(auth)/sign-in/page.tsx
(app)/ # authenticated
dashboard/page.tsx
settings/page.tsx
api/
auth/[...nextauth]/route.ts
webhooks/
razorpay/route.ts # only if billing
brevo/route.ts
lib/
auth.ts # auth() helper
db.ts # Drizzle client
email.ts # Brevo wrapper
billing.ts # only if billing
db/
schema.ts
migrations/
.env.example
drizzle.config.ts
next.config.ts
package.json
README.md
docker-compose.yml # local PostgresNote: no apps/ monorepo split. One Next.js project, one DB package. If you outgrow it, lift to apps/web later — 30 min refactor.
Auth.js v5 minimal setup
// src/lib/auth.ts
import NextAuth from "next-auth";
import GitHub from "next-auth/providers/github";
import { DrizzleAdapter } from "@auth/drizzle-adapter";
import { db } from "./db";
export const { auth, handlers, signIn, signOut } = NextAuth({
adapter: DrizzleAdapter(db),
providers: [GitHub],
pages: { signIn: "/sign-in" },
callbacks: {
session: async ({ session, user }) => {
session.user.id = user.id;
return session;
},
},
});// src/middleware.ts
export { auth as middleware } from "@/lib/auth";
export const config = {
matcher: ["/((?!api/auth|_next/static|_next/image|favicon.ico|sign-in).*)"],
};That's it for auth. No Clerk dashboard, no org UI to build, no per-tenant config.
Schema rule: every owned row has user_id
// src/db/schema.ts
import { pgTable, uuid, text, timestamp, integer } from "drizzle-orm/pg-core";
export const users = pgTable("users", {
id: text("id").primaryKey(), // from Auth.js
email: text("email").notNull().unique(),
name: text("name"),
createdAt: timestamp("created_at").notNull().defaultNow(),
});
export const projects = pgTable("projects", {
id: uuid("id").primaryKey().defaultRandom(),
userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
name: text("name").notNull(),
createdAt: timestamp("created_at").notNull().defaultNow(),
});Discipline (no RLS net): every query against projects MUST filter by userId. Bake this into a helper:
// src/lib/db-helpers.ts
export async function listMyProjects() {
const session = await auth();
if (!session?.user?.id) throw new Error("unauthenticated");
return db.select().from(projects).where(eq(projects.userId, session.user.id));
}Don't expose raw db to route handlers — only helpers that have already filtered by user. This is the poor person's RLS.
What the scaffold emits
- The directory tree above.
- Auth.js v5 with GitHub + Google + Email magic-link providers configured (env-toggle).
- Drizzle schema with
users,accounts,sessions(Auth.js tables) + exampleprojectstable withuser_id. - Brevo email helper with magic-link template.
- Optional Razorpay/Stripe billing (asks at scaffold time; skips if "not yet").
.env.examplewith every var.docker-compose.ymlfor local Postgres.- GitHub Actions: typecheck, lint, build, migration dry-run.
Anti-patterns
- No
userIdfilter on a query — single bug = full leak. Helper-only access pattern catches it at code review. - Storing user data without
onDelete: "cascade"— GDPR/DPDP "right to delete" requires the cascade work. Setting it later requires backfill. - Auth.js Email provider without configuring Brevo — magic links fail silently. Wire email at the same time as auth, not later.
- Building auth UI from scratch — Auth.js gives you sane defaults. Don't.
- Wiring billing before you charge — adds maintenance load with no revenue. Skip until you have a real plan to sell.
- No
.env.example— same problem as in SaaS scaffold; ship it day 1. - Vercel + Vercel Postgres — Vercel Postgres is expensive for small apps. Use Neon free tier; switch later if needed.
- No background jobs at all, "we'll cron it" — first delayed task you need (welcome email after signup, retention campaign) becomes a hack.
pg-bossis 50 lines.
Verify it worked
pnpm devstarts Next.js with Postgres connected.- GitHub sign-in completes round-trip; user row appears in
userstable. listMyProjects()returns 0 rows when called as a different user.- Magic link email arrives via Brevo (check spam in test).
pnpm build && pnpm startsucceeds — no dev-only imports leak.- First Vercel deploy: < 15 minutes from
git inittohttps://*.vercel.app/sign-inworking. - CI passes on a fresh push.
DELETE FROM users WHERE id='xxx'cascades and removes their projects (no orphans).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

