API Gateway
Role in the Project
The API Gateway serves as the central entry point for handling all external and internal requests between the frontend, backend services, and AI processing core. It abstracts service complexity, ensuring security, load balancing, and efficient API management.
Strengths & Weaknesses
Strengths:
- Centralized authentication and authorization
- Efficient request handling with caching and rate limiting
- Flexible API design allowing GraphQL for tailored queries and REST for structured endpoints
Weaknesses:
- Can introduce latency if not optimized correctly
- Requires additional infrastructure to handle scaling
Available Technologies & Comparison
- GraphQL (Apollo, Hasura): Allows flexible queries, reduces over-fetching, but requires additional schema validation overhead.
- REST (Express.js, Fastify, NestJS): Well-known, stateless architecture, but can lead to over-fetching or under-fetching of data.
- gRPC: High-performance alternative, good for internal microservices but less compatible with web clients.
Chosen Approach
We adopt GraphQL with Apollo for dynamic frontend queries and REST with NestJS for structured API endpoints. This hybrid model balances flexibility and performance.
Example of a GraphQL query for object detection:
query GetDetectionResults($imageId: ID!) {
detectionResults(imageId: $imageId) {
objects {
label
confidence
boundingBox {
x
y
width
height
}
}
}
}
⚠️
All information provided here is in draft status and therefore subject to updates.
Consider it a work in progress, not the final word—things may evolve, shift, or completely change.
Stay tuned! 🚀
Consider it a work in progress, not the final word—things may evolve, shift, or completely change.
Stay tuned! 🚀