olcaneristi / nextjs-boilerplate

Boilerplate and Starter for Next JS 12+, Prisma ORM, Next-Auth and TypeScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Boilerplate and Starter for Next JS 12+, Prisma ORM, Next-Auth and TypeScript.

Fullstack project structure

πŸš€ Boilerplate and Starter for Next.js, SASS, Prisma ORM, Next-Auth and TypeScript ⚑️ Made with developer experience first: Next.js, TypeScript, ESLint, Prettier, Husky, Lint-Staged.

Features

Developer experience first:

  • πŸ”₯ Next.js 12
  • πŸ¦„ Integrate with next-auth
  • πŸ¦„ Integrate with prisma
  • 🎨 Integrate with sass
  • πŸŽ‰ Type checking TypeScript
  • πŸ¦„ Strict Mode for TypeScript and React 17
  • ✏️ Linter with ESLint (default NextJS, NextJS Core Web Vitals and Airbnb configuration)
  • πŸ›  Code Formatter with Prettier
  • 🦊 Husky for Git Hooks
  • 🚫 Lint-staged for running linters on Git staged files
  • πŸ€– SEO metadata, JSON-LD and Open Graph tags with Next SEO
  • βš™οΈ Bundler Analyzer
  • πŸ–±οΈ One click deployment with Vercel or Netlify (or manual deployment to any hosting services)
  • πŸ’― Maximize lighthouse score
  • πŸ€– i18n Locatization next-translate
  • πŸ¦„ Integrate with cypress

Built-in feature from Next.js:

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

Philosophy

  • Minimal code
  • SEO-friendly
  • πŸš€ Production-ready
  • πŸš€ Serverless-ready

Requirements

  • Node.js, yarn and npm

Getting started

Run the following command on your local environment:

git clone --depth=1 https://github.com/bbg/nextjs-boilerplate.git my-project-name
cd my-project-name
yarn install

Then, you can run locally in development mode with live reload:

yarn run dev

Open http://localhost:3000 with your favorite browser to see your project.

β”œβ”€β”€ README.md                # README file
β”œβ”€β”€ cypress                  # Cypress root folder
β”œβ”€β”€ docs                     # Project document folder
β”œβ”€β”€ public                   # Public folder
β”œβ”€β”€ locales                  # Localization Json files are kept in this folder
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ components           # All Components
β”‚   β”œβ”€β”€ hooks                # React hooks
β”‚   β”œβ”€β”€ pages                # Next JS pages
β”‚   β”œβ”€β”€ scss                 # SCSS styles folder
β”‚   └── functions            # All functions are collected here.
|   └── types                # Global types folder.
β”œβ”€β”€ db.prisma                # Prisma database schema
β”œβ”€β”€ tsconfig.json            # TypeScript configuration
β”œβ”€β”€ i18n.json                # Next-Translation configuration
β”œβ”€β”€ cypress.json             # Cypress configuration
β”œβ”€β”€ next.config.js           # Next JS configuration
β”œβ”€β”€ netlify.toml             # Netlify publish configuration

Deploy to production

You can see the results locally in production mode with:

$ yarn run build
$ yarn run start

The generated HTML and CSS files are minified (built-in feature from Next js).

You can create an optimized production build with:

yarn run build:prod

Now, your blog is ready to be deployed. All generated files are located at out folder, which you can deploy with any hosting service.

Commands Scripts

β”œβ”€β”€ dev                # NextJS Development Run
β”œβ”€β”€ build              # NextJS Build
β”œβ”€β”€ build:stats        # NextJS Bundle Analyze
β”œβ”€β”€ build:types        # Types check and build
β”œβ”€β”€ start              # NextJS Production Start
β”œβ”€β”€ export             # NextJS Static Export
β”œβ”€β”€ clean              # .next and out file cleaner
β”œβ”€β”€ lint               # Eslint Check
β”œβ”€β”€ lint:fix           # Eslint Check and Fix
β”œβ”€β”€ forrmat            # Prettier Run
β”œβ”€β”€ prepare            # Huksy Install
β”œβ”€β”€ cy:open            # Cypress Browser E2E Testing Run
β”œβ”€β”€ cy:run             # Cypress Headlesss E2E Testing Run
β”œβ”€β”€ prisma:gen         # Prisma Generator
β”œβ”€β”€ prisma:push        # Prisma DB Schema Push
β”œβ”€β”€ prisma:studio      # Prisma Studio DB Client Open

Deploy to Netlify

Clone this repository on own GitHub account and deploy to Netlify:

Netlify Deploy button

Deploy to Vercel

Deploy this Next JS Boilerplate on Vercel in one click:

Deploy with Vercel

Preview

Preview the example live on StackBlitz:

Open in StackBlitz

Contributions

Everyone is welcome to contribute to this project. Feel free to open an issue if you have question or found a bug.

License

Licensed under the MIT License, Copyright Β© 2020

See LICENSE for more information.

About

Boilerplate and Starter for Next JS 12+, Prisma ORM, Next-Auth and TypeScript.

License:MIT License


Languages

Language:TypeScript 83.1%Language:SCSS 8.1%Language:JavaScript 5.5%Language:Shell 3.2%