Skip to content

maher-naija-pro/Best-Next-js-Boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Best Nextjs tailwindCSS boilerplate on github

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..

image

Table of Contents

Requirements

Node.js 20+ and npm

Getting Started

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

Set up authentication

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.

Set up remote database

To set up a remote PostgreSQL database, follow these steps:

  1. 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/.
  2. 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.
  3. Initialize Prisma:

    • Run the following command to initialize Prisma:

      npx prisma init
  4. Generate Prisma client:

    • Run the following command to generate the Prisma client:

      npx prisma generate
  5. 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.

Project structure

Customization

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.

Sponsors

If you're interested in sponsoring this project, please contact us at [email protected]

Philosophy

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

Features

  • ⚑ 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!

Built-in feature from Next.js:

β˜• Minify HTML & CSS πŸ’¨ Live reload βœ… Cache busting

Useful commands

Bundle Analyzer

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.

Database Studio

To explore the database, run the following command to open the database studio:

npx prisma studio

http://localhost:5555/

The project is already configured with prisma Studio to explore the database. You can run the following command to open the database studio:

License

Licensed under the MIT License, Copyright Β© 2024

See LICENSE for more information.

Contributions

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:

Testing

Playwright

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

Visual Testing

npx percy exec -- npx playwright test

Unit Testing

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

Monitoring

npx checkly login  # Login to Checkly
npx checkly deploy # Deploy your Checkly tests
npx checkly test  # Run your Checkly tests

semantic-release

npx semantic-release  # Automatically determine the next version number, generate a changelog, and publish a new release to npm

Project Structure

β”œβ”€β”€ 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




About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages