Hardened Next.js SaaS Scaffold, Extended into an AI Document-Generation App
Overview
An internal, production-hardened Next.js starter that bundles authentication, i18n, security, and observability out of the box, then used as the foundation for a real AI document-generation product. It captures the studio’s opinionated baseline for spinning up new web apps quickly without re-solving the same cross-cutting concerns each time.
Why It Exists
Every new web product needs the same plumbing: auth, internationalization, form validation, database access, error tracking, analytics, and rate limiting. This scaffold standardizes those choices so a new app can go from zero to a deployable, observable, secured shell in hours, and it doubled as the base for a document-generation app (an AI-assisted official-document/“declaratie” generator).
What We Built
The codebase follows the App Router with localized routing under [locale], split into (auth) and (marketing) route groups: Clerk-powered sign-in/sign-up, dashboard, and user-profile flows on one side; marketing, about, counter, and a dynamic portfolio/[slug] section on the other. Cross-cutting libraries live under src/libs, DB.ts (Drizzle + Neon/PGlite), Arcjet.ts (bot/abuse protection), I18n* (next-intl routing and navigation), Logger.ts (LogTape), plus openai/ and perplexity/ clients that power a DocumentGenerationForm. Analytics is wired through PostHog providers and a page-view tracker, errors through Sentry, and environment safety through @t3-oss/env-nextjs with Zod-validated env.
Technologies & Approach
TypeScript end-to-end. Next.js App Router with next-intl for locale-aware routing, Clerk for auth, Drizzle ORM over Neon PostgreSQL (with PGlite for local/dev), React Hook Form + Zod for forms, and Arcjet for edge security. Observability is first-class via Sentry, PostHog, and LogTape. The AI layer integrates OpenAI and Perplexity behind thin client modules so document-generation features stay swappable.
Outcome / Impact
Served as a reusable internal baseline and proved itself by becoming the skeleton of a working AI document-generation app. The latest history snapshot was emptied (content removed), so it stands today as an archived reference for the studio’s preferred Next.js stack rather than a live deployment.
Capabilities Demonstrated
- Opinionated, production-ready Next.js App Router scaffolding
- Internationalized (next-intl) multi-locale web apps
- Auth (Clerk), security (Arcjet), and Zod-validated environments baked in
- Built-in observability: Sentry, PostHog, structured logging
- Drizzle ORM over serverless Postgres (Neon) with local PGlite parity
- LLM integration (OpenAI, Perplexity) for document-generation features