> >-

Source: https://agentmarket.fluxapay.xyz/browse-skills/saas-scaling-architecture

fragile\_frogs

# fragile\_frogs/saas-scaling-architecture

\>-

Free

4 uses

Published 1mo ago

api-integrationcode-generationdeploymentdevopsweb-scraping

Screenshots, demos, and visual examples of what this skill can do.

No showcase media available

Full documentation from the skill's SKILL.md file, including usage instructions and API details.

# SaaS Scaling & Microservices Architecture

This skill helps design and implement the backend architecture of a multi-tenant SaaS product as it grows — deciding when to scale vertically vs horizontally, when (and whether) to split a monolith into microservices, how to draw service boundaries, and how to actually implement the result.

## Why this needs a deliberate process

Architecture decisions here are expensive to reverse. Splitting too early creates distributed-systems overhead (network calls, partial failures, data consistency problems) before a team has the operational maturity to handle it. Splitting too late means the monolith becomes a bottleneck for both scaling and team velocity. The goal of this skill is to make the tradeoff explicit and match the architecture to the SaaS product's actual current stage — not to reflexively recommend microservices because they're fashionable, and not to over-engineer a scaling solution nobody needs yet.

Treat this as a genuine engineering tradeoff to reason through with the user, not a checklist to blindly apply. Ask about their current scale (users, request volume, team size), pain points, and constraints before recommending a direction.

## Agent-agnostic by design

Everything this skill produces — reference docs, scripts, templates — is plain Markdown, shell, YAML, and Dockerfiles. Nothing here depends on a specific coding agent's tool-calling format. That means:

- Any AI coding agent that can read files and run shell commands can follow this skill's guidance directly.
- The `references/` files can be copied as-is into another tool's context system (a `.cursorrules` file, a Windsurf rules file, an `AGENTS.md`, a Copilot custom instructions file, etc.) since they contain no Claude-specific syntax.
- The `scripts/` are POSIX shell + Docker, runnable from any terminal, not tied to any particular agent's execution environment.

If the user says they'll use this with a different agent or tool, tell them they can hand over the `references/` folder or the whole skill folder as-is — no adaptation needed.

## Step 1: Establish the current state

Before recommending anything, get a quick read on:

1. **Scale today**: rough request volume, data volume, tenant count, peak vs average load.
2. **Team**: how many engineers, how many teams, how autonomously they currently ship.
3. **Pain point**: is it CPU/memory limits (compute-bound), database contention, deploy friction, one team blocking another, or something else? The right fix depends heavily on which one it is.
4. **Current architecture**: monolith, modular monolith, already-partial microservices, serverless, etc.
5. **Multi-tenancy model already in use** (if any): shared schema, schema-per-tenant, database-per-tenant, or none yet.

Don't skip this even if the user jumps straight to "let's do microservices" — a surprising number of scaling problems are solved by vertical scaling, caching, read replicas, or better indexing, at a fraction of the cost of a service split. Say so plainly if that's what the evidence points to.

## Step 2: Scaling strategy decision

Read `references/scaling-strategies.md` for the full decision framework. In short:

- **Vertical scaling first** (bigger instance, more CPU/RAM, better DB tier) is almost always the right first move — it's cheap, fast, and reversible. Recommend it when the bottleneck is compute/memory-bound and load is still within a single large instance's headroom.
- **Horizontal scaling** (more instances behind a load balancer) is the next step once vertical scaling hits diminishing returns or a hardware ceiling, and the app is stateless enough to support it.
- **Microservices** are an organizational and deployment-boundary tool as much as a scaling tool. Reach for them when the real constraint is team autonomy, independent deploy cadence, or genuinely different scaling profiles between components (e.g., a billing service and a real-time notifications service have very different load shapes) — not just "we have a lot of traffic." A single well-tuned monolith, horizontally scaled, can handle enormous load.

State which of these the evidence points to, and why, before writing any code or diagrams.

## Step 3: If splitting into microservices — draw service boundaries

Read `references/microservices-patterns.md` for decomposition strategies (by business capability/bounded context, by data ownership, by team ownership, by scaling profile) and communication patterns (synchronous REST/gRPC vs asynchronous events/queues, API gateway placement, service discovery).

The single most important rule: **draw boundaries around data ownership, not around technical layers.** A "user service," "billing service," and "notifications service" (each owning its own data) will hold up far better than a "database service," "API service," and "frontend service" split by technical tier. If the user proposes boundaries that cut across shared data, flag it — that's the #1 cause of painful microservices migrations.

## Step 4: Multi-tenancy model

If the SaaS product is (or will be) multi-tenant, read `references/multi-tenancy.md` before deciding on service or database boundaries — the tenancy model affects almost everything downstream (which data can live in a shared table vs needs isolation, how auth/authorization propagates across services, how a "noisy neighbor" tenant is contained). Pick this early; retrofitting tenant isolation after services are built is expensive.

## Step 5: Implementation

Read `references/implementation-checklist.md` for the concrete build-out sequence (API gateway, service scaffolding, inter-service auth, observability, data migration strategy, and a recommended order of operations that avoids a "big bang" cutover).

Use `scripts/scaffold-service.sh` to generate a consistent skeleton for a new service (Dockerfile, health check endpoint, structured logging setup, config-from-env pattern) so every service in the system follows the same conventions regardless of language. It's intentionally minimal and language-agnostic — read the script's comments and adapt the placeholder sections to the user's actual language/framework rather than treating it as a finished template.

## Step 6: Migration strategy (if evolving from an existing monolith)

Never propose a "big bang" rewrite. Recommend the strangler-fig pattern by default:

1. Put a routing layer (API gateway or reverse proxy) in front of the monolith.
2. Extract one well-bounded capability at a time into its own service; route its traffic through the gateway to the new service while everything else still hits the monolith.
3. Keep the monolith and new service(s) talking to the same source of truth during transition (via an anti-corruption layer or data sync) until the extracted service fully owns its data.
4. Repeat, capability by capability, retiring monolith code as each piece is fully migrated.

This keeps the system shippable and reversible at every step, which matters far more than migration speed.

## Communicating the recommendation

Whatever direction you land on, be explicit with the user about:

- What problem this actually solves for them (be specific: "this removes the DB write bottleneck" not "this improves scalability").
- What it costs them (operational complexity, new failure modes, slower initial development).
- What you'd recommend they NOT do yet, and why — premature complexity is a real cost, and saying "you don't need this yet" is often the most valuable thing this skill can produce.

Integrate

Run this command in your terminal to install the skill:

`npx -y skills add https://agentmarket.fluxapay.xyz -s saas-scaling-architecture`

Details

Published1mo ago

Creator@fragile\_frogs

Uses4

PriceFree

references

implementation-checklist.md

microservices-patterns.md

multi-tenancy.md

scaling-strategies.md

scripts

scaffold-service.sh

SKILL.md
