How dimo-network/devices-api works
Main System Components
a) API Layer:
• HTTP REST API (Swagger/OpenAPI documented)
• gRPC Services (aftermarket_devices and user_devices)
• WebHooks Controller
b) Core Services Layer:
• Device Management Services
• Integration Services (Tesla, Smartcar, AutoPi)
• NFT/Blockchain Services
• Event Services
• Authentication/Authorization Services
c) Data Storage:
• PostgreSQL Database (primary data store)
• Elasticsearch (device status and search)
• Redis (task queue)
• IPFS (document storage)
d) Message Brokers:
• Kafka (event streaming)
• NATS (real-time messaging)
Architectural Patterns to Emphasize
• Microservice Architecture: Show how this service fits into the broader DIMO ecosystem
• Event-Driven Architecture: Highlight Kafka producers/consumers
• Command Query Responsibility Segregation (CQRS): Separate read/write paths
• Repository Pattern: For data access abstraction
┌─────────────────────────────────────────────────────────────┐
• External Clients │
• (Mobile Apps, Web Apps, Other DIMO Services, Smart Devices) │
• ┘
• ↕
┌─────────────────────────────────────────────────────────────┐
• API Gateway Layer │
• REST API (Swagger) │ gRPC Services │ Webhook Endpoints │
• ┘
• ↕
┌─────────────────────────────────────────────────────────────┐
• Service Layer │
• ┌─────────────┐ ┌──────────────┐ ┌──────────────────┐ │
• Device │ │ Integration │ │ NFT/ │ │
• Services │ │ Services │ │ Blockchain Svcs │ │
• ┘ └──────────────┘ └──────────────────┘ │
• ┘
• ↕
┌─────────────────────────────────────────────────────────────┐
• Infrastructure Layer │
• ┌─────────┐ ┌────────────┐ ┌───────┐ ┌───────┐ ┌────────┐ │
• Postgres │ │Elasticsearch│ │Redis │ │Kafka │ │ IPFS │ │
• ┘ └────────────┘ └───────┘ └───────┘ └────────┘ │
• ┘
Important Flows to Highlight
• Device registration and management flow
• Integration authentication flow
• Event processing flow
• NFT minting and management flow
• Data ingestion and processing pipeline
Additional Elements
• Version/environment indicators
• Security boundaries
• Scalable components (marked by Kubernetes deployments)
• Monitoring points (ServiceMonitor templates)
Technical Details
• Kubernetes deployment boundaries
• Database migration paths
• API versioning
• Authentication flow with Dex
• Integration points with external services