Skip to content

omergulcicek/nextjs-boilerplate

Repository files navigation

Next.js Boilerplate

An open source boilerplate built using Next.js 15.3, TypeScript, and Tailwind CSS

Features

With this template, you get all the awesomeness you need:

Project structure

β”‚
β”œβ”€β”€ messages                        # i18n messages
β”œβ”€β”€ public                          # Public assets folder
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ app                         # Next JS App (App Router)
β”‚   β”œβ”€β”€ assets                      # Static assets (images, fonts, etc.)
β”‚   β”œβ”€β”€ components                  # React components
β”‚   β”‚   β”œβ”€β”€ forms                   # Form components
β”‚   β”‚   β”œβ”€β”€ icons                   # svg icons
β”‚   β”‚   β”œβ”€β”€ shared                  # Header, footer, aside components
β”‚   β”‚   β”œβ”€β”€ skeletons               # Loading components
β”‚   β”‚   β”œβ”€β”€ ui                      # Atomic components
β”‚   β”‚   └── widgets                 # Advanced components
β”‚   β”œβ”€β”€ constants                   # Project-wide constants
β”‚   β”œβ”€β”€ data                        # Static or mock data
β”‚   β”œβ”€β”€ helpers                     # Reusable utility functions (e.g., API, formatting, storage)
β”‚   β”œβ”€β”€ hooks                       # Reusable custom React hooks
β”‚   β”œβ”€β”€ i18n                        # Internationalization setup
β”‚   β”œβ”€β”€ lib                         # Common utility functions
β”‚   β”œβ”€β”€ providers                   # Global context providers (theme, data fetching, notifications, i18n)
β”‚   β”œβ”€β”€ schemas                     # Validation schemas
β”‚   β”œβ”€β”€ services                    # API request functions
β”‚   β”œβ”€β”€ stores                      # Global state
β”‚   β”œβ”€β”€ types                       # TypeScript type definitions
β”‚   └── .middleware                 # Middleware for Next.js
β”œβ”€β”€ .env                            # Environment variables
β”œβ”€β”€ .gitignore                      # Git ignore rules
β”œβ”€β”€ .prettierrc                     # Prettier config
β”œβ”€β”€ components.json                 # shadcn/ui config
β”œβ”€β”€ eslint.config.mjs               # ESLint config
β”œβ”€β”€ next.config.mjs                 # Next.js config
β”œβ”€β”€ package.json                    # Project dependencies and scripts
β”œβ”€β”€ postcss.config.js               # PostCSS config
β”œβ”€β”€ README.md                       # README file
β”œβ”€β”€ tailwind.config.js              # Tailwind CSS config
└── tsconfig.json                   # TypeScript config

File Naming Conventions

The project follows consistent file naming conventions:

File Type Example Style
Component LoginForm.tsx PascalCase
Hook useLogin.ts camelCase
Helper, Schema form-schema.ts kebab-case
Folder login-form/ kebab-case
Constants ALPHA_REGEX SNAKE_CASE

Monitoring & Analytics

Error Tracking

We use Sentry for error tracking and performance monitoring. To set up:

  1. Create a Sentry account
  2. Add your DSN to .env:
NEXT_PUBLIC_SENTRY_DSN=your-sentry-dsn

Analytics

We use Google Analytics for tracking user behavior. To set up:

  1. Create a Google Analytics account
  2. Add your Measurement ID to .env:
NEXT_PUBLIC_GA_MEASUREMENT_ID=G-XXXXXXXXXX

Contributors