Backend Microservice Architecture Architect

    1

    Architects backend microservices: hexagonal boundaries, ports and adapters, outbox event relays, and resilient runtimes.

    $9

    Secure checkout via Stripe

    30-day refund guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseOpenClawOpenClaw+21 more

    Backend Microservice Architecture Architect

    Example session with this skill installed

    Architect backend microservice architecture, hexagonal domain boundaries, and persistence contracts for our Card Issuance Service.

    • Subject: card-issuance-service v2.0 (run-id: card-issuance-arch-001) managing digital card generation and PAN provisioning across 80 bank integrations.
    • Deciders: Lead Backend Architect (David O'Reilly) and Head of Card Systems Engineering (Elena Rostova).
    • Workload: Peak arrival 4,200 card provisioning requests/sec; end-to-end processing latency budget p99 <= 45 ms; strict PCI-DSS Level 1 compliance.
    • Tension: Squads proposed a traditional 3-tier layered architecture with active Spring Data JPA entities directly bound to HTTP controllers; David O'Reilly and Elena Rostova strictly reject tightly coupled JPA controllers, citing incident REG-4819 where Hibernate dirty-checking overwrote card limit profiles during an API refactor. They mandate an authoritative Hexagonal Architecture (Ports & Adapters): pure framework-free domain core, explicit inbound/outbound ports, transactional outbox event relay, DB connection pool boundaries, and sub-10ms domain validations.

    Write the backend service architecture overview under docs/.

    • Read your context and instructions
    • Compiled the backend microservice architecture
    • Generated the document

    Wrote docs/architecture/backend-service-architect/00-overview/backend-service-architect-overview.md. Complete backend microservice architecture specification establishing Hexagonal Ports & Adapters, framework-free domain cores, transactional outbox relays, and connection pool isolation.


    skill: backend-service-architect

    Backend Microservice Architecture: Card Issuance Service [SVCARCH-CARD-001]

    Summary

    This specification establishes the backend microservice architecture, internal module boundaries, and persistence contracts for card-issuance-service v2.0 under run ID card-issuance-arch-001. It governs digital card generation and Primary Account Number (PAN) cryptographic provisioning across 80 enterprise bank integrations sustaining 4,200 peak requests/second. It decisively eliminates the architectural coupling and unintended state mutations demonstrated in incident REG-4819 (where exposing ORM entities directly to web controllers allowed automated Hibernate dirty-checking to overwrite card limit profiles during an HTTP serialization refactor). The architecture enforces a strict

    Hexagonal Architecture (Ports & Adapters) model: isolating a framework-free Java 21 domain core, driving operations via explicit Inbound Ports (REST and Kafka consumers), delegating persistence via Outbound Ports, implementing an atomic Transactional Outbox relay to Apache Kafka, and enforcing strict sub-45ms p99 latency envelopes.

    Detailed Description

    Layered "controller-service-dao" architectures commonly couple business logic to web framework annotations (@RestController, @Transactional) and persistence entities (@Entity). When domain logic depends directly on database ORM drivers or HTTP serialization libraries, refactoring an API endpoint inadvertently alters database transaction boundaries, leading to data corruption and leaky abstractions. Hexagonal Architecture inverts these dependencies: the domain core contains zero external framework imports, communicating exclusively through abstract interfaces (Ports), while external technologies (HTTP, PostgreSQL, Kafka) plug in as replaceable Adapters.

    Inbound Adapters (HTTP Controller / Kafka Consumer)
                             │
                             ▼ (Passes DTO to Inbound Port Interface)
    [ Inbound Port: `IssueCardUseCase` ]
                             │
                             ▼ (Invokes Pure Domain Logic)
    [ Pure Domain Core: Framework-Free Java 21 ]
      ├── Aggregate Root: `CardAccount` (Private setters, immutable invariants)
      ├── Value Objects: `CardPan`, `ExpiryDate`, `SpendingLimit`
      └── Domain Service: `CardCryptographicTokenService`
                             │
                             ▼ (Calls Abstract Outbound Port Interface)
    [ Outbound Ports: `CardRepositoryPort`, `EventPublisherPort` ]
                             │
            ┌────────────────┴────────────────┐
            ▼ (PostgreSQL Adapter)            ▼ (Outbox Event Adapter)
    [ PostgreSQL Aurora Driver ]       [ Transactional Outbox Table ]
      ├── Executes Parameterized SQL     ├── Commits `CardIssuedEvent` in same ACID txn
      └── Connection Pool Capped at 60   └── Debezium CDC Streams to Kafka Topic
    

    Criteria and weights

    CriterionWhy it matters hereWeightSource of the weight
    Domain Core Framework IndependenceDomain logic must not leak framework annotations that induce accidental state mutation (REG-4819).0.40David O'Reilly (Lead Backend Architect)
    Transactional Outbox AtomicityCard generation must never commit to the database if the corresponding audit event fails to record.0.30Elena Rostova (Head of Card Systems)
    Latency Budget SLA (p99 <= 45 ms)Cryptographic card generation and ledger checks must execute rapidly under 4,200 TPS.0.15Core Banking Issuance SLA
    Testability without Heavy Test HarnessesPure domain units must execute in-memory in under 1 millisecond without spinning up Spring contexts.0.15Engineering Quality Standard

    Comparison

    Architecture Pattern CandidateDomain IsolationFramework CouplingTest Execution SpeedEvaluation
    Option A: 3-Tier Layered Architecture (Legacy)Anemic Entities in DAOHigh (Spring + Hibernate annotations everywhere)Slow (Requires Spring context for tests)Rejected: Caused REG-4819 state corruption bug; leaky abstractions.
    Option B: Monolithic Stored ProceduresDatabase Stored ProceduresProprietary SQL DialectImpossible to unit testRejected: Violates maintainability standards; database CPU bottleneck.
    Option C: Hexagonal Ports & Adapters (Chosen)Pure Domain CoreZero (Zero external imports in core)Instant (< 1ms in-memory pure domain tests)Selected: 100% boundary isolation, zero framework drift, sub-45ms speed.

    Result

    Option C is selected. Framework-free domain core guarantees business rule immutability; ports and adapters decouple web and persistence layers; transactional outbox eliminates distributed inconsistencies.


    Required Mechanisms

    1. Inbound & Outbound Port Contract Definitions [MC-PO-01]
    Inbound Port (Driving Interface)
    public interface IssueCardUseCase {
        CardIssuanceResponse issueCard(IssueCardCommand command);
    }
    
    Outbound Ports (Driven Interfaces)
    public interface CardRepositoryPort {
        Optional<CardAccount> findById(CardAccountId id);
        void save(CardAccount cardAccount);
    }
    
    public interface CardEventPublisherPort {
        void publish(CardDomainEvent event);
    }
    
    2. Framework-Free Domain Core Invariants [MC-DC-01]
    • The package com.bank.card.domain.* has

    zero external library dependencies (only standard java.time.*, java.math.*, java.util.*).

    • Domain Invariants:
      • SpendingLimit: Cannot be negative; daily cash withdrawal ceiling capped at $2,500.00.
      • CardAccount: A newly issued card cannot be activated if the linked funding account status is FROZEN or RESTRICTED.
    3. Transactional Outbox & CDC Pipeline [MC-OB-01]
    • Atomic Persistence:
      • CardRepositoryAdapter writes the new card state to table cards.
      • In the exact same PostgreSQL database transaction, CardEventPublisherAdapter writes an event record to card_outbox:
        INSERT INTO card_outbox (event_id, aggregate_id, event_type, payload, created_at)
        VALUES (:eventId, :cardId, 'CardIssuedEvent', :payloadJson, NOW());
        
    • Debezium CDC reads WAL logs and publishes to Kafka topic card.events.v1 in < 200 ms.
    4. Database Connection Pool Boundaries [MC-CP-01]
    • HikariCP connection pool is bounded strictly:
      • maximumPoolSize: 60 connections per container pod.
      • connectionTimeout: 2000 ms.
      • idleTimeout: 30000 ms.
    • Prevents database connection exhaustion during traffic surges across 40 container replicas.

    Invariants and Contracts

    Zero Framework Leakage Invariant [INV-SVCARCH-01]
      Classes within the domain core package must contain zero third-party framework imports.
      Spring, Hibernate, Jackson, and AWS SDK annotations are strictly barred from domain entities.
    
    Mandatory Port Abstraction Invariant [INV-SVCARCH-02]
      External adapters must interact with the domain model exclusively via Port interfaces.
      Inbound controllers must never bypass ports to call repositories or database drivers directly.
    
    Atomic Transactional Outbox Mandate [INV-SVCARCH-03]
      Domain state changes and domain events must be persisted within the same local ACID transaction.
      Emitting asynchronous events directly to external message brokers before database commit is prohibited.
    

    Explicit Unknowns

    • Debezium CDC connector replication lag during massive 4,200 TPS batch commercial card generation bursts (G-1).
    • Hardware Security Module (HSM) PKCS#11 driver thread safety when fanned out across 16 parallel JVM worker threads (G-2).

    Traceability

    ClaimClassificationSourceFreshness
    4,200 card provisioning requests/secprovidedVolumetric traffic profileCurrent
    Latency budget p99 <= 45 msprovidedCard Systems SLACurrent
    Incident REG-4819 entity dirty-check corruptionprovidedForensic incident recordHistorical
    Hexagonal Architecture (Ports & Adapters) standarddecidedDavid O'Reilly & Elena Rostova2026-09-15
    Zero framework imports in domain coredecidedArchitectural invariant INV-SVCARCH-012026-09-15
    Transactional outbox pattern for event publishingdecidedArchitectural invariant INV-SVCARCH-032026-09-15

    Verification

    No validator was supplied, so no command was run.

    Reviewer self-check against backend service architecture standards:

    • Boundary Cleanliness: PASS. Domain core completely isolated from Spring and Hibernate.
    • Port Discipline: PASS. All interactions mediated through clean Inbound and Outbound port interfaces.
    • Outbox Atomicity: PASS. State mutations and outbox records committed in single ACID transactions.
    • Markdown Hygiene: PASS. Native Markdown syntax strictly adheres to rule_markdown.md.

    Open Decisions

    • DEC-SVCARCH-01: Elena Rostova to determine whether ArchUnit tests should run in pre-commit git hooks to automatically block any commits introducing framework annotations into domain packages (Owner: Elena Rostova).

    Next steps

    1. Marcus Vance provisions HikariCP connection pool configurations and PostgreSQL outbox schemas.
    2. Engineering team implements ArchUnit architectural fitness tests enforcing Hexagonal import boundaries.
    3. Conduct staging performance drill validating 4,200 TPS throughput and asserting sub-45ms p99 response times.

    backend-microservice-architecture-archit.pdf

    PDF · document

    Generated

    Example file from a real run - the skill writes it into your workspace.

    Connects securely to your tools. The creator never sees your data.

    What you get

    Design hexagonal architecture boundaries for backend modules.Define explicit transaction and concurrency boundaries.Map service error taxonomies to delivery mechanism responses.Decouple domain logic from persistence and API adapters.Coordinate event publication with state changes via outbox.

    About this skill

    What it does

    This skill owns the application-architecture decision for realizing an accepted capability as a backend runtime boundary. It defines service/module responsibility, use-case orchestration, ports and adapters, state and transaction ownership, concurrency/effect semantics, dependency isolation, and operational handoffs while preserving canonical domain authority.

    Use it when

    • Assigning one accepted capability/use-case portfolio to a backend module, worker, or independently operated service
    • Deciding whether a new deployable is justified by ownership, lifecycle, isolation, scaling, release, or failure evidence
    • Defining inbound use-case ports, application-service orchestration, outbound dependency ports, and adapter ownership
    • Locating transaction boundaries, consistency expectations, command deduplication, optimistic/pessimistic concurrency, and lost-update behavior
    • Coordinating persistence with event/message/effect publication without claiming distributed atomicity
    • Defining sync versus async dependencies, deadlines, cancellation, retries, backpressure, overload, degradation, and uncertain outcomes

    For example: “Our subscription service has 90 endpoints, business rules in the controllers, and a bug where cancelling sometimes leaves the billing record active.”

    What you get

    • architecture/backend-service-architect/README.md
    • architecture/backend-service-architect/00-overview/backend-service-architect-overview.md
    • architecture/backend-service-architect/verification/fitness-self-check.md

    Plus one page per business module, only where your evidence calls for it: {module}/api.md, {module}/events.md, {module}/clients.md, {module}/data.md, {module}/security.md, {module}/observability.md, {module}/resilience.md.

    All paths are relative to the output folder you choose.

    What it will not do

    Do not use for domain modeling, API contract design, database schema, event topology, gateway/BFF, framework/package layout, infrastructure sizing, performance tuning, or implementing one controller/service class.

    How it works

    1. Check the scope is one service's internals.
    2. Separate the domain logic from the delivery and persistence mechanisms.
    3. Define the transaction boundary explicitly.
    4. Fix the error taxonomy the service exposes and how it maps outward.
    5. State the concurrency assumptions.
    6. Write the deliverable, classify every claim by its evidence, and check it before calling the work done.

    What's in the package

    Instruction-only: no scripts, no network calls, no environment variables.

    • LICENSE.txt
    • SKILL.md
    • agents/openai.yaml
    • assets/output-template-artifact.md
    • assets/output-template-contract.md
    • assets/output-template-domain.md
    • assets/output-template-fitness.md
    • assets/output-template-mechanism.md
    • references/domain-rules.md
    • references/operating-rules.md
    • references/output-contract.md

    How to install

    Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.

    ~30 seconds
    1. 1

      Download the ZIP

      Free skills download straight away. Paid skills unlock right after purchase.

    2. 2

      Unzip into your skills folder

      Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.

    3. 3

      Ask your agent to use it

      Restart the agent if it was already running. It picks the skill up automatically - no config needed.

    Skills folder by agent

    Click the path to copy it. Create the folder if it does not exist yet.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean 12 days ago

    • Passed all security checks, Safe to install

    Listed12 days ago

    What's inside

    Frequently Asked Questions