This repository is a template for creating Turborepo project that can be deployed to Vercel using the Vercel CLI and GitHub Actions. This template provides a basic structure and configuration for managing dependencies, running scripts, and deploying each application to different Vercel projects. The template also includes GitHub workflows that automates the deployment process whenever a push or pull request is made to the specific branch based on the branch or the tag. By using this template, you can easily set up a Turborepo project that leverages the benefits of Vercel's serverless platform, Turbo and GitHub's collaboration features.
docs: a Next.js appweb: another Next.js appui: a stub React component library shared by bothwebanddocsapplicationseslint-config-custom:eslintconfigurations (includeseslint-config-nextandeslint-config-prettier)tsconfig:tsconfig.jsons used throughout the monorepo
This Turborepo has some additional tools already setup for you:
- TypeScript for static type checking
- ESLint for code linting
- Prettier for code formatting
To build all apps and packages, run the following command:
cd my-turborepo
yarn buildTo develop all apps and packages, run the following command:
cd my-turborepo
yarn dev-
Get vercel project id, vercel team, and vercel organization id.
-
Set up Vercel Access Token to use in CI/CD
-
Set up Build Command at the root of project.
Ex:
turbo run build --filter=docs --remote-only -
Output directory for each project
Ex:
apps/docs/.next
- For each vercel project application will has a specific id and set them to Github Secret, they will be used in environment variable is
VERCEL_PROJECT_IDfor getting the remote env and deploy to Vercel Ex:VERCEL_WEB_PROJECT_IDfor web application,VERCEL_DOCS_PROJECT_IDfor docs application ... - Add
VERCEL_ORG_ID,VERCEL_ACCESS_TOKENto Github secrets. - If use the remote cache add:
TURBO_TOKENto secrets andTURBO_TEAMto variables.
- In release.yml, update the branch deployment to specific suffix tags matching with
beta,alphafor the purpose of releasing.
Default: beta is staging and alpha is testing branch, and leave empty is the main branch
For more detailed information on how to deploy with Vercel CLI, please refer to this article: Deploy with Vercel CLI.