This mono repository uses Turporepo and includes applications (NextJS frontend and NestJS backend). It's recommended to use PNPM for workspaces management, but will work seamlessly with other package managers (additional setup required).
Use proper Node.js version:
nvm useInstall pnpm globally with npm install -g pnpm run the development server:
pnpm install
pnpm devapps/server: NestJS server using Apollo GraphQL.apps/webapp: NextJS frontend applications.packages: base configurations.
Copy .env.example for root and each of the packages located in apps/ folder:
cp .env.example .env
cp apps/server/.env.example .env
cp apps/webapp/.env.example .envBy default cache only works locally, it lives inside .turbo/cache, and that means that we can't share the cache between development and virtual machines. Turborepo uses Vercel Remote Caching, it's free but require each developer to have an access to specified team (paid feature).
turbo login
turbo linkAlternatively, you can use custom remote cache server, for example deployed on Railway. In this case you need to login using custom URL for the remote cache server.
To keep your remote cache server credentials secure locally it's better to add .turbo/config.json file (which is excluded by .gitignore). Values should be set to the same environment variables:
{
"apiurl": "TURBO_API",
"teamslug": "TURBO_TEAM",
"token": "TURBO_TOKEN"
}Or do same configuration using Turbo CLI:
turbo login --manualAfter it you'll be prompted to enter API URL, team slug and token value, which are the same values described in "Turborepo remote cache" section of the root .env.local file. THis action will add "remoteCache" section in turbo.json (which is not very secure).
To have full advantage of automatic Turborepo configuration, you can additionally run:
turbo scanAnother way to pass environment variables to the runtime is to use dotenv-cli package installed as root project dependency:
pnpm install dotenv-cli -w --save-devAnd then use it as part of your scripts in package.json like so:
{
"scripts": {
"build": "dotenv -- turbo run build"
}
}To learn more about Next.js, take a look at the following resources:
- NextJS Documentation - learn about Next.js features and API.
- Learn NextJS - an interactive Next.js tutorial.
GitHub Actions used for CI (Continues Integration) pipeline and custom deployment to Vercel. Deperend on the infrostructure provider it could be changed to any other, like AWS or CloudFlare. See full documentation on CI pipeline setup in RELEASE.md