Monorepo template for creating a web service with Next.js.
- Turborepo x pnpm
- Prettier / ESLint (w/ eslint-plugin-import)
- lint-staged / husky
- Renovate (w/ renovate-approve)
- GitHub Actions (Linting + Formatting)
- Execute
eslint --fix
andprettier
when saving with VS Code
-
Apps
nhost
:
Nhost dev server for prod/test server migrationmockup
: [Demo]
A starting point for building a static site.storybook
: [Demo]
Storybook forapps/web
.web
: [Demo]
A starting point for building a Next.js application.
Next.js x Tailwind CSS (w/ TypeScript)
Page Transition (react-transition-group x GSAP)
pathpida / Jotai
Nhost (w/ Apollo Client x GraphQL Code Generator)
-
Packages
constatns
: As the name implieseslint-preset
: The base preset for ESLint
inc.eslint-config-next
/eslint-config-prettier
/eslint-plugin-import
generated
: The files output from graphql-codegenlintstagedrc
: The settings for applying husky x lint-staged in each JS/TS filepathtest-utils
: The utilities used inapps/mockup
for URL checkingscript-modules
: static site script used inapps/mockup
tailwind-preset
: The base preset for Tailwind CSS
inc.postcss.config.cjs
/@tailwindcss/typography
tsconfig
: The basetsconfig.json
types
: Various typesutils
: Simple utilities
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
1337
:apps/nhost/
- Hasura* (auto)
: GraphQL Endpoint* (auto)
: MailHog
3000
:apps/web/
- Next.js application6006
:apps/storybook/
- Storybook8000
:apps/mockup/
- Static site49160
:apps/mockup/
- Express server
If you need to prepare GitHub / Vercel environment, you need to set environment variables (.env
items) in each service.
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
- for
General
>Root Directory
:apps/<mockup/storybook/web>
- Include source files outside of the Root Directory in the Build Step.
# If graphviz is not installed
# ref: https://graphviz.org/download/
brew install graphviz
# Output a graph to check dependencies
pnpm build -- --graph
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 approvals:
- Require status checks to pass before merging
- Status checks that are required:
Build (Node 16 on ubuntu-latest)
Vercel – <project-name-on-vercel>
- ...
- Status checks that are required:
- Require a pull request before merging