Skip to content

ivanms1/next-js-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

419 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Next.js Template

A modern, production-ready Next.js template with TypeScript, comprehensive tooling, and developer experience optimizations.

✨ Features

  • ⚑ Next.js 15 - Latest version with App Router support
  • πŸ”· TypeScript - Full type safety and IntelliSense
  • 🎨 Sass/SCSS - Advanced styling with CSS Modules support
  • πŸ”§ ESLint - Code linting with Next.js and TypeScript rules
  • πŸ’… Prettier - Code formatting
  • 🎯 Stylelint - CSS/SCSS linting and formatting
  • πŸš€ Plop.js - Component and page generation
  • πŸ”’ Pre-commit hooks - Automated code quality checks
  • πŸ“¦ Dependabot - Automated dependency updates
  • πŸ–ΌοΈ SVG support - Import SVGs as React components
  • πŸ“± Responsive - Mobile-first design approach
  • πŸ› οΈ Path aliases - Clean imports with @/ prefix

πŸš€ Quick Start

Prerequisites

  • Node.js 20.19.0+
  • Yarn (recommended) or npm

Installation

  1. Clone the template

    git clone <your-repo-url>
    cd next-js-template
  2. Install dependencies

    yarn install
    # or
    npm install
  3. Start development server

    yarn dev
    # or
    npm run dev
  4. Open your browser Navigate to http://localhost:3000

πŸ“ Project Structure

next-js-template/
β”œβ”€β”€ pages/                 # Next.js pages (legacy Pages Router)
β”‚   β”œβ”€β”€ _app.tsx          # App wrapper
β”‚   β”œβ”€β”€ index.tsx         # Home page
β”‚   β”œβ”€β”€ globals.scss      # Global styles
β”‚   └── api/              # API routes
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/       # Reusable components
β”‚   β”‚   └── Button/      # Component folder structure
β”‚   └── pages/           # Page components
β”œβ”€β”€ public/              # Static assets
β”œβ”€β”€ templates/           # Plop.js templates
β”œβ”€β”€ plopfile.js         # Component/page generators
└── next.config.js      # Next.js configuration

πŸ› οΈ Development Tools

Code Generation

Generate components and pages quickly with Plop.js:

# Generate a component
yarn plop component

# Generate a page
yarn plop page

Code Quality

The template includes automated code quality checks:

  • ESLint - JavaScript/TypeScript linting
  • Prettier - Code formatting
  • Stylelint - CSS/SCSS linting
  • Husky - Git hooks for pre-commit checks

Available Scripts

# Development
yarn dev          # Start development server
yarn build        # Build for production
yarn start        # Start production server

# Code Quality
yarn lint         # Run ESLint
yarn lint:fix     # Fix ESLint issues
yarn format       # Format code with Prettier
yarn stylelint    # Run Stylelint
yarn stylelint:fix # Fix Stylelint issues

🎨 Styling

CSS Modules with Sass

Components use CSS Modules with Sass for scoped styling:

import styles from "./Button.module.scss";

const Button = () => {
  return <button className={styles.button}>Click me</button>;
};

Global Styles

Global styles are defined in pages/globals.scss and imported in _app.tsx.

SVG Support

Import SVGs as React components:

import Logo from "@/public/logo.svg";

const Header = () => {
  return <Logo className="logo" />;
};

πŸ”§ Configuration

TypeScript

  • Strict mode enabled
  • Path aliases configured (@/components/*, @/pages/*)
  • CSS Modules type support

Next.js

  • SVG support via @svgr/webpack
  • Optimized for performance
  • SEO-friendly

ESLint

  • Next.js recommended rules
  • TypeScript support
  • Prettier integration

Stylelint

  • Standard CSS rules
  • SCSS support
  • Prettier integration
  • Property ordering

πŸ“¦ Dependencies

Core

  • Next.js 15 - React framework
  • React 19 - UI library
  • TypeScript - Type safety

Styling

  • Sass - CSS preprocessor
  • CSS Modules - Scoped styling

Development

  • ESLint - Code linting
  • Prettier - Code formatting
  • Stylelint - CSS linting
  • Plop.js - Code generation
  • Husky - Git hooks
  • lint-staged - Pre-commit checks

πŸš€ Deployment

Vercel (Recommended)

  1. Push your code to GitHub
  2. Connect your repository to Vercel
  3. Deploy automatically

Other Platforms

The template is compatible with any platform that supports Next.js:

  • Netlify
  • AWS Amplify
  • Railway
  • DigitalOcean App Platform

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run quality checks: yarn lint && yarn stylelint
  5. Commit your changes
  6. Push to the branch
  7. Create a Pull Request

πŸ“„ License

This template is open source and available under the MIT License.

πŸ†˜ Support

If you encounter any issues or have questions:

  1. Check the Next.js documentation
  2. Review the TypeScript documentation
  3. Open an issue in this repository

Happy coding! πŸŽ‰

About

Next.js template

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors