Skip to content
/ next-template Public template

Production-ready Next.js starter with TypeScript, Tailwind, and i18n support. PWA-enabled for modern web development.

License

Notifications You must be signed in to change notification settings

montymi/next-template

Repository files navigation

Creator Contributors Forks Stargazers Issues License

πŸ“‘ next-template

Production-ready Next.js starter with TypeScript, Tailwind, and i18n support. PWA-enabled for modern web development.

πŸš€ Explore Demo πŸ› Report Bug ✨ Request Feature

Table of Contents
  1. About The Project
  2. Installation
  3. Usage
  4. Structure
  5. Tasks
  6. Contributing
  7. License
  8. Contact
  9. Acknowledgments

About The Project

A modern, feature-rich Next.js template that provides everything you need to build production-ready web applications. Built with TypeScript and React, this template includes:

  • 🌍 Internationalization - Built-in support for multiple languages using next-localization
  • 🎨 Theme System - Dark/light mode with customizable color schemes using Tailwind CSS
  • πŸ“± PWA Ready - Progressive Web App support for offline functionality and mobile installation
  • ⚑ Performance Focused - Server-side rendering and static site generation capabilities
  • πŸ§ͺ Testing Suite - Comprehensive testing setup with Jest and React Testing Library
  • πŸ” Code Quality - ESLint, Prettier, and CommitLint for consistent code style
  • 🐢 Git Hooks - Husky for pre-commit formatting and pre-push testing
  • πŸ“¦ Component Library - Reusable React components with TypeScript types
  • πŸ›‘οΈ Type Safety - Full TypeScript support throughout the project
  • πŸ“„ Documentation - Extensive documentation and examples

This template serves as a foundation for building modern web applications, incorporating best practices and popular tools from the React/Next.js ecosystem. It's designed to be both developer-friendly and production-ready, with careful attention to performance, accessibility, and user experience.

Built With

Next.js React TypeScript TailwindCSS Jest ESLint CommitLint Prettier PWA Husky i18n HTML5 Markdown

(back to top)

Installation

Prerequisites

  • Node.js 18.17 or later
  • npm or yarn package manager

Setup

# Clone the repository
git clone https://github.com/montymi/next-template

# Navigate to project directory
cd next-template

# Install dependencies
npm install

# Install Husky git hooks
npm run prepare

# Generate locale mappings
npm run prebuild

Usage

The project includes several npm scripts for development, testing, and code quality:

Development

# Start development server at http://localhost:3000
npm run dev

# Start production server
npm run start

Testing

# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Generate test coverage report
npm run test:coverage

Code Quality

# Run ESLint
npm run lint

# Format code with Prettier
npm run format

Build Process

# Full production build
npm run build

(back to top)

Structure

next-template/
β”œβ”€β”€ __tests__/             # Test files
β”‚   β”œβ”€β”€ components/        # Component tests
β”‚   β”œβ”€β”€ hooks/             # Hook tests
β”‚   └── pages/             # Page tests
β”œβ”€β”€ public/                # Static files
β”‚   β”œβ”€β”€ images/            # Image assets
β”‚   β”œβ”€β”€ locales/           # Translation files
β”‚   └── manifest.json      # PWA manifest
β”œβ”€β”€ scripts/               # Build Scripts
β”‚   └── generate-locale-map.js
β”œβ”€β”€ src/                   # Source code
β”‚   β”œβ”€β”€ components/        # React components
β”‚   β”‚   β”œβ”€β”€ title.tsx
β”‚   β”‚   β”œβ”€β”€ Header.tsx
β”‚   β”‚   └── Footer.tsx
β”‚   β”œβ”€β”€ hooks/             # Custom React hooks
β”‚   β”‚   └── useNamespace.tsx
β”‚   β”œβ”€β”€ pages/             # Next.js pages
β”‚   β”‚   β”œβ”€β”€ _app.tsx       # App wrapper
β”‚   β”‚   β”œβ”€β”€ _document.tsx  # Document wrapper
β”‚   β”‚   β”œβ”€β”€ index.tsx      # Home page
β”‚   β”‚   β”œβ”€β”€ 404.tsx        # Error page
β”‚   β”‚   β”œβ”€β”€ 500.tsx        # Server error page
β”‚   β”‚   β”œβ”€β”€ about.tsx      # About page
β”‚   β”‚   β”œβ”€β”€ dashboard.tsx  # Dashboard page
β”‚   β”‚   β”œβ”€β”€ profile.tsx    # Profile page
β”‚   β”‚   └── services.tsx   # Services page
β”‚   └── styles/            # Stylesheets
β”‚       β”œβ”€β”€ mappings.ts    # Locale Mapping
β”‚       └── globals.css    # Global styles
β”œβ”€β”€ commitlint.config.js   # ESLint configuration
β”œβ”€β”€ eslint.config.mjs      # ESLint configuration
β”œβ”€β”€ .prettierrc            # Prettier configuration
β”œβ”€β”€ jest.config.ts         # Jest configuration
β”œβ”€β”€ next.config.ts         # Next.js configuration
β”œβ”€β”€ tailwind.config.ts     # Tailwind configuration
β”œβ”€β”€ tsconfig.json          # TypeScript configuration
└── package.json           # Dependencies and scripts

(back to top)

Tasks

  • Testing

    • Add unit tests for all components
    • Add integration tests for pages
    • Add end-to-end tests using Cypress or Playwright
    • Setup test coverage reporting
  • Internationalization

    • Add more language support
    • Implement RTL support for Arabic/Hebrew
    • Add language detection
    • Create translation contribution guide
  • Documentation

    • Add JSDoc comments to all components
    • Create Storybook documentation
    • Add API documentation
    • Create contributing guidelines
  • Performance

    • Implement image optimization
    • Add lazy loading for components
    • Optimize bundle size
    • Add performance monitoring
  • Accessibility

    • Add ARIA labels
    • Implement keyboard navigation
    • Add screen reader support
    • Create accessibility guide
  • Security

    • Add security headers
    • Implement CSP
    • Add rate limiting
    • Setup security scanning

See the open issues for a full list of issues and proposed features.

(back to top)

Contributing

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature) using the following naming convention
  3. Commit your Changes (git commit -m 'feat: Add some AmazingFeature') while adhering to the specifications of conventional commits
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.


Contact

Michael Montanaro


Acknowledgments

(back to top)