This turborepo includes the following packages/apps:
.
├── apps
│ ├── backend # NestJS app (https://nestjs.com)
│ └── web # Vite app (https://vite.dev)
└── packages
├── @repo/common # Shared monorepo resources
├── @repo/eslint-config # `eslint` configurations (includes `prettier`)
├── @repo/jest-config # `jest` configurations
└── @repo/typescript-config # `tsconfig.json`s used throughout the monorepo
Each package/app is 100% TypeScript.
This turborepo has some additional tools already setup for you:
- TypeScript for static type checking
- ESLint for code linting
- Prettier for code formatting
- Prisma for database ORM
- Jest for testing
- Docker Compose for local database
This Turborepo
already configured useful commands for all your apps and packages.
# Will build all the app & packages with the supported `build` script.
pnpm run build
# ℹ️ If you plan to only build apps individually,
# Please make sure you've built the packages first.
# Will run the development server for all the app & packages with the supported `dev` script.
pnpm run dev
# Will launch a test suites for all the app & packages with the supported `test` script.
pnpm run test
# See `@repo/jest-config` to customize the behavior.
# Will lint all the app & packages with the supported `lint` script.
# See `@repo/eslint-config` to customize the behavior.
pnpm run lint
# Will format all the supported `.ts,.js,json,.tsx,.jsx` files.
# See `@repo/eslint-config/prettier-base.js` to customize the behavior.
pnpm format
We use Prisma to manage & access our database. As such you will need a database for this project, either locally or hosted in the cloud.
To make this process easier, we offer a docker-compose.yml
file to deploy a PostgreSQL server locally with a new database named turborepo
:
docker-compose up -d
Once deployed you will need to create .env
file in apps/backend
in order for Prisma to have a DATABASE_URL
environment variable to access.
touch apps/backend/.env
If you added a custom database name, or use a cloud based database, you will need to update the DATABASE_URL
in your .env
accordingly.
Once deployed & up & running, you will need to create & deploy migrations to your database to add the necessary tables. This can be done using Prisma Migrate:
npx prisma migrate dev
If you need to push any existing migrations to the database, you can use either the Prisma db push or the Prisma migrate deploy command(s):
pnpm run prisma:push
# OR
pnpm run prisma:migrate:deploy
There is slight difference between the two commands & Prisma offers a breakdown on which command is best to use.
Learn more about the power of Turborepo: