English | 中文
Build serverless, reliable apps at lightspeed ⚡ — with confidence 🛡️.
Anclax is a definition‑first framework for small–medium apps (single PostgreSQL). Define APIs and tasks as schemas; generated code moves correctness to compile time.
Join our Discord server.
- YAML-first, codegen-backed: Define HTTP and task schemas in YAML; Anclax generates strongly-typed interfaces so missing implementations fail at compile time, not in prod.
- Async tasks you can trust: At-least-once delivery, automatic retries, and cron scheduling out of the box.
- Transaction-safe flows: A WithTx pattern ensures hooks always run and side effects are consistent.
- Typed database layer: Powered by sqlc for safe, fast queries.
- Fast HTTP server: Built on Fiber for performance and ergonomics.
- AuthN/Z built-in: Macaroons-based authentication and authorization.
- Pluggable architecture: First-class plugin system for clean modularity.
- Ergonomic DI: Wire-based dependency injection keeps code testable and explicit.
- Glue-code fatigue: Many teams stitch HTTP, DB, tasks, DI, and auth by hand, leaving implicit contracts and runtime surprises. Anclax makes those contracts explicit and generated.
- Background jobs are hard: Idempotency, retries, and delivery guarantees are non-trivial. Anclax ships a task engine with at-least-once semantics and cron.
- Consistency across boundaries: Keep handlers, tasks, and hooks transactional using WithTx so invariants hold.
- Confidence and testability: Every generated interface is mockable; behavior is easy to test.
- Compile-time confidence: Schema → interfaces → concrete implementations you cannot forget to write.
- Productivity: anclax init + anclax gen reduces boilerplate and wiring.
- Extensibility: Clean plugin boundaries and event-driven architecture.
- Predictability: Singletons for core services, DI for clarity, and well-defined lifecycles.
Anclax helps you build quickly while staying scalable and production‑ready.
- Single PostgreSQL backbone: One PostgreSQL database powers both transactional business logic and the durable task queue, keeping state consistent and operations simple. For many products, a well‑provisioned instance (e.g., 32 vCPU) goes a very long way.
- Stateless application nodes: HTTP servers are stateless and horizontally scalable; you can run multiple replicas without coordination concerns.
- Task queue as integration fabric: Use async tasks to decouple modules. For example, when a payment completes, enqueue an OrderFinished task and do any factory‑module inserts in its handler—no factory logic inside the payment module.
- Built‑in worker, flexible deployment: Anclax includes an async task worker. Run it in‑process, as separate long‑running workers, or disable it for serverless HTTP (e.g., AWS Lambda) while keeping workers on regular servers.
- Monolith, not microservices: Anclax favors a pragmatic, scalable monolith and is not aimed at multi‑million QPS microservice fleets.
These choices maximize early velocity and give you a clear, reliable path to scale with confidence.
In another terminal:
- Define an endpoint (OpenAPI YAML) 🧩
- Define a task ⏱️
- Generate and implement 🛠️
Tasks run with at-least-once delivery guarantees and automatic retries based on your retry policy. You can also schedule tasks via cron expressions in api/tasks.yaml.
You can run custom logic before the app starts by providing an Init function:
To customize how the Anclax application is constructed, override InitAnclaxApplication:
Need more dependencies inside Init? Add them as parameters (e.g., model.ModelInterface) and run anclax gen.
- Transaction Management: docs/transaction.md (中文)
- Middleware (x-functions & x-check-rules): docs/middleware.md (中文)
- Async Tasks: Tutorial docs/async-tasks-tutorial.md · Tech reference docs/async-tasks-technical.md (中文, 中文)
- examples/simple — minimal end-to-end sample with HTTP, tasks, DI, and DB.