Monorepo (pnpm workspace) with a TypeScript + Vite + React frontend and an Express + Prisma backend.
This README explains how to get the project running locally, how to build it, and where to configure environment variables.
- Node.js (LTS). Note: Vite may require Node 20.19+ or 22.12+ for the dev server to avoid warnings. You can still build with slightly older Node versions but upgrade if you see Vite warnings.
- pnpm (recommended for this workspace). Install with
npm i -g pnpmif you don't have it.
From the repository root run:
# Install all workspace dependencies
pnpm installThis will install dependencies for all workspace packages (apps/backend, apps/frontend, ...).
There are environment variables used by the backend and frontend. Edit or create the files below.
- Backend:
apps/backend/.env(already present in repo but you may want to review values) - Frontend:
apps/frontend/.env(setVITE_API_URLto point to your backend dev server)
Example apps/backend/.env (sensitive values should be kept secret):
PORT=8000
NODE_ENV=development
DATABASE_URL="file:./prisma/db/dev.db"
JWT_SECRET="replace-with-a-secure-secret"
CORS_ORIGIN=http://localhost:3000,http://localhost:5173
API_PREFIX=/apiExample apps/frontend/.env:
VITE_API_URL=http://localhost:8000Note:
CORS_ORIGINaccepts a comma-separated list of allowed origins. Add your production origin when ready.
The backend uses Prisma and an SQLite dev database by default. Run the following when you first set up the project or after schema changes:
# generate Prisma client for the backend
pnpm --filter backend run prisma:generate
# run migrations (creates/updates the SQLite dev DB)
pnpm --filter backend run prisma:migrateThe development DB file lives at apps/backend/prisma/db/dev.db.
Start the backend dev server (uses tsx watch):
pnpm --filter backend run devStart the frontend dev server (Vite):
pnpm --filter frontend run devOpen the frontend in your browser (Vite will print the local URL, commonly http://localhost:5173).
The frontend expects the backend API base URL in VITE_API_URL (see apps/frontend/.env).
There is a convenience script at the repository root: setup.sh.
Run it once after cloning to perform the common setup steps automatically:
./setup.shWhat setup.sh does:
- Runs
pnpm installfor the workspace - Generates the Prisma client
- Applies Prisma migrations (may be interactive)
- Ensures
apps/frontend/.envexists (creates minimal file if missing) - Attempts to install Tailwind dev dependencies and initialize Tailwind config
If any step fails the script will print a message explaining the next manual command to run.
Build backend (TypeScript compile):
pnpm --filter backend run buildBuild frontend:
pnpm --filter frontend run buildThe backend reads allowed origins from CORS_ORIGIN in apps/backend/.env (comma-separated). Add origins you want to allow (dev and production).
If you prefer to avoid CORS during local development you can also use a Vite proxy in apps/frontend/vite.config.ts instead of contacting the backend directly.
Tailwind is configured in the frontend (see apps/frontend/tailwind.config.cjs and apps/frontend/postcss.config.cjs). The Tailwind directives are included in apps/frontend/src/index.css.
If you need to (re)install Tailwind locally in the frontend package:
pnpm --filter frontend add -D tailwindcss postcss autoprefixer @tailwindcss/postcss
pnpm --filter frontend exec tailwindcss init -p- Install dependencies:
pnpm install - Start backend:
pnpm --filter backend run dev - Start frontend:
pnpm --filter frontend run dev - Build frontend:
pnpm --filter frontend run build - Build backend:
pnpm --filter backend run build - Generate Prisma client:
pnpm --filter backend run prisma:generate - Apply Prisma migrations:
pnpm --filter backend run prisma:migrate
- If Vite warns about Node version, upgrade Node to at least 20.19 or 22.x.
- If you see CORS errors in the browser, ensure
CORS_ORIGINin backend .env includes the frontend origin (e.g., http://localhost:5173) and restart the backend. - If Prisma complains about client not generated, run
pnpm --filter backend run prisma:generate.