Introduction
Worker Core is the internal engine of Andera. It is never used directly by application developers, but serves as the technical foundation for all Workers (via Base Worker). This page is mainly for contributors or those curious about the internal architecture.
Role
- Provides orchestration, slot management, contract validation, logging, and the runtime for all Andera Workers.
- All business logic (functions, services, helpers, tags) is added in a Worker project based on Base Worker.
- Worker Core is never deployed on its own; it is used as a dependency.
Project Structure
worker-core/
├── src/
│ ├── config/ # Loads and validates configuration
│ ├── controllers/ # Exposes HTTP endpoints (task, health, logs, etc.)
│ ├── dynamic/ # Dynamic discovery of functions/services/tags
│ ├── middleware/ # HTTP middlewares (auth, logs, etc.)
│ ├── slots/ # Slot management (parallelism, internal queues)
│ ├── types/ # Shared TypeScript types
│ ├── utils/ # Utilities (logger, validation, etc.)
│ └── websocket/ # WebSocket server for slots and monitoring
├── dist/ # Compiled build
├── package.json # Dependencies and scripts
├── README.md
└── LICENCE
Key Concepts
- Slots: Manages parallelism; each Worker exposes a number of slots to execute tasks in parallel.
- Contracts: Strict validation of the interface (functions, parameters) to ensure homogeneity within a group of Workers.
- Orchestration: Receives, schedules, and executes tasks, manages internal queues.
- Dynamic discovery: Auto-loads functions, services, helpers, and tags from the Worker project.
- Native logging: In-memory logging system, exposed via endpoint and WebSocket.
- WebSocket: For real-time monitoring (slots, status, etc.).
Contributing
- See the README and source code to explore entry points.
- All contributions should follow the project philosophy: performance, simplicity, robustness.
For developer documentation (using Workers, creating functions/services/tags), see the Base Worker section.