Skip to content
groundworkv0.2

How software fits together

The map of a modern app, showing client, server, database and infrastructure, and how a request flows through them.

7 min read · Last reviewed November 20, 2026

How software fits together

Almost every app has the same core shape. The rest of Groundwork zooms in on one box of this map at a time.

You'll be able to#

  • Name each layer of a typical web app and what it's responsible for
  • Trace a request from a button click to the database and back
  • Tell an which layer a change belongs in

The mental model#

 Browser / Mobile app  ──HTTP──▶  API server  ──SQL──▶  Database
   (frontend / client)            (backend)              (data)
          │                           │
          ▼                           ▼
      CDN (static files)     Third-party services (email, payments, AI)

The life of a click: The user presses "Save". The frontend sends an HTTP request. resolves the domain name. The request reaches the server, which checks who you are (auth), validates the input, writes to the database, and returns JSON. The frontend then updates the screen.

Key concepts#

  • Client / frontend: The code that runs on the user's device. It's untrusted, because users can change anything that runs there.
  • Server / backend: The code that runs on machines you control. This is where business rules and secrets live.
  • Database: Durable storage. It's the .
  • : The contract between client and server. See Building an API.
  • Static vs dynamic: Static files (HTML, CSS, JS, images) are the same for everyone and can be cached on a . Dynamic responses depend on the user or the data.
  • Rendering modes: Pages can be built in the browser (CSR), on the server for each request (SSR), or once at build time (SSG). Modern frameworks mix all three.
  • Monolith vs services: A monolith is one deployable app. Microservices are many apps that talk over a network. Start with a monolith.
  • : You deploy functions, and the platform runs them on demand. There are no servers for you to manage, but cold starts and execution-time limits apply.

Decisions you make (not the agent)#

Your call, not the agent's

DecisionSensible defaultChoose otherwise when…
ArchitectureMonolith (one full-stack app)Separate teams or very different scaling needs
Full-stack framework vs separate frontend + backendFull-stack framework (Next.js, SvelteKit, Rails, Django, Phoenix)Multiple clients (web + mobile) share one API
Where logic livesServer. Never trust the clientPure UI behaviour

What good output looks like#

  • The explanation names the layers that actually exist in this repo, with file paths, not a generic diagram
  • It traces one real action file by file, and says where input is validated and who is allowed to do what
  • It lists the external services the app calls and where their keys are used
  • It says what it could not determine instead of guessing

Red flags#

  • Business rules or permission checks done only in the frontend
  • Microservices proposed for an MVP
  • The database queried directly from browser code using a privileged key
  • Common agent mistakes: a price, limit or permission decided in browser code; the client sending a total or a "role" that the server trusts; a feature added in the wrong layer because the prompt didn't say which one

Worked example#

Task: Add a discount code field to the checkout page.

You prompt: "Add a discount code field to checkout." The agent adds the input and a small list of valid codes in the frontend, applies the percentage off in the browser, and sends the new total to the server, which saves it.

What a good result contains: the browser sends only the code; the server checks that the code is valid, works out the price itself, and returns the result; the database records which discount was applied; the browser just shows what the server said.

The wrong turn: the rule lives in the client. Anyone can read the list of codes in the page's JavaScript, and anyone can send a different total to the server, because the server saves whatever it is told.

How review catches it: trace the request. Ask what does the server receive, and what does it trust? The payload contains a total, which is the tell. Then re-prompt with the layer stated: the client sends the code, and the server validates it and computes the price.

Sample prompts#

Prompt
Explain the architecture of this repo as a diagram (ASCII or Mermaid): what runs
in the browser, what runs on the server, where data is stored, and what external
services are called. Then trace what happens, file by file, when a user <does X>.

Why it works: Use this first in any unfamiliar codebase, including one an agent generated for you.

Which layer does this belong in?#

Prompt
I want to <change>. Before writing code, tell me which layers it touches (browser, API server, database, third-party service), what changes in each, and which parts must be enforced on the server. Don't write code yet.

Why it works: Naming the layers first catches "it works, but in the wrong place" before it is built.

Audit for logic that only the client enforces#

Prompt
Audit this change for rules that run only in the browser. List every price, limit, permission or validation decided by client code, and say what the server does with each. Flag anything the server accepts from the client without checking.

Why it works: It targets the most common architecture mistake directly, and gives you a short list to verify.

Explain where each part lives#

Prompt
For the change you just made, list each part (UI, request, validation, storage, external call) with the layer it lives in and why that layer is right. Mark anything you put in the client that I should challenge.

Why it works: Explaining forces the agent to commit to a layer for each part. Check its answer against the actual diff.

Check your understanding#

Check your understanding

1/3Where should permission checks and business rules be enforced?
2/3A user presses "Save". Which describes what happens?
3/3What is the sensible default architecture for an MVP?

Checklist#

  • I can name the layers of my app and what each is responsible for
  • Business rules and permission checks run on the server
  • Secrets and privileged keys exist only on the server
  • It is one deployable app unless I have a concrete reason to split it
  • I can trace one request from the click to the database and back

Go deeper#