architecture-paradigm-client-server
npx machina-cli add skill athola/claude-night-market/architecture-paradigm-client-server --openclawThe Client-Server and Peer-to-Peer Paradigms
When to Employ This Paradigm
- For traditional applications that have centralized services, such as web or mobile clients communicating with backend APIs.
- For systems exploring decentralized or "offline-first" capabilities that rely on peer-to-peer synchronization.
- To formally document trust boundaries, client-server version negotiation, and API evolution strategies.
Adoption Steps
- Define Responsibilities: Clearly delineate which logic and data reside on the client versus the server, with the goal of minimizing duplication.
- Document the Contracts: Formally document all APIs, data schemas, authentication flows, and any capability negotiation required for handling different client versions.
- Plan for Version Skew: Implement a strategy to manage different client and server versions, such as using feature flags,
Acceptheaders for content negotiation, or semantic versioning for APIs. - Address Connectivity Issues: If the application is not purely client-server, design for intermittent connectivity. This may involve implementing offline caching, data synchronization protocols, or peer discovery and membership services.
- Secure All Communications: Enforce the use of TLS for all data in transit. Implement authorization policies, rate limiting, and detailed telemetry for every endpoint.
Key Deliverables
- An Architecture Decision Record (ADR) that covers the roles of clients, servers, and peers, defines the trust boundaries, and outlines deployment assumptions.
- Formal API or protocol specifications, along with a suite of compatibility tests.
- Runbooks detailing the coordination required for rollouts, such as client release waves, backward-compatibility support, or operational procedures for a peer-to-peer network.
Risks & Mitigations
- "Chatty" Clients:
- Mitigation: A client making too many small requests can lead to poor performance. Consolidate API calls using patterns like the Façade or Gateway, and implement caching strategies on the client or at the network edge.
- "Thick" Clients with Duplicated Logic:
- Mitigation: When clients contain too much business logic, it often becomes duplicated and out-of-sync with the server. Share validation logic by packaging it in a common library or move the rules definitively to the server.
- Peer-to-Peer Data Conflicts:
- Mitigation: In a peer-to-peer model, data conflicts are inevitable. Design formal conflict resolution strategies (e.g., CRDTs, last-write-wins) and consensus mechanisms from the beginning.
Troubleshooting
Common Issues
Command not found Ensure all dependencies are installed and in PATH
Permission errors Check file permissions and run with appropriate privileges
Unexpected behavior
Enable verbose logging with --verbose flag
Source
git clone https://github.com/athola/claude-night-market/blob/master/plugins/archetypes/skills/architecture-paradigm-client-server/SKILL.mdView on GitHub Overview
Outlines how to partition logic and data between clients and backend services, with clear trust boundaries and formal API contracts. It also covers offline-first and peer-to-peer considerations, security, and deployment-friendly deliverables like ADRs and runbooks.
How This Skill Works
It works by clearly delineating client vs server responsibilities, documenting APIs, data schemas, and authentication flows, and planning for version skew via feature flags or API versioning. It also addresses intermittent connectivity with offline caching and data synchronization, and enforces TLS and authorization policies.
When to Use It
- Traditional web or mobile apps with centralized backend services and APIs.
- Systems exploring offline-first capabilities that use peer-to-peer synchronization.
- When you need formal documentation of trust boundaries, client-server version negotiation, and API evolution strategies.
- Environments requiring forward/backward compatibility through explicit API contracts and compatibility tests.
- Architectures where intermittent connectivity must be gracefully handled with caching and data sync.
Quick Start
- Step 1: Define Responsibilities: clearly separate client and server logic and data.
- Step 2: Document the Contracts: capture APIs, data schemas, authentication, and versioning rules.
- Step 3: Plan for Version Skew: implement feature flags, content negotiation, or semantic versioning.
Best Practices
- Clearly delineate client vs server responsibilities to minimize duplication.
- Document all APIs, data schemas, auth flows, and versioning strategies.
- Plan for version skew with feature flags, Accept headers, or semantic versioning.
- Design for intermittent connectivity with offline caching and robust synchronization protocols.
- Enforce TLS, authorization policies, rate limiting, and telemetry for all endpoints.
Example Use Cases
- A web app with centralized backend APIs and a well-defined ADR outlining roles and trust boundaries.
- A mobile app using API versioning and backward-compatible contracts to handle updates gracefully.
- A system with formal API specifications and a compatibility test suite to ensure client-server coherence.
- An offline-first application that synchronizes data between clients and the server when connectivity is available.
- A distributed service employing peer discovery and membership services to coordinate a peer-to-peer workflow.
Frequently Asked Questions
Related Skills
architecture-paradigm-space-based
athola/claude-night-market
'Data-grid architecture for high-traffic stateful workloads with linear
architecture-paradigm-layered
athola/claude-night-market
'Consult this skill when implementing layered patterns or enforcing layer
architecture-paradigm-microkernel
athola/claude-night-market
'Minimal core system with plugin-based feature extensibility for platform
architecture-paradigm-microservices
athola/claude-night-market
'Consult this skill when designing or evolving microservices architectures.
architecture-paradigm-pipeline
athola/claude-night-market
'Consult this skill when designing data pipelines or transformation workflows.
architecture-paradigm-serverless
athola/claude-night-market
'Serverless FaaS for event-driven workloads with minimal infrastructure