This repository contains a template for creating a turborepo using Next.js and Django. A turborepo is a monorepo that uses workspaces to manage multiple projects in a single repository. This makes it easier to share code and dependencies between projects, and it also makes it easier to manage updates to multiple projects at the same time.
This template includes everything you need to get started with a turborepo, including:
- A Next.js project for the front-end
- A Django project for the back-end
- A turborepo configuration file
- A README file with instructions on how to get started
This Turborepo template uses yarn as a packages manager. It includes the following packages/apps:
docs
: a Next.js appweb
: another Next.js appshared
: a stub React component library which can be shared by all applicationsui
: a stub React component library shared by bothweb
anddocs
applicationseslint-config-custom
:eslint
configurations (includeseslint-config-next
andeslint-config-prettier
)tsconfig
:tsconfig.json
s used throughout the monorepobackend
: a Django app
To install packages of every workspace
yarn install
This Turborepo has some additional tools already setup for you:
- TypeScript for static type checking
- ESLint for code linting
- Prettier for code formatting
- Django for django
To build all apps and packages, run the following command:
yarn build
To develop all typescript apps and packages, run the following command:
yarn dev
To add packages:
yarn <workspace> add <package-name>
To remove packages:
yarn <workspace> remove <package-name>
To develop django app, run the following:
yarn server
To make migrations:
yarn migrate:make
To show migrations:
yarn migrate:show
To apply migrations:
yarn migrate
To flush database:
yarn db:flush
Turborepo can use a technique known as Remote Caching to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can create one, then enter the following commands:
cd my-turborepo
npx turbo login
This will authenticate the Turborepo CLI with your Vercel account.
Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your turborepo:
npx turbo link
Learn more about the power of Turborepo: