From 73bce1f70cb14b0edec384916a5df6a7fbb9d490 Mon Sep 17 00:00:00 2001 From: Khalid Abdi Date: Sun, 7 Jun 2026 18:19:27 +0300 Subject: [PATCH] docs: update root CLAUDE.md for the monorepo layout Reflect that frontend/ and backend/ are now subdirectories of a single git repo (the old per-folder repos are merged in); landing page lives in a separate temetro-landing repo; note the POSTGRES_PORT workaround. Co-Authored-By: Claude Opus 4.8 --- CLAUDE.md | 63 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 3cd12a9..8a6682a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -14,13 +14,14 @@ clinician adds or changes data, they **sign** it (blockchain-style); the change patient's record and **cannot be modified until the patient approves it** through a companion app. temetro can also **read existing patient databases** and present them in the same organized card UI. -This directory is the project root; the actual apps live in subdirectories. +This repository is a **monorepo**: the `frontend/` and `backend/` apps live side by side in one git +repository (published as `temetro`). -> **Status:** the **backend is now built**. `backend/` is a TypeScript + Express + Postgres API +> **Status:** the **backend is built**. `backend/` is a TypeScript + Express + Postgres API > (Drizzle ORM) with authentication and multi-tenant clinics via **Better Auth**, plus an > **org-scoped patient records API**. The `frontend/` chat is **wired to it**: real auth > (login/signup/reset/onboarding), route protection, clinic switching, and patient data fetched -> over the API — the old in-memory fixture is gone (`lib/patients.ts` now calls the backend). +> over the API — the old in-memory fixture is gone (`frontend/lib/patients.ts` now calls the backend). > > **Still vision, not built:** the patient companion app and the blockchain-style **signing / > patient-owned storage / approval** flow. The AI chat itself is still **mock replies** (no LLM @@ -29,43 +30,51 @@ This directory is the project root; the actual apps live in subdirectories. ## Layout +`frontend/` and `backend/` were previously separate per-folder git repos; they have been **merged +into this single monorepo with full history of both preserved**. The marketing **landing page lives +in its own separate repo** (`temetro-landing`), not here. + - **`frontend/`** — the Next.js product app (the AI chat UI). This is where almost all current work happens. **It has its own `CLAUDE.md`** — read `frontend/CLAUDE.md` for the stack, commands, - architecture, and gotchas. It is also its own git repository. -- **`landing-page/`** — the marketing landing page. A standalone copy of `frontend/` (same - customized Next.js stack) with the landing sections in `components/landing/`. + architecture, and gotchas. - **`backend/`** — the TypeScript + Express + Postgres API (Drizzle ORM + Better Auth). Built and Dockerised. **Has its own `CLAUDE.md`** (and `README.md`) — read it for the auth/schema workflow - and gotchas. Its own git repository. -- **`database/`, `docs/`** — still empty placeholders. -- **`landing-page/`** — see above; unchanged, still UI-only marketing. + and gotchas. -`frontend/`, `landing-page/`, and `backend/` are **independent** apps, each with its own -`package.json`/`node_modules`. Run `npm` commands from inside the relevant app directory, not from -this root. +`frontend/` and `backend/` are **independent apps**, each with its own `package.json` / +`node_modules`. Run `npm` commands from inside the relevant app directory, not from this root. ## Running the stack -From `backend/`: `cp .env.example .env` (set `BETTER_AUTH_SECRET`; set `POSTGRES_PORT` if 5432 is -already in use), then `docker compose up` → frontend :3000, backend :4000, Postgres. See -`backend/README.md`. For local dev without Docker, run `npm run dev` in `backend/` and `frontend/` -separately (the frontend reads `NEXT_PUBLIC_API_URL`, default `http://localhost:4000`). +From `backend/`: ensure a `.env` exists (`cp .env.example .env`, then set `BETTER_AUTH_SECRET` via +`openssl rand -base64 32`), then `docker compose up --build` → frontend :3000, backend :4000, +Postgres. Compose builds the sibling `../frontend` app, which works because they remain siblings in +the monorepo. See `backend/README.md`. -## Version control (per-folder git) +> **Port note:** if another Postgres already holds host port 5432, set `POSTGRES_PORT` (e.g. `5433`) +> in `backend/.env` — the app still talks to Postgres internally on `db:5432`; only the published +> host port changes. -Each top-level folder is its **own git repository** (`frontend/`, `landing-page/`, `backend/`, -`database/`, `docs/`); there is intentionally **no git repo at this root**. +For local dev without Docker, run `npm run dev` in `backend/` and `frontend/` separately (the +frontend reads `NEXT_PUBLIC_API_URL`, default `http://localhost:4000`). -**Commit after every change.** Whenever you modify files in a folder that contains a `.git`, finish -the task by committing those changes *in that folder* -(`git -C add -A && git -C commit`), so each folder's history tracks its own -changes. Keep each commit scoped to one folder — a change spanning two folders is two commits. End -commit messages with the `Co-Authored-By: Claude Opus 4.8 ` trailer. +## Version control (single monorepo) -## Customized Next.js (applies to both apps) +This root is **one git repository** (`temetro`). The old per-folder `.git` repos are gone — +`frontend/` and `backend/` are plain subdirectories now. -Both apps run a **customized Next.js 16** whose APIs/conventions differ from public docs. Before -writing Next.js code, read the relevant guide under `/node_modules/next/dist/docs/01-app/`. +**Commit after every change.** When you finish a task, commit from the repo root +(`git add -A && git commit`). Keep each commit focused on one logical change, and prefix the subject +with the area when useful (e.g. `frontend:` / `backend:`). End commit messages with the +`Co-Authored-By: Claude Opus 4.8 ` trailer. + +`.env` files are git-ignored (only `.env.example` is tracked) — never commit real secrets. + +## Customized Next.js (frontend) + +The `frontend/` app runs a **customized Next.js 16** whose APIs/conventions differ from public docs. +Before writing Next.js code, read the relevant guide under +`frontend/node_modules/next/dist/docs/01-app/`. ## Root tooling