Giter VIP home page Giter VIP logo

nextjs-boilerplate's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.