next-forge Documentation
repository·main·Indexed 27 days ago
https://github.com/vercel/next-forgeA production-grade Turborepo template for Next.js applications designed for building SaaS products. It provides an opinionated foundation with integrated tooling for authentication (Clerk), payments (Stripe), email (Resend), and observability (Sentry). The template includes Geistdocs, a documentation template built with Next.js and Fumadocs featuring AI chat, GitHub Discussions integration, and MDX support.
What's inside next-forge
- Geistdocs is a modern documentation template built with Next.js and Fumadocs. It is designed for quickly creating Vercel-style documentation sites with a consistent UI and built-in features like AI chat and GitHub Discussions integration.
Overview of next-forge Apps and Ports
mainThe next-forge monorepo contains several deployable applications located in the
/apps/directory. Each app runs on a specific default port during local development:App Port Purpose app3000 Main authenticated SaaS application web3001 Marketing website with CMS and SEO api3002 Serverless API for webhooks, cron jobs email3003 React Email preview server docs3004 Documentation site (Mintlify) storybook6006 Design system component workshop studio3005 Prisma Studio for database editing Overview of next-forge
mainnext-forge is a production-grade Turborepo template for Next.js applications. It provides a comprehensive, opinionated foundation designed to help developers build SaaS applications by balancing development speed with high quality. It is intended to serve as a complete starting point with minimal initial configuration required.Key features of Geistdocs
mainGeistdocs provides the following built-in capabilities for documentation sites:
- MDX-powered documentation: Write content in MDX with full component support.
- AI-powered chat: An integrated AI assistant that understands your documentation content.
- GitHub Discussions integration: Allows users to provide feedback directly to your GitHub repository.
- Modern UI: Accessible components built with Radix UI.
- Advanced search: Fast, fuzzy search functionality across all documentation.
- Dark mode: Built-in theme switching support.
- Responsive design: Mobile-first approach.
- Performance: Built on Next.js 16 with App Router.
- RSS: Built-in RSS feed generation.
Understand Dark Mode implementation
mainDark mode innext-forgeis implemented using Tailwind CSS with thedarkMode: 'class'strategy. This toggles dark mode by adding adarkclass to thehtmlelement. Thenext-themesprovider handles theme persistence and system preference detection. Third-party components like Clerk and Sonner are preconfigured to respect this theme setup.Configure Storybook components
mainBy default, Storybook is pre-configured with all components fromshadcn/ui. It includes the necessary fonts and higher-order components to ensure the Storybook environment matches the visual experience of your main application.Configure Next.js image optimization and remote patterns
mainThenext-configpackage provides pre-configured image optimization settings. It enables support forAVIFandWebPformats and includes remote patterns to allow secure loading of images from Clerk (e.g., user profile images).Understand the formatting and linting toolchain
mainWeb application integrations and features
mainThe
webapplication innext-forgecomes pre-integrated with several core packages to provide a production-ready marketing site:- Design System: Uses the
@repo/design-systemcomponents, hooks, and utilities. - CMS: Integrated with the
cmspackage to power a type-safe blog. - SEO: Uses the
seopackage for search engine optimization. - Analytics: Connected to the
analyticspackage to track visitor behavior. - Observability: Connected to the
observabilitypackage for error capture and performance tracking.
- Design System: Uses the
Understand Sitemap Generation in next-forge
mainnext-forge uses Next.js's built-in
sitemap.tsfunctionality to automatically generate a sitemap during each build. The generation process aggregates routes from three primary sources:- Page Collection: Scans the
appdirectory for valid routes, excluding directories starting with_(private routes) or((route groups). - Blog Posts: Fetches published posts via
blog.getPosts()from@repo/cmsand generates URLs using the_slugfield under the/blog/path. - Legal Pages: Fetches legal pages via
legal.getPosts()from@repo/cmsand generates URLs using the_slugfield under the/legal/path.
Each entry in the resulting sitemap includes a full URL and a
lastModifiedtimestamp set to the current date.- Page Collection: Scans the
Understand the use of Next.js Server Actions instead of tRPC
mainNext-forge uses Next.js Server Actions instead of tRPC for building APIs. This choice provides type safety and framework integration with less complexity, leveraging native Next.js optimizations.Use Prisma in a Next.js monorepo
mainThenext-configpackage includes a Prisma plugin designed to correctly handle Prisma during server-side builds within a Next.js monorepo setup.