Propose a Service Boundary for a Module You're Considering Extracting
I'm considering extracting part of a codebase into a separate service. Help me decide whether and where the boundary should be, before any code moves. Inputs I'll provide: - The module's public functions/classes and who calls them (paste call sites or a dependency listing) - The data it reads and writes, including tables or collections shared with other modules - Its change history: what tends to change together, and what changes independently - The reason I'm considering extraction (scaling, team ownership, deploy cadence, other) Please produce: 1. **Coupling map**: list every place the module is entangled with the rest of the code (shared tables, shared in-memory state, synchronous call chains, shared transactions). For each, say how hard it would be to cut and why. 2. **Candidate boundary**: propose where the line should go, and name the 3-5 operations that would become the service's API. Flag any that would become chatty (called in loops or many times per request). 3. **Transaction and consistency impact**: identify anywhere a single database transaction currently spans the boundary, and what would replace it (eventual consistency, a saga, a redesign). 4. **Does the stated reason hold?** Check whether extraction actually addresses my reason, or whether a cheaper step (internal module boundary, separate deploy of the same code, a queue) would get most of the benefit. 5. **Cost I'd be taking on**: new failure modes, latency, versioning of the API, operational burden, local development complexity. 6. **A first step that is reversible**: the smallest change that enforces the boundary inside the monolith first. Rules: do not assume a microservice is the goal. If the evidence suggests keeping it in place, say so and explain what you'd tidy instead. Mark anything you are inferring rather than reading from what I provided.
Sign in to upvote this prompt.