Development Guide
How to set up your local environment and develop against the AnyaSelf stack.
Prerequisites
| Tool | Version | Purpose |
|---|---|---|
| Docker | 20.10+ | Container runtime for all services |
| Docker Compose | 2.0+ | Multi-service orchestration |
| Python | 3.12+ | Backend service development |
| Node.js | 19+ | Frontend development |
| pnpm / npm | Latest | Frontend package management |
Quick Start (Full Stack)
Clone and configure
git clone https://github.com/anyaself/new_project.git
cd new_project
cp .env.example .envThe default .env uses inmemory backends and simulated runners — no cloud credentials needed.
Start the backend stack
docker compose up --build -dThis builds and starts all 8 backend services. First build takes ~3-5min.
Verify services
docker compose ps
# Or run the smoke check:
bash ./scripts/smoke_compose.shStart the frontend (optional)
cd apps/client-web
npm install
npm run devThe frontend dev server starts at http://localhost:5173 and proxies API calls to the gateway at :8080.
Running Individual Services
Each service can run standalone. Useful for rapid iteration on a single service:
cd services/orchestrator
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
uvicorn src.main:app --reload --port 8003[!NOTE] When running a service standalone, inter-service calls will fail unless the dependent services are also running. Use
docker composefor full integration.
Service Ports
| Service | Port | Standalone Command |
|---|---|---|
api-gateway | 8080 | uvicorn src.main:app --reload --port 8080 |
wardrobe | 8081 | uvicorn src.main:app --reload --port 8081 |
commerce | 8002 | uvicorn src.main:app --reload --port 8002 |
orchestrator | 8003 | uvicorn src.main:app --reload --port 8003 |
vto | 8004 | uvicorn src.main:app --reload --port 8004 |
headless-cartprep | 8005 | uvicorn src.main:app --reload --port 8005 |
hyperbeam-bridge | 8006 | uvicorn src.main:app --reload --port 8006 |
artifacts-audit | 8007 | uvicorn src.main:app --reload --port 8007 |
Running Tests
All services use pytest with hermetically mocked external dependencies (Vertex AI, Firestore, Hyperbeam, etc).
Single Service
cd services/api-gateway
pytest -qAll Services
bash scripts/run_backend_tests.shFrontend Tests
cd apps/client-web
npm testCI/CD Pipeline
The project uses a GitHub Actions workflow (.github/workflows/backend-ci.yml) that runs on every push and pull request:
- Test matrix — Runs
pytest -qfor each of the 8 services independently using Python 3.12 - Docker build — Builds Docker images for all 8 services to catch Dockerfile issues
Tests run in parallel via a matrix strategy with fail-fast: false, so a failure in one service won't block test results from others.
Code Conventions
- Framework: All backend services use FastAPI with Pydantic for request/response validation
- Architecture: Hexagonal pattern — see Architecture Overview
- Persistence: Dual-backend pattern (
firestore/inmemory), selected viaPERSISTENCE_BACKENDenv var - Auth: JWT-based with shared secret in dev, OIDC/JWKS in production
- Python style: Standard library
typing,dataclassesfor internal state,pydantic.BaseModelfor API contracts - Frontend: React 18 + TypeScript + Vite, no CSS framework (vanilla CSS)
Useful Scripts
| Script | Description |
|---|---|
scripts/smoke_compose.sh | Health-check all services after docker compose up |
scripts/run_backend_tests.sh | Run pytest for all services |
scripts/build_backend_images.sh | Build Docker images for all services |
scripts/deploy_backend_cloudrun.sh | Deploy all services to Google Cloud Run |
scripts/deploy_frontend_cloudrun.sh | Build and deploy the frontend to Cloud Run |