Anthill is a Rust and Svelte ERP-style application that currently runs as a unified backend binary (anthill-server) plus a SvelteKit frontend. Older documentation in this repository still refers to separately started backend services; that is no longer the default runtime model.
| Area | Current reality |
|---|---|
| Backend runtime | server/ builds anthill-server, which merges the active module routers into one Axum application |
| Active backend modules | user, inventory, purchase, sales, accounting, manufacturing, enterprise |
| Shared backend foundations | PostgreSQL, SQLx, Casbin, KeyDB, RustFS, in-process event bus, shared workspace crates |
| Frontend | frontend/ is a SvelteKit 2 + Svelte 5 app using Bun and Tailwind CSS 4 |
| API shape | Backend endpoints are exposed under /api/v1/*; OpenAPI UI is served directly from anthill-server at /docs |
| Local edge/gateway | APISIX is available locally on http://localhost:9080 |
| Legacy or incomplete backend dirs | services/order_service, services/integration_service, and services/payment_service exist in the repo but are not part of the current workspace startup path; payment_service is explicitly excluded from the Cargo workspace |
| Frontend feature maturity | Inventory, purchase, sales, accounting, manufacturing, enterprise, auth, and admin areas have real API clients; some exploratory screens still use mock data, notably frontend/src/lib/api/orders.ts and frontend/src/lib/api/integrations.ts |
infra/anthill/
├── server/ # Unified anthill-server binary
├── services/ # Domain modules and legacy service directories
│ ├── user_service/ # api/core/infra crates
│ ├── inventory_service/ # api/core/infra crates + legacy crate
│ ├── purchase_service/ # api/core/infra crates
│ ├── sales_service/ # api/core/infra crates
│ ├── accounting_service/ # api/core/infra crates
│ ├── manufacturing_service/ # api/core/infra crates
│ ├── enterprise_service/ # api crate
│ ├── order_service/ # legacy/prototype directory, not in workspace
│ ├── integration_service/ # legacy/prototype directory, not in workspace
│ └── payment_service/ # excluded from workspace
├── shared/ # Shared Rust crates (auth, db, config, events, etc.)
├── frontend/ # SvelteKit frontend
├── infra/ # Docker, Podman, APISIX, Nginx, observability assets
├── migrations/ # SQLx migrations
├── tests/ # E2E, load, and QA scripts
├── PROJECT_TRACKING/ # Delivery tracking and implementation notes
├── start-system.sh # Recommended local startup script
└── stop-system.sh # Matching local shutdown script
cargosqlx-cli if you want the startup script to run migrations automaticallyFrom the project root:
./start-system.sh
What the script does:
sqlx is installed, unless --skip-migrations is passedanthill-server on port 80005173Default local endpoints after startup:
http://localhost:5173http://localhost:8000/healthhttp://localhost:8000/docshttp://localhost:9080http://localhost:9000http://localhost:9001Stop everything with:
./stop-system.sh
./start-system.sh --docker
./start-system.sh --podman
./start-system.sh --containers-only
./start-system.sh --skip-migrations
Use this path when you want to debug specific pieces instead of relying on start-system.sh.
With Docker:
docker compose -f infra/docker_compose/docker-compose.yml up -d
With Podman:
cd infra/podman
cp .env.example .env
podman compose -f docker-compose.podman.yml up -d
cd ../..
start-system.sh uses these defaults for local development. If you run services manually, export them yourself:
export DATABASE_URL=postgres://user:password@localhost:5432/inventory_db
export REDIS_URL=redis://localhost:6379
export JWT_SECRET=anthill-dev-secret-key-change-in-production
export RUSTFS_ENDPOINT=http://localhost:9000
export RUSTFS_ACCESS_KEY=rustfsadmin
export RUSTFS_SECRET_KEY=rustfsadmin
export CORS_ORIGINS=http://localhost:5173,http://localhost:9080
export SQLX_OFFLINE=true
cargo install sqlx-cli --no-default-features --features postgres
sqlx migrate run
cargo run --bin anthill-server
cd frontend
bun install
bun run dev
frontend/.env.example defaults PUBLIC_API_GATEWAY_URL to http://localhost:8000, which is convenient for direct local development. If you want the browser to go through APISIX locally, point it to http://localhost:9080 instead.
cargo fmt --all
SQLX_OFFLINE=true cargo check --workspace
SQLX_OFFLINE=true cargo clippy --workspace -- -D warnings
cargo test --workspace
Notes:
cargo test --workspace includes crates that may expect a database or other local services to be available.anthill-server; do not assume older per-service cargo run --bin ... commands are still valid.cd frontend
bun install
bun run check
bun run lint
bun run test:unit
bun run test:e2e
bun run test
bun run build
tests/e2eThere is also a standalone Playwright suite under tests/e2e/.
cd tests/e2e
npm install
npm test
For isolated PostgreSQL and KeyDB instances used by some tests:
docker compose -f docker-compose.test.yml up -d
The repository standard is SQLx compile-time checked macros plus committed offline metadata.
Rules:
sqlx::query!, sqlx::query_as!, and sqlx::query_scalar! for static SQL.sqlx/ as required workspace metadataUpdate metadata with:
cargo install sqlx-cli --no-default-features --features postgres
cargo sqlx prepare
CI or local verification:
cargo sqlx prepare --check
infra/docker_compose/infra/podman/infra/apisix/infra/docker_compose/ and infra/podman/infra/nginx/ are not the main local development path; local development is centered on APISIX plus the dev frontendARCHITECTURE.md for system design notesSTRUCTURE.md for codebase conventions and layoutfrontend/README.md for frontend-specific detailsinfra/podman/README.md for Podman workflow notesPROJECT_TRACKING/TASKS_OVERVIEW.md for implementation tracking.sqlx/ in the same changeREADME.md, start-system.sh, and infra compose files aligned