api-communication-architecture
Skill2 starsChanged 5 months agoMITView on GitHub
API and communication architecture — REST, GraphQL, gRPC, WebSocket, MQTT, webhooks, and messaging/queue systems (RabbitMQ, Kafka, NATS, Celery) with sync vs async decision rules.
In this repository20 other files it gives its agents.
- core-principles-decision-engineSkill
- foundationsSkill
- product-businessSkill
- frontend-architectureSkill
- backend-architectureSkill
- database-data-architectureSkill
- architecture-patternsSkill
- cloud-infrastructureSkill
- devops-cicdSkill
- ai-ml-architectureSkill
- robotics-systems-architectureSkill
- security-architectureSkill
- reliability-sreSkill
- performance-engineeringSkill
- engineering-practicesSkill
- team-leadershipSkill
- cost-business-architectureSkill
- domain-reference-architecturesSkill
- review-output-standardsSkill
- archon-decision-engineSkill
The file
Files
06 — API & Communication Architecture (L2)
Level: L2 — Software Engineering.
Goal
Choose the right communication protocol per interaction (request/response vs. streaming vs. event-driven) and the right messaging backbone when async processing is genuinely needed — protocol and messaging-technology choice should follow from the actual interaction pattern, not from default habit.
Protocol Decision Matrix
| Protocol | Best for | Avoid when |
| REST | Default choice for most public/external APIs — simple, cacheable, universally understood | Client needs to fetch deeply nested/varied data shapes efficiently in one round trip |
| GraphQL | Clients with varied, evolving data needs (especially mobile/multiple frontend clients sharing one API) | Simple CRUD APIs where REST's simplicity is sufficient — GraphQL adds real server-side complexity (resolver design, N+1 query risk, caching difficulty) |
| gRPC | Internal service-to-service communication needing high performance and strong typing (via Protobuf) | Public APIs needing broad client compatibility (browser support is limited without a proxy) |
| WebSocket | Real-time, bidirectional, persistent-connection needs (chat, live collaboration, live dashboards) | Simple request/response interactions — adds connection-management complexity for no benefit |
| MQTT | IoT/constrained-device messaging — lightweight, designed for unreliable networks | General web/app backend communication — it's purpose-built for device telemetry, not a general API protocol |
| Webhooks | Notifying external systems of events asynchronously | Needing a guaranteed, ordered delivery or sub-second latency without the receiver investing in robust retry handling |
Messaging / Queue Decision Matrix
| Technology | Best for |
| RabbitMQ | General-purpose task queues, complex routing (exchanges/topics), moderate throughput — strong default for most background-job needs |
| Kafka | High-throughput event streaming, event replay, multiple independent consumers of the same stream, log-based architectures |
| NATS | Lightweight, very low-latency pub/sub and request/reply, especially in cloud-native/microservices and IoT contexts |
| Redis Queue / BullMQ | Simple background job queues when Redis is already in the stack and throughput needs are modest |
| Celery (Python) | Python-ecosystem task queue, mature, well-integrated with Django/FastAPI |
Decision Rule
Default to synchronous REST for client-facing APIs and a simple queue (RabbitMQ, or Redis-based if Redis is already present) for background jobs. Reach for GraphQL only with a genuine multi-client/varied-query-shape need. Reach for Kafka only with a genuine event-replay or high-throughput multi-consumer need — see skills/00_Core/reference/over-under-engineering.md's "Kafka for small background jobs" trigger.
Reference Files
reference/communication-architecture.md— full protocol comparison, API design conventions, sync vs. async decision framework.reference/messaging-event-driven.md— queue/broker deep dive, delivery guarantees, event-driven architecture patterns.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

