A modern, production-ready Next.js template with TypeScript, Tailwind CSS, and best practices built-in. This template provides a solid foundation for building scalable web applications with a focus on developer experience and performance.
- ⚡️ Next.js 14 - React framework with App Router
- 🎨 Tailwind CSS - Utility-first CSS framework
- 🧩 HeroUI - Beautiful React components
- 📝 TypeScript - Type safety and better DX
- 🔍 ESLint & Prettier - Code quality and formatting
- 🪝 Husky & Lint-staged - Git hooks for code quality
- 📊 React Query - Powerful data synchronization
- 🌙 Dark Mode - Built-in theme switching
- 📱 Responsive - Mobile-first design approach
- 🚀 Vercel Ready - Optimized for deployment
- Node.js 18+
- pnpm 8.0.0+
- Clone this template:
# Using GitHub template
gh repo create my-app --template yourusername/nextjs-template
# Or clone directly
git clone https://github.com/yourusername/nextjs-template.git my-app
cd my-app- Install dependencies:
pnpm install- Set up environment variables:
cp .env.example .env.local- Start the development server:
pnpm devOpen http://localhost:3000 to see your app.
nextjs-template/
├── public/ # Static files
│ └── favicon/ # Favicon files
├── src/
│ ├── app/ # Next.js App Router
│ │ ├── layout.tsx # Root layout
│ │ ├── page.tsx # Home page
│ │ └── providers.tsx # App providers
│ ├── components/ # Reusable components
│ │ ├── icons/ # Icon components
│ │ ├── layout/ # Layout components
│ │ └── ui/ # UI components
│ ├── constant/ # Constants and config
│ ├── libs/ # External libraries setup
│ │ ├── apis/ # API clients
│ │ └── hooks/ # Custom hooks
│ ├── styles/ # Global styles
│ ├── types/ # TypeScript types
│ └── utils/ # Utility functions
├── .eslintrc.json # ESLint configuration
├── .gitignore # Git ignore rules
├── .env.example # Environment variables template
├── next.config.js # Next.js configuration
├── package.json # Dependencies and scripts
├── postcss.config.js # PostCSS configuration
├── tailwind.config.ts # Tailwind CSS configuration
└── tsconfig.json # TypeScript configuration
# Development
pnpm dev # Start development server
# Build
pnpm build # Build for production
pnpm start # Start production server
# Code Quality
pnpm lint # Run ESLint
pnpm format # Format code with Prettier
pnpm check-types # Type checking
# Git Hooks (automatic)
pre-commit # Runs lint-staged before commitSee .env.example for all available environment variables. Key variables:
NEXT_PUBLIC_APP_URL- Your application URLNEXT_PUBLIC_API_URL- API endpoint URL
Tailwind configuration is in tailwind.config.ts. The template includes:
- Custom color palette
- Dark mode support
- HeroUI plugin integration
- Custom animations
TypeScript is configured with strict mode enabled. Path aliases are set up:
@/*- Maps tosrc/*@/public/*- Maps topublic/*
This template uses a combination of:
- Tailwind CSS for utility classes
- CSS Modules for component-specific styles (optional)
- HeroUI for pre-built components
- CSS Variables for theming
- React Query for server state
- React Context for global app state (if needed)
- Local component state with React hooks
The template includes a pre-configured API client using Axios:
import { apiClient } from '@/libs/apis/apiClient';
// Example usage
const data = await apiClient.get('/users');- Push your code to GitHub
- Import your repository on Vercel
- Configure environment variables
- Deploy
A Dockerfile can be added for containerized deployments:
FROM node:18-alpine AS builder
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm build
FROM node:18-alpine AS runner
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app
ENV NODE_ENV production
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/pnpm-lock.yaml ./pnpm-lock.yaml
RUN pnpm install --frozen-lockfile --prod
EXPOSE 3000
CMD ["pnpm", "start"]- Components: Keep components small and focused
- Types: Define types for all props and API responses
- Hooks: Extract complex logic into custom hooks
- Performance: Use dynamic imports for code splitting
- SEO: Utilize Next.js metadata API for SEO optimization
- Accessibility: Ensure all interactive elements are accessible
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please open an issue in the GitHub repository or reach out to the maintainers.
Built with ❤️ using Next.js