Imported from Dansong00/laundromate (
AGENTS.md). Install upstream withnpx skills add Dansong00/laundromate. Copyright stays with the author.
AGENTS.md
Cursor Cloud specific instructions
Project overview
LaundroMate is a pnpm monorepo with a FastAPI backend (apps/api) and a Next.js 14 frontend (apps/web), plus three shared TypeScript packages (packages/ui, packages/types, packages/utils). PostgreSQL 15 is required infrastructure.
Services
| Service | Port | How to start |
|---|---|---|
| PostgreSQL | 5433 (mapped to 5432 inside container) | docker compose up -d postgres from repo root |
| FastAPI API | 8000 | cd apps/api && source .venv/bin/activate && PYTHONPATH=$PWD uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 |
| Next.js Web | 3000 | pnpm --filter @laundromate/web dev from repo root |
Lint / Test / Build
See package.json scripts in root and apps/web/package.json, plus pyproject.toml in apps/api.
- API lint:
cd apps/api && source .venv/bin/activate && flake8 --config .flake8 app/ - API tests:
cd apps/api && source .venv/bin/activate && PYTHONPATH=$PWD pytest - Web lint:
pnpm --filter @laundromate/web lint - Web tests:
cd apps/web && npx vitest --run - Web build:
pnpm --filter @laundromate/web build
Non-obvious caveats
- Database port: Docker maps PostgreSQL to port 5433 on the host (not 5432). The
.envfile inapps/apimust use port 5433 in theDATABASE_URL. Copy.env.exampleand update the port from 5432 to 5433. - Alembic:
alembic.inihard-codes the DB URL pointing topostgres:5432(Docker network hostname). For local development, alembic reads the URL fromapp.core.database.session.engine, which loads from.env. Always run alembic fromapps/apiwith the venv activated andPYTHONPATHset. - Settings strict mode:
app.core.config.settings.Settings(pydantic-settings) forbids extra fields. The.envfile must only contain fields declared in the Settings model (noREDIS_URL,DEBUG,TWILIO_*etc.). - bcrypt compatibility: passlib 1.7.4 is incompatible with bcrypt >= 4.1. Pin
bcrypt==4.0.1in the venv to avoidAttributeError: module 'bcrypt' has no attribute '__about__'. - Pytest ARRAY errors: ~306 test errors are pre-existing — tests use SQLite which doesn't support PostgreSQL ARRAY columns. The 75 passing tests and 17 failures are the real test results.
- Docker in Cloud VM: Docker daemon must be started with
sudo dockerdandfuse-overlayfsstorage driver. The socket needschmod 666 /var/run/docker.sockfor non-root access. - pnpm build scripts: On first
pnpm install, some packages (@clerk/shared,esbuild,unrs-resolver) have blocked build scripts. These do not affect dev functionality. - Clerk auth routes: The
<SignIn />and<SignUp />Clerk components must live in catch-all route directories ([[...sign-in]]/[[...sign-up]]). Without this, Clerk's internal sub-path requests (SSO callbacks, verification steps) 404 and cause "network error" on login. TheafterSignInUrl/afterSignUpUrlprops are deprecated in@clerk/nextjsv6; usefallbackRedirectUrlinstead. - Clerk env vars:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYandCLERK_SECRET_KEYmust be inapps/web/.env.local. Without them Clerk falls back to "keyless mode" with a temporary dev instance. Also setNEXT_PUBLIC_CLERK_SIGN_IN_URL=/auth/loginandNEXT_PUBLIC_CLERK_SIGN_UP_URL=/auth/sign-upso Clerk routing matches the app's custom auth paths. - Backend IdP config: For Clerk JWTs to verify on the API, set
IDP_JWKS_URIandIDP_ISSUERinapps/api/.envto your Clerk instance values (e.g.https://<your-app>.clerk.accounts.dev/.well-known/jwks.json).