How pranavtej/unkey works
Main Components
a) API Layer (apps/api)
• HTTP endpoints for key management
• Authentication flows
• Authorization checks
• Rate limiting endpoints
b) Agent Service (apps/agent)
• Distributed rate limiting
• Key verification
• Encryption/decryption services
• Cluster management
c) Dashboard (apps/dashboard)
• User interface for key management
• Analytics and monitoring
• Settings and configuration
d) Core Services
• Semantic Cache
• Rate Limiting
• Audit Logging
• Billing/Usage Tracking
Data Stores and Infrastructure
Critical storage components:
a) Databases
• Primary database (likely PostgreSQL based on schema files)
• ClickHouse for analytics
• Redis for caching/rate limiting
b) External Services
• Tinybird for analytics
• Axiom for logging
• S3 for storage
Communication Flows
a) Internal Communication
• gRPC connections between services (shown in proto files)
• Event-based communication (gossip protocol)
• Cache invalidation flows
b) External Communication
• Client API requests
• Webhook deliveries
• Integration endpoints (Vercel, etc.)
Security Boundaries
Highlight:
• Encryption boundaries (vault service)
• Authentication checkpoints
• Rate limiting zones
• IP whitelisting boundaries
Deployment Architecture
Show:
• Load balancers
• Edge functions
• Regional deployments
• Clustering configuration
Specific Design Elements
Use these visual elements:
• Blue: Core services
• Green: Data stores
• Yellow: External services
• Red: Security boundaries
Legends
• Component types
• Communication protocols
• Security zones
• Deployment regions
Key Workflows to Highlight
a) Key Verification Flow:
Client → API → Agent → Cache → Database
b) Rate Limiting Flow:
Request → Edge → Agent Cluster → Distributed Counter → Response
c) Audit Trail Flow:
Action → Event Router → ClickHouse → Analytics
Implementation Details
Technical stack indicators:
• TypeScript/Node.js for API
• Go for Agent
• React for Dashboard
• Protocol Buffers for RPC
• WebSocket for real-time features
Remember to include version indicators and deployment environment boundaries (production/staging/development) if relevant to the specific implementation.
This system design should emphasize the distributed nature of the authentication and authorization services while showing how the various components work together to provide a secure and scalable API key management solution.