Welcome to the OxyTrack Turbo project! This monorepo is built with Turbo Repo, utilizing a robust stack that includes Prisma, Postgres, Express, Node.js, React, and TypeScript across both the frontend and backend, ensuring a strongly typed development environment.
- Monorepo Structure: Organized into
apps/
for frontend/backend applications andpackages/
for shared logic or components. - OpenAPI Specification: Utilizes OpenAPI spec as the source of truth for API design, with auto-generated TypeScript clients using
openapi-typescript
andopenapi-typescript-axios
. - Strong Typing: Both frontend and backend are fully typed, enhancing development experience and code quality.
- Database Flexibility: Supports local Postgres setups as well as Docker-based environments for ease of development.
- Development Workflow: Integrates tools like Prettier, ESLint, Husky, and lint-staged for code formatting and linting, ensuring code consistency and quality.
- Node.js (v18 or higher)
- pnpm (v8.9.0)
- Docker (for running Postgres in a container)
-
Clone the Repository
Start by cloning this repository to your local machine.
-
Environment Setup
Rename
.example.env
to.env
in bothapps/backend
andpackages/database
. This is crucial for configuring your environment variables correctly. -
Database Configuration
Ensure you have a running Postgres database. You can use Docker as mentioned in the scripts section or set up a local instance.
-
Install Dependencies
Run
pnpm install
to install all required dependencies across the monorepo. -
Start Development Server
To start the development server, run
turbo run dev
.
Defined within the turbo.json
pipeline, these commands are key to the project's development and deployment processes:
-
Prisma Commands:
turbo run db:generate
: Generates Prisma client artifacts, essential for interacting with your database in a type-safe manner.turbo run db:push
: Updates the database schema during development without applying migrations, useful for quick iterations.turbo run db:migrate
: Applies database migrations, ensuring your database schema matches your Prisma schema.
-
API Contract and Client Generation:
turbo run build-api-contract
: Bundles the OpenAPI spec and generates TypeScript Axios clients, ensuring frontend and backend communicate over a strongly typed API.
-
Turbo Commands:
turbo run build
: Compiles the project for production, ensuring all dependencies like Prisma client and API contracts are generated and up-to-date.turbo run dev
: Starts the development server, watching for changes in your source code and automatically recompiling.
apps/*
: Contains the frontend and backend applications.packages/*
: Includes shared libraries, configurations, and utility functions.
- Turbo Repo Documentation
- Prisma Documentation
- OpenAPI Specification
- TypeScript
- Postgres Docker Setup
Contributions are welcome! Please follow the established coding conventions and pull request process.
Thank you for choosing OxyTrack Turbo Repo for your development needs. Happy coding!