How shadcn-ui/taxonomy works
Purpose and runtime
Taxonomy is an archived Next.js 13 reference application demonstrating App Router layouts, Server/Client Components, authentication, subscription billing, CRUD content, and MDX publishing. It runs as a TypeScript Next.js application; the root shell is app/layout.tsx, with request gating in middleware.ts.
Route domains and entry points
Route groups separate independent site experiences without changing URLs:
• Marketing and blog: app/(marketing)/page.tsx, app/(marketing)/blog/[...slug]/page.tsx, app/(marketing)/[...slug]/page.tsx.
• Public docs/guides: app/(docs)/docs/[[...slug]]/page.tsx, app/(docs)/guides/[...slug]/page.tsx.
• Auth: app/(auth)/login/page.tsx, app/(auth)/register/page.tsx.
• Authenticated product areas: app/(dashboard)/dashboard/page.tsx, app/(editor)/editor/[postId]/page.tsx.
Nested layouts establish domain-specific navigation and access-oriented UI: app/(dashboard)/dashboard/layout.tsx, app/(editor)/editor/layout.tsx, and app/(marketing)/layout.tsx.
Identity and authorization
NextAuth is exposed through the App Router handler at app/api/auth/[...nextauth]/_route.ts; a legacy Pages Router counterpart remains at pages/api/auth/[...nextauth].ts. Authentication configuration and session access are centralized in lib/auth.ts and lib/session.ts. middleware.ts is the request boundary for route-level protection/redirect behavior, while dashboard/editor pages and API handlers enforce user-scoped operations.
Application data and post lifecycle
Prisma is the persistence boundary, configured by prisma/schema.prisma and instantiated through lib/db.ts, targeting PlanetScale per project documentation. Posts flow from dashboard/editor UI into REST-style route handlers:
• Collection creation/listing: app/api/posts/route.ts
• Per-post read/update/delete: app/api/posts/[postId]/route.ts
• Editor experience: components/editor.tsx, app/(editor)/editor/[postId]/page.tsx
Zod validation contracts at lib/validations/post.ts and lib/validations/user.ts constrain inbound mutations before database access.
Subscription and billing boundary
Stripe integration is isolated behind lib/stripe.ts and subscription interpretation in lib/subscription.ts. The billing UI is app/(dashboard)/dashboard/billing/page.tsx; checkout/customer-portal-oriented user operations use app/api/users/stripe/route.ts. Stripe sends authoritative subscription changes to app/api/webhooks/stripe/route.ts, which updates Prisma-backed user/subscription state rather than trusting browser-side billing status.
Content publishing and rendering
Versioned MDX files are the source for documentation, guides, blog posts, and legal/marketing pages under content/docs, content/guides, content/blog, and content/pages. contentlayer.config.js builds these into typed consumable content; catch-all routes resolve slugs and render the appropriate collection. MDX rendering/presentation is shared through components/mdx-components.tsx and components/mdx-card.tsx, separating filesystem-authored public content from database-authored editor posts.
Presentation, metadata, and external delivery
Tailwind CSS and Radix-based primitives compose the UI, with global and MDX/editor styling in styles/globals.css, styles/mdx.css, and styles/editor.css. Dynamic social images are generated at the edge-compatible route app/api/og/route.tsx, validated by lib/validations/og.ts. Search-engine directives originate from app/robots.ts. External material services are NextAuth providers/email authentication, PlanetScale via Prisma, Stripe webhooks/APIs, and Vercel OG rendering.
Main entry points: route.ts Post APIs · db.ts Prisma data access · layout.tsx App root shell · contentlayer.config.js Contentlayer build
Components 22
Public content
- Marketing & blog routes
app/(marketing)/page.tsx - Docs & guides routes
app/(docs)/docs/[[...slug]]/page.tsx - Versioned MDX content · Docs, guides, blog, and marketing pages.
content/docs - Contentlayer build
contentlayer.config.js - MDX presentation
components/mdx-components.tsx
Product & identity
- Request gate · Protects and redirects route requests.
middleware.ts - Login & register
app/(auth)/login/page.tsx - NextAuth handler
app/api/auth/[...nextauth]/_route.ts - Auth & session core
lib/auth.ts - Dashboard
app/(dashboard)/dashboard/page.tsx - Post editor
app/(editor)/editor/[postId]/page.tsx - Editor component
components/editor.tsx
Data & billing
- Post APIs · Collection and per-post CRUD endpoints.
app/api/posts/route.ts - Mutation validation
lib/validations/post.ts - Prisma data access
lib/db.ts - PlanetScale
- Billing UI & API · Checkout and customer portal operations.
app/(dashboard)/dashboard/billing/page.tsx - Stripe integration · API client and subscription interpretation.
lib/stripe.ts - Stripe webhook
app/api/webhooks/stripe/route.ts
Delivery & metadata
- Social image API
app/api/og/route.tsx - Robots directives
app/robots.ts
Other components
- App root shell
app/layout.tsx
Connections 23
- App root shell → Marketing & blog routes: hosts
- App root shell → Docs & guides routes: hosts
- App root shell → Login & register: hosts
- Request gate → Dashboard: guards
- Request gate → Post editor: guards
- Login & register → NextAuth handler: sign-in requests
- NextAuth handler → Auth & session core: uses
- Auth & session core → Prisma data access: loads users and sessions
- Versioned MDX content → Contentlayer build: compiled by
- Contentlayer build → Marketing & blog routes: blog and pages
- Contentlayer build → Docs & guides routes: docs and guides
- MDX presentation → Marketing & blog routes: renders MDX
- MDX presentation → Docs & guides routes: renders MDX
- Dashboard → Post APIs: manages posts
- Post editor → Editor component: hosts
- Editor component → Post APIs: reads and mutates
- Post APIs → Mutation validation: validates input
- Post APIs → Prisma data access: user-scoped CRUD
- Prisma data access → PlanetScale: persists to
- Billing UI & API → Stripe integration: starts billing operations
- Stripe webhook → Stripe integration: receives events from
- Stripe webhook → Prisma data access: updates subscriptions
- Social image API → Mutation validation: validates image input