diff --git a/.gitignore b/.gitignore index c2b1d85..147d118 100644 --- a/.gitignore +++ b/.gitignore @@ -73,3 +73,7 @@ tools/license_private.key # Local config backups *.env.bak + +# Local tooling artifacts +.claude/screenshots/ +.playwright-mcp/ diff --git a/CLAUDE.md b/CLAUDE.md index 8ff953e..da69b3f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -5,8 +5,8 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## System Overview ScalesApp is a three-tier weighing scale management system with real-time data synchronization: -- **Django Backend** (REST API + Server-Sent Events) on port 8000 -- **React Frontend** (SPA) on port 3000 +- **Django Backend** (REST API + Server-Sent Events) on port 8002 +- **React Frontend** (SPA) on port 5172 - **Serial Bridge** (Flask SSE server) on port 5000 for COM port reading ## Development Commands @@ -25,8 +25,8 @@ python manage.py migrate python manage.py createsuperuser # Run server -python manage.py runserver # Development (WSGI) -uvicorn scalesapp.asgi:application --reload # Development (ASGI - for SSE) +python manage.py runserver 8002 # Development (WSGI) +uvicorn scalesapp.asgi:application --reload --port 8002 # Development (ASGI - for SSE) # Testing (when implemented) python manage.py test @@ -38,7 +38,7 @@ python manage.py test api.tests.test_models # Single test file ```bash cd frontend npm install -npm start # Development server +npm start # Development server (port from frontend/.env, currently 5172) npm run build # Production build npm test # Run tests ``` @@ -253,7 +253,8 @@ Element (base class) - SSE connection authenticated via query param: `/sse-connect/?token=` or Authorization header **CORS Configuration:** -- Allowed origins: http://localhost:3000, http://127.0.0.1:3000, http://localhost:5174 +- Allowed origins (default): http://localhost:5172, http://127.0.0.1:5172, http://localhost:3000, http://127.0.0.1:3000, http://localhost:5174, http://127.0.0.1:5174 +- Override with the `CORS_ALLOWED_ORIGINS` env var (comma-separated) - Credentials allowed (for cookies if needed) **User Roles:** @@ -316,7 +317,8 @@ DB_PORT=5432 **Frontend:** `frontend/.env` ``` -REACT_APP_API_URL=http://localhost:8000 +PORT=5172 +REACT_APP_API_URL=http://localhost:8002 ``` **Serial Bridge:** `serial_bridge/.env` @@ -330,11 +332,11 @@ DEBUG=False ## Running the Full Application -1. Start Django: `cd backend && python manage.py runserver` +1. Start Django: `cd backend && python manage.py runserver 8002` 2. Start Serial Bridge: `cd serial_bridge && python app.py` 3. Start React: `cd frontend && npm start` -For SSE to work properly in Django, use uvicorn instead: `uvicorn scalesapp.asgi:application --reload` +For SSE to work properly in Django, use uvicorn instead: `uvicorn scalesapp.asgi:application --reload --port 8002` ## Common Patterns