czq297297 / nextjs-template

Next.js (TS) x Tailwind CSS x Turbo (pnpm) x Firebase x NextAuth x Hasura

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Next.js Template

Monorepo template for creating a web service with Next.js.

Uses

Apps and Packages

VS Code Extensions (Recommend)

Commands

pnpm i  # Resolve dependency packages and prepare .env files
# Then set up /.env

pnpm build   # Build all apps and packages
pnpm dev     # Set up file monitoring builds and local servers for development
pnpm lint    # eslint + prettier --check
pnpm format  # eslint --fix + prettier --write
pnpm clean   # rm .turbo, node_module and generated files

Registering environment variables for GitHub / Vercel

If you need to prepare the GitHub / Vercel environment, you will need to set the environment variables (the contents of .env) at build time.

Deploy to Vercel

ref: https://vercel.com/docs/concepts/git/monorepos#setup-turborepo

Make the following settings in Vercel's Project Settings. ※Change the <mockup/storybook/web> parts below

  • General > Build & Development Settings
    • BUILD COMMAND: cd ../.. && pnpm exec turbo run build --scope=<mockup/storybook/web> --include-dependencies --no-deps
    • OUTPUT DIRECTORY:
      • for mockup: public
      • for storybook: storybook-static
  • General > Root Directory: apps/<mockup/storybook/web>
    • Include source files outside of the Root Directory in the Build Step.

How to check for dependent packages

# If graphviz is not installed
# ref: https://graphviz.org/download/
brew install graphviz

# Output a graph to check dependencies
pnpm build -- --graph

Use renovate on GitHub

Give Renovate and renovate-approve permission to operate the repository.

Then change your GitHub settings as follows.

Settings > Branches > Branch protection rule

  • Branch name pattern: main
  • Protect matching branches:
    • Require a pull request before merging
      • Require approvals: [1]
    • Require status checks to pass before merging
      • Status checks that are required:
        • Build (Node 16 on ubuntu-latest)
        • Vercel – <project-name-on-vercel>
        • ...

About

Next.js (TS) x Tailwind CSS x Turbo (pnpm) x Firebase x NextAuth x Hasura

License:MIT License


Languages

Language:TypeScript 58.0%Language:JavaScript 24.1%Language:HTML 12.8%Language:Shell 1.9%Language:PLpgSQL 1.9%Language:CSS 1.3%