Boilerplate and Starter for Next.js with App Router support, Tailwind CSS, and TypeScript β‘οΈ Prioritizing developer experience first: Next.js, TypeScript, ESLint, Prettier, Husky,VSCode, PostCSS, Tailwind CSS,Authentication, Database
Clone this project and use it to create your own Next.js project..
Node.js 20+ and npm
Run the following command on your local environment:
git clone https://github.com/maher-naija-pro/Best-Next-js-Boilerplate.git
cd Best-Next-js-Boilerplate
npm install
To generate an auth secret, run the following command:
npx auth secret
To configure the application, Rename .env_example file to .env ,you need to add this generate secret to your .env file as AUTH_SECRET="your-auth-secret".
Build your application by running :
npm run build
Then, you can run the project locally in development mode with live reload by executing:
npm run dev
Open http://localhost:3000 with your browser to see the result.
To set up a remote PostgreSQL database, follow these steps:
-
Create a PostgreSQL database:
- If you don't have a PostgreSQL database, you can create one on a cloud provider like Heroku, AWS, or DigitalOcean.
- Alternatively, you can install PostgreSQL locally using https://www.postgresql.org/download/.
-
Configure your Prisma environment variables:
-
Create a
.env
file in the root of your project and add the following environment variables:DATABASE_URL=postgresql://<your_db_user>:<your_db_password>@<your_db_host>:<your_db_port>/<your_db_name>
- Replace
<your_db_user>
,<your_db_password>
,<your_db_host>
,<your_db_port>
, and<your_db_name>
with your actual database credentials.
- Replace
-
-
Initialize Prisma:
-
Run the following command to initialize Prisma:
npx prisma init
-
-
Generate Prisma client:
-
Run the following command to generate the Prisma client:
npx prisma generate
-
-
Apply database migrations:
-
Run the following command to apply database migrations:
npx prisma db push
-
Now you have a remote PostgreSQL database set up and ready to use with your Next.js application.
This template is highly customizable. You can easily modify the code to fit your specific needs. Here are some examples:
- Add new features: You can add new features to the application by creating new components, pages, and routes.
- Change the design: You can change the design of the application by modifying the CSS files or using a different UI library.
- Integrate with other services: You can integrate the application with other services, such as a payment gateway or a social media platform.
For more detailed information on how to customize the application, please refer to the documentation.
If you're interested in sponsoring this project, please contact us at [email protected]
Developer experience first, extremely flexible code structure and only keep what you need: Nothing is hidden from you, so you have the freedom to make the necessary adjustments to fit your needs and preferences.
- π οΈ Easy to customize
- π¦ Minimal code
- π SEO-friendly
- π Production-ready
- β‘ Next.js with App Router support
- π― Maximize lighthouse score
- π₯οΈ shadcn/ui components
- π Data Fetching, Caching and Mutation with TanStack Query
- π₯ Type checking TypeScript
- β¨ Beautiful and consistent icons from Lucide
- β³ Loading UI using Skeleton Components
- π Integrate with Tailwind CSS
- π Multi-language (i18n) with next-intl
- β Strict Mode for TypeScript and React 18
- π Authentication with Authjs : Sign up, Sign in, Sign out, Forgot password, Reset password, and more.
- π₯ Social Auth (Google, GitHub, and more),Users Roles
- β¨οΈ Form handling with React Hook Form
- π΄ Validation library with Zod
- π¦ Husky for Git Hooks
- π Linter with ESLint (default Next.js, Next.js Core Web Vitals, Tailwind CSS and Airbnb configuration)
- π Code Formatter with Prettier
- π Logging with Pino.js and Log Management with Better Stack
- π¦ Type-safe ORM with Prisma, compatible with PostgreSQL, SQLite, and MySQL
- π Ready for Next.js 15.
- π§ͺ Integration and E2E Testing with Playwright
- π Storybook for UI development
- π€ SEO metadata, Open Graph tags,JSON-LD tags
- πΊοΈ Sitemap.xml and robots.txt
- β Database exploration with PRisma Studio and CLI migration tool
- βοΈ Bundler Analyzer
- π newsletter,contact forms
- π‘ Absolute Imports using @ prefix
- π VSCode configuration
- π Lint git commit with Commitlint
- π¦Ί Unit Testing with Vitest and React Testing Library
- π« Lint-staged for running linters on Git staged files
- π¦Ί Unit Testing with Vitest
- βοΈ Code coverage with Vitest istanbul/v8
- π Visual testing with Percy
- π· Run tests on pull request with GitHub Actions
- π₯οΈ Monitoring as Code with Checkly
- π Automatic changelog generation with Semantic Release
- π Observability - Open Telemetry integration for seamless monitoring
- π² Pricing table
- β¨ Features table
- π Marketing land page with sections: hero, stats, customers,
- π Documentation template,content with markdown,
- π Platform template,
- π± Mobile side bars,
- π» Full responsive,
- π±οΈ Interactive component on hover
- π Centralized variables and content
- π Full crud table with react table
- π³ Stripe payment integration
- π€ User dashboard example
- π€ Admin dashboard
- π Darklight mode
- π§ Email send integration
- β¨ css Animation
- π€ Automated google Gemini Code Reviews - Stay on the cutting edge with AI-powered code reviews!
β Minify HTML & CSS π¨ Live reload β Cache busting
Next.js Boilerplate comes with a built-in bundle analyzer. It can be used to analyze the size of your JavaScript bundles. To begin, run the following command:
npm run build-stats
#By running the command, it'll automatically open a new browser window with the results.
To explore the database, run the following command to open the database studio:
npx prisma studio
The project is already configured with prisma Studio to explore the database. You can run the following command to open the database studio:
Licensed under the MIT License, Copyright Β© 2024
See LICENSE for more information.
Everyone is welcome to contribute to this project. Feel free to open an issue if you have question or found a bug. Totally open to any suggestions and improvements.
Inside that directory, you can run several commands:
Run end-to-end tests:
npx playwright test
**Start interactive UI mode:**
```bash
npx playwright test --ui
Run tests in a specific file:
npx playwright test example
Run tests in debug mode:
npx playwright test --debug
npx percy exec -- npx playwright test
npx vite preview --outDir .\coverage\ # Build the project for production and output to the coverage directory
npx vitest --ui --api 3000 # Run unit tests with the UI and API server on port 3000
npx checkly login # Login to Checkly
npx checkly deploy # Deploy your Checkly tests
npx checkly test # Run your Checkly tests
npx semantic-release # Automatically determine the next version number, generate a changelog, and publish a new release to npm
βββ src
β βββ app
β β βββ api
β β β βββ stripe
β β β β βββ subscription
β β β β β βββ route.ts
β β β βββ auth
β β β β βββ route.ts
β β β βββ profile
β β β β βββ route.ts
β β β βββ logout
β β β β βββ route.ts
β β β βββ session
β β β β βββ route.ts
β β β βββ [locale]
β β β β βββ (stripe)
β β β β β βββ componant_stripe
β β β β β β βββ PaymentForm.tsx
β β β β βββ page.tsx
β β β β βββ layout.tsx
β β βββ components
β β β βββ ui
β β β β βββ button.tsx
β β β β βββ input.tsx
β β β β βββ label.tsx
β β β β βββ text.tsx
β β β β βββ container.tsx
β β βββ lib
β β β βββ auth
β β β β βββ session_user.ts
β β β β βββ get_session.ts
β β β βββ stripe.ts
β β βββ layouts
β β β βββ root.tsx
β β βββ pages
β β β βββ _app.tsx
β β β βββ [locale]
β β β β βββ page.tsx
β β β β βββ layout.tsx
β β βββ hooks
β β β βββ use-session.ts
β β βββ types
β β β βββ session.ts
β β βββ constants
β β β βββ locales.ts
β β βββ tailwind.config.js
β β βββ prisma
β β βββ schema.prisma
β βββ vite.config.ts
β βββ tsconfig.json
β βββ next.config.js
β βββ postcss.config.js
β βββ tailwind.config.js
β βββ prisma
β βββ schema.prisma
βββ public
β βββ favicon.ico
β βββ vercel.svg
β βββ robots.txt
βββ .eslintrc.cjs
βββ .prettierrc.js
βββ .vscode
β βββ settings.json
βββ .github
β βββ workflows
β βββ ci.yml
βββ .env.local
βββ .env
βββ .next
β βββ static
β βββ chunks
β βββ pages
β βββ _app-page.js
βββ .vercel
β βββ output
β βββ functions
β βββ api
β βββ stripe
β βββ subscription
β βββ route.js
βββ .git
β βββ HEAD
βββ .gitignore
βββ package.json
βββ README.md
βββ tsconfig.app.json