Next.js App
Full-featured Next.js Static Export Identity Auth Template
These full-featured templates serve as reference implementations for how to implement popular features and integrate them within .NET React Templates.
.NET 10 Full-featured Next.js Static Export Template
A modern full-stack .NET 10.0 + Next.js 16 project template that combines the power of ServiceStack with Next.js static site generation and React 19. It provides a production-ready foundation for building scalable web applications with integrated authentication, database management, and background job processing.
Quick Start
npx create-net nextjs MyProjectGetting Started
Run Server .NET Project (automatically starts both .NET and Next.js dev servers):
cd MyProject
dotnet watchArchitecture
Hybrid Development Approach
This template uses a hybrid architecture that differs between development and production environments:
Development Mode:
- ASP.NET Core proxies requests to Next.js dev server (running on port 3000)
- Hot Module Replacement (HMR) support for instant UI updates
- WebSocket proxying for Next.js HMR functionality
- Automatic startup of Next.js dev server in
dotnet watch
Production Mode:
- Next.js app is statically exported to
/dist - Static files served directly from ASP.NET Core's
/wwwroot - No separate Node.js server required in production
- Single container deployment with all static assets
Core Technologies
Frontend (Next.js 16 + React 19)
- Next.js with static export capability
- Tailwind CSS 4.x - Utility-first styling with dark mode support
- TypeScript - Type-safe development
- Vitest - Modern testing framework
- shadcn/ui - Beautiful, accessible component library
- ServiceStack React Components - Pre-built UI components
- SWR - React Hooks for data fetching with caching
Backend (.NET 10.0)
- ServiceStack 10.x - High-performance web services framework
- ASP.NET Core Identity Auth - Complete authentication & authorization system
- Entity Framework Core - For Identity Auth data management
- OrmLite - ServiceStack's fast, lightweight Typed ORM
- SQLite - Default database (easily upgradable to PostgreSQL/SQL Server/MySQL)
Major Features
1. Identity Authentication
- ASP.NET Core Identity integration with role-based access control
- Credentials-based authentication with secure cookie sessions
- User registration with email confirmation support
- Admin users feature for user management at
/admin-ui/users - API Keys for programmatic access
- Custom user sessions with additional claims
2. AutoQuery CRUD
- Declarative API development with minimal code
- Complete Auth-protected CRUD operations (see Bookings example at
/bookings-auto) - Automatic audit trails (created/modified/deleted tracking)
- Built-in validation and authorization
- Type-safe TypeScript DTOs auto-generated from C# models
- AutoQueryGrid component for rapid data grids
3. AI Chat Integration
- Built-in ChatFeature with multi-provider support
- Configurable providers: ServiceStack, OpenAI, Anthropic, Google, Groq, and more
- Persistent chat history with
DbChatStore - Admin analytics at
/admin-ui/chat
4. Background Jobs
BackgroundsJobFeaturefor async task processing- Command pattern for job execution
- Email sending via background jobs
- Recurring job scheduling support
- Job dashboard at
/admin-ui/jobs - Upgradable to
DatabaseJobsFeaturefor enterprise RDBMS
5. MDX Blog
- Integrated markdown blog with MDX support
- Markdown with React components
- Syntax highlighting with Prism.js
- Static generation - pre-rendered at build time
- YAML frontmatter metadata
- Custom remark plugin for YouTube embeds
- Beautiful typography with
@tailwindcss/typography
6. Developer Experience
- Admin UI at
/admin-uifor App management - Health checks at
/upendpoint - Modular startup configuration pattern
- Code-first migrations with EF Core
- Request logging with SqliteRequestLogger
- OpenAPI 3.0 with Scalar API documentation at
/scalar/v1 - Docker support with container publishing
- Kamal deployment configuration included
7. Production Features
- Static asset serving from ASP.NET Core
- Clean URLs without
.htmlextensions - HTTPS redirection and HSTS
- Data protection with persistent keys
- Health monitoring
- Database admin UI at
/admin-ui/database - Dark mode support with system preference detection
Project Structure
MyApp/ # Main ASP.NET Core host
├── Configure.*.cs # Modular startup configuration
├── Program.cs # Application entry point
└── wwwroot/ # Static files (production)
MyApp.Client/ # Next.js frontend application
├── app/ # Next.js App Router pages
├── components/ # React components
├── lib/ # Utilities and helpers
├── public/ # Static assets
├── dist/ # Build output (production)
└── styles/ # Tailwind CSS styles
MyApp.ServiceInterface/ # Service implementations
├── MyServices.cs # Example services
└── Data/ # EF Core DbContext
MyApp.ServiceModel/ # DTOs and service contracts
├── Bookings.cs # AutoQuery CRUD example
└── Hello.cs # Example service contract
MyApp.Tests/ # Integration and unit tests
config/ # Deployment configuration
└── deploy.yml # Kamal deployment settings
.github/ # GitHub Actions workflows
└── workflows/
├── build.yml # CI build and test
├── build-container.yml # Container image build
└── release.yml # Production deployment with KamalExample Pages
| Page | Description |
|---|---|
/ | Home page with getting started guide |
/todomvc | TodoMVC example with ServiceStack APIs |
/bookings-auto | AutoQueryGrid with automatic columns |
/bookings-custom | Custom booking form with validation |
/admin | Protected admin page (requires Admin role) |
/profile | User profile management |
/posts | MDX blog listing |
/shadcn-ui | shadcn/ui component showcase |
/about | About page (MDX) |
/features | Template features overview (MDX) |
/privacy | Privacy policy page (MDX) |
Admin UIs
Access built-in admin dashboards at:
/admin-ui- Admin dashboard home/admin-ui/users- User management/admin-ui/database- Database browser/admin-ui/logging- Request logs/admin-ui/jobs- Background jobs/admin-ui/apikeys- API key management/admin-ui/chat- AI chat analytics
Development Workflow
For detailed information on the development workflow, including starting development servers, generating TypeScript DTOs, database migrations, and testing, see:
Development Workflow Documentation
Configuration
For detailed configuration information, including app settings, SMTP email setup, AI chat providers, and upgrading to enterprise databases (PostgreSQL/SQL Server/MySQL), see:
Deployment
For deployment instructions, including Docker + Kamal setup and GitHub Actions configuration, see:
Ideal Use Cases
- SaaS applications requiring authentication
- Admin dashboards with CRUD operations
- Content-driven sites with MDX blog
- Applications needing AI chat integration
- Projects requiring background job processing
- Applications needing both SSG benefits and API capabilities
- Teams wanting type-safety across full stack
- Static sites that need dynamic API backends
