A modern, minimal Next.js 15 starter template with Motion animations, Zustand state management, Tailwind CSS v4, and TypeScript. Production-ready with built-in dark mode, engineering best practices, and automatic deployment.
Language: 中文文档 | English
- 🚀 Next.js 15: Latest React framework with App Router and Turbopack
- 🎨 Tailwind CSS v4: Next-generation utility-first CSS framework
- 🐻 Zustand: Lightweight and scalable state management
- 🎭 Motion: Performant animations with declarative API
- 🌗 Dark Mode: Seamless theme switching with system preference support
- 📘 TypeScript: Full type safety with strict mode enabled
- 🛠️ Engineering Tools: ESLint, Prettier, Husky, lint-staged, and Commitlint
- 🚀 GitHub Actions: Automated deployment to GitHub Pages
- 📦 clsx: Conditional className utility for cleaner component code
This template provides a minimal, production-ready foundation rather than a bloated framework. It includes only the essentials, allowing you to:
- Add your preferred UI component library (shadcn/ui, Ant Design, Material-UI, etc.)
- Integrate any database solution (Prisma, Drizzle, Supabase, etc.)
- Implement authentication (NextAuth, Clerk, Auth0, etc.)
- Scale with your own backend architecture
- Node.js 18+
- pnpm (recommended) or npm/yarn
# Clone the repository
git clone https://github.com/crper/next-modern-starter.git
cd next-modern-starter
# Install dependencies
pnpm install
# Start development server with Turbopack
pnpm dev
Open http://localhost:3000 to see your app.
Push to the main
or master
branch to automatically deploy via GitHub Actions:
- Enable GitHub Pages in your repository settings
- Set source to "GitHub Actions"
- Push your code - deployment happens automatically
Click the "Deploy with Vercel" button above or:
npx vercel
This template works with any platform that supports Next.js:
- Netlify
- Railway
- Render
- AWS Amplify
├── .github/
│ └── workflows/
│ └── deploy.yml # GitHub Pages deployment
├── public/ # Static assets
│ └── images/ # Optimized images
├── src/
│ ├── app/ # Next.js App Router
│ │ ├── layout.tsx # Root layout with providers
│ │ ├── page.tsx # Home page
│ │ └── globals.css # Global styles and Tailwind
│ ├── components/ # React components
│ │ ├── Counter.tsx # Counter demo with Zustand
│ │ ├── TodoList.tsx # Todo demo with animations
│ │ ├── ThemeToggle.tsx # Theme switcher
│ │ └── ThemeProvider.tsx # Theme context provider
│ └── store/ # Zustand stores
│ └── index.ts # Global state management
├── eslint.config.mjs # ESLint flat config
├── next.config.ts # Next.js configuration
├── tailwind.config.ts # Tailwind CSS v4 config
└── tsconfig.json # TypeScript configuration
- Configuration via CSS
@config
directive - Automatic dark mode with
dark:
variants - Custom theme variables in
globals.css
- Optimized for performance
Powered by next-themes
with:
- System preference detection
- Manual theme switching
- No flash on load
- Persistent selection
- CSS variables for theming
// Conditional classes
className={clsx(
'base-class',
{
'active-class': isActive,
'error-class': hasError,
}
)}
// Multiple conditions
className={clsx(
'text-sm font-medium',
isLarge && 'text-lg',
color === 'primary' && 'text-blue-600'
)}
pnpm dev
- Start development server with Turbopackpnpm build
- Build for productionpnpm start
- Start production serverpnpm lint
- Run ESLintpnpm type-check
- Check TypeScript types
Zustand stores with TypeScript:
// Counter store example
const { count, increment, decrement } = useCounterStore();
// Task store with persistence
const { tasks, addTask, toggleTask } = useTaskStore();
Features:
- Redux DevTools integration
- Persistence middleware
- TypeScript autocompletion
- Minimal boilerplate
Motion (Framer Motion) integration:
// Simple animation
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.5 }}
>
Content
</motion.div>
// With AnimatePresence
<AnimatePresence mode="wait">
{items.map(item => (
<motion.div key={item.id} exit={{ opacity: 0 }}>
{item.content}
</motion.div>
))}
</AnimatePresence>
Follow Conventional Commits:
feat:
New featuresfix:
Bug fixesdocs:
Documentation changesstyle:
Code style changesrefactor:
Code refactoringtest:
Test updateschore:
Maintenance tasks
- ESLint with Next.js recommended rules
- Prettier for consistent formatting
- Husky for pre-commit hooks
- TypeScript strict mode
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'feat: add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
MIT License - see the LICENSE file for details.
- Next.js - The React framework
- Motion - Animation library
- Zustand - State management
- Tailwind CSS - CSS framework
- next-themes - Theme management
Happy coding! 🎉