🏗️ Architecture Overview
Crate Community Edition (CE) is a powerful, standalone API Gateway that provides a lightweight, performant solution for request routing and traffic management.
System Architecture
Crate CE consists of two main components that work together to provide a seamless development and production experience:
1. The Gateway Service
The Gateway is the heart of Crate CE. It is responsible for:
- Request Routing: Matching incoming requests to the correct backend service based on the
Hostheader and path. - SSL Termination: Handling encrypted traffic and terminating connections before forwarding requests. (Requires configuration with valid certificates).
- Rate Limiting: Ensuring fair usage by limiting the number of requests per client.
- Health Checking: Monitoring the health of backend services to ensure traffic is only routed to responsive nodes.
2. The Mirror Service (Optional)
For local development and testing, Crate CE includes a built-in Mirror service. This is a lightweight echo server that:
- Reflects the details of incoming requests (headers, paths, body).
- Allows for rapid testing of routing rules without needing a real backend service.
Standalone vs. Cloud/Enterprise
Crate CE is built on the same core logic as the Crate Cloud version, but it is optimized for standalone, node-local operation.
| Feature | Community Edition (CE) | Cloud / Enterprise |
|---|---|---|
| State Management | In-Memory (Node-local) | Redis (Shared-state, Clustered) |
| Load Balancing | In-Memory (Node-local) | Redis (Shared-state, Global) |
| Configuration | Local YAML Files | Product API (Dynamic, API-driven) |
| Traffic Logs | Local JSONL File | Product API (Centralized, Searchable) |
| Dependencies | No external services | Redis, CockroachDB, Product API |
Key Benefits of Standalone Mode
- Low Latency: In-memory rate limiting and load balancing have near-zero latency compared to networked external state stores.
- Reduced Complexity: No need to manage and scale additional infrastructure for simple deployments.
- Resilience: The Gateway can continue to operate even if other parts of your infrastructure are down.
Data Flow
A typical request through Crate CE follows this flow:
- Client Request: A client sends an HTTPS request to the Gateway.
- Hostname Matching: The Gateway looks up the
Hostheader in its loadedOrganizationConfigYAML files. - Route Processing: The Gateway matches the request path against defined routes for that domain.
- Rate Limit Check: The Gateway checks the in-memory rate limit for the client’s identifier.
- Load Balancing: The Gateway picks a healthy destination using the configured strategy (e.g., Round-Robin).
- Request Forwarding: The Gateway forwards the request to the backend service.
- Response Delivery: The Gateway receives the response from the backend and returns it to the client.
Next Steps
- Learn how to Configure Crate CE.
- Explore Docker Deployment.
- Back to Getting Started.