AnyaSelf Docs

Development Guide

How to set up your local environment and develop against the AnyaSelf stack.

Prerequisites

ToolVersionPurpose
Docker20.10+Container runtime for all services
Docker Compose2.0+Multi-service orchestration
Python3.12+Backend service development
Node.js19+Frontend development
pnpm / npmLatestFrontend package management

Quick Start (Full Stack)

Clone and configure

git clone https://github.com/anyaself/new_project.git
cd new_project
cp .env.example .env

The default .env uses inmemory backends and simulated runners — no cloud credentials needed.

Start the backend stack

docker compose up --build -d

This 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.sh

Start the frontend (optional)

cd apps/client-web
npm install
npm run dev

The 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 compose for full integration.

Service Ports

ServicePortStandalone Command
api-gateway8080uvicorn src.main:app --reload --port 8080
wardrobe8081uvicorn src.main:app --reload --port 8081
commerce8002uvicorn src.main:app --reload --port 8002
orchestrator8003uvicorn src.main:app --reload --port 8003
vto8004uvicorn src.main:app --reload --port 8004
headless-cartprep8005uvicorn src.main:app --reload --port 8005
hyperbeam-bridge8006uvicorn src.main:app --reload --port 8006
artifacts-audit8007uvicorn 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 -q

All Services

bash scripts/run_backend_tests.sh

Frontend Tests

cd apps/client-web
npm test

CI/CD Pipeline

The project uses a GitHub Actions workflow (.github/workflows/backend-ci.yml) that runs on every push and pull request:

  1. Test matrix — Runs pytest -q for each of the 8 services independently using Python 3.12
  2. 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 via PERSISTENCE_BACKEND env var
  • Auth: JWT-based with shared secret in dev, OIDC/JWKS in production
  • Python style: Standard library typing, dataclasses for internal state, pydantic.BaseModel for API contracts
  • Frontend: React 18 + TypeScript + Vite, no CSS framework (vanilla CSS)

Useful Scripts

ScriptDescription
scripts/smoke_compose.shHealth-check all services after docker compose up
scripts/run_backend_tests.shRun pytest for all services
scripts/build_backend_images.shBuild Docker images for all services
scripts/deploy_backend_cloudrun.shDeploy all services to Google Cloud Run
scripts/deploy_frontend_cloudrun.shBuild and deploy the frontend to Cloud Run

On this page