Project Blueprint
Anything retrofitted costs five to fifty times what it costs to build in. The
order below is not stylistic — it is ordered by the cost of getting it wrong
later.
Never start typing code from a one-line brief. Ten minutes of Phase 1 saves
weeks. But do not interrogate either: ask the questions whose answers change the
architecture, assume sensible defaults for the rest, and state the assumptions.
Phase 1 — Understand what is actually being built
Five questions. Ask only the ones you cannot infer from the brief.
- Who uses it, and how many? Ten internal users and ten million consumers
are different systems. If unknown, design for 10k and note the first
bottleneck.
- What is the core transaction? The one thing that must never be wrong.
Everything else is supporting cast.
- What data does it hold? Specifically: does it hold personal data,
payment data, or health/financial records? Each adds non-optional
obligations.
- What must it integrate with? Existing systems, auth providers, payment
rails, data sources.
- What are the constraints? Team size and skills, budget, deadline,
regulatory jurisdiction, self-host vs cloud.
Then write, in five lines: what it is, who it serves, the core transaction,
the data classification, and the constraint that dominates. Confirm this before
building. Getting the brief wrong is the only unrecoverable error here.
Phase 2 — Choose the stack, and justify it
See references/stack-selection.md for the decision framework.
The default answer is boring, well-supported technology the team already
knows. Novelty is a cost paid in hiring, debugging and documentation for the
life of the system. Choose novelty only where it is the differentiator.
Decide and record: language and runtime, framework, database, hosting, auth
strategy, CI, monitoring. Each with a one-line reason. These become the first
ADRs — see templates/adr.md.
Refuse to over-engineer. No Kubernetes, no microservices, no event sourcing,
no CQRS, no service mesh for a product with no users. A modular monolith on a
managed platform with a managed Postgres is the correct answer for the
overwhelming majority of new products, and it is the answer that stays cheap to
change.
Phase 3 — Model the data first
The schema outlives the code, the framework, and usually the company. Load
database-engineering and design it properly before writing a handler.
- Entities, relationships, cardinality.
- Keys: prefer UUIDv7 or ULID for public identifiers — sequential integers leak
volume and invite enumeration.
- Constraints in the database:
NOT NULL, UNIQUE, FOREIGN KEY with an
explicit ON DELETE, CHECK for invariants.
- Money as integer minor units or decimal, never float. Timestamps in UTC with
timezone-aware types.
- Tenancy decided now. Shared-schema with a tenant column, schema-per-tenant,
or database-per-tenant. Moving between them later is a migration project.
- Personal data marked now. Every column holding personal data gets flagged
in the model. This becomes the data inventory that
privacy-compliance and the
deletion pipeline both consume. Deciding this at the end means auditing every
table by hand.
- Retention: for each table, when does a row die?
Phase 4 — The security baseline, before the first feature
Load security-hardening. These go into the skeleton, not the backlog:
- Config from environment, validated at boot, failing loudly. Never a committed
secret;
.env in .gitignore from commit one; .env.example documenting
every key.
- Auth chosen and wired: provider, session or token model, refresh strategy,
logout invalidation, password reset.
- An authorization layer that is impossible to forget. Deny by default at the
router; every route explicitly declares its policy. This single decision
prevents the most common critical vulnerability in shipped products.
- Input validation with one schema library at the boundary.
- Security headers and a CSP from day one — retrofitting a CSP onto a built app
is genuinely painful; starting with one costs nothing.
- Rate limiting on auth and mutation.
- Dependency scanning enabled in the repository from the first commit.
Phase 5 — Scaffold in this order
1. Repo + .gitignore + README + LICENSE + .editorconfig
2. Language toolchain, formatter, linter, strict type checking
3. Config module (validated env) + secrets handling
4. Database + first migration + seed script
5. Auth + authorization middleware
6. One vertical slice, end to end: route -> validation -> authz -> domain
-> persistence -> response -> test
7. CI: install, lint, type check, test, build, dependency audit — blocking
8. Error tracking + structured logging + health endpoint
9. Deploy pipeline to a real environment (staging), with rollback
10. Then, and only then, feature work
Step 6 is the load-bearing step. One complete vertical slice — with its test,
its authorization check, its error path, its log line — establishes the pattern
every subsequent feature copies. Get it right and quality scales for free; get it
wrong and every feature inherits the flaw.
Step 9 before feature work. A product that has never deployed does not know
what it costs to deploy. Ship the skeleton to staging on day one.
Phase 6 — The public surface, if there is one
For anything with a public website, load web-presence-audit and
accessibility-audit. Build these in, do not bolt them on:
- Per-route metadata: unique title, unique meta description, canonical URL,
Open Graph and Twitter card image.
robots.txt, a generated sitemap.xml, and a custom 404 that helps rather
than dead-ends.
- Semantic HTML, keyboard operability, visible focus, contrast, alt text — a
component library built accessibly is free; an inaccessible one is a rewrite.
- Structured data (
Organization, WebSite, LocalBusiness if there is a
physical location, FAQPage, BreadcrumbList).
- Sticky mobile CTA, internal linking structure, trust pages.
Phase 7 — The legal and trust surface
Load privacy-compliance. If the product touches personal data — and almost
every product does, an email address is personal data — these ship with v1:
- A privacy policy generated from the actual data inventory, naming every real
processor.
- A cookie consent mechanism that gates scripts before consent, with
rejecting as easy as accepting.
- A self-service data export and deletion path, built as an endpoint and a
UI, wired to a job that propagates to every store and processor.
- Terms of service, a security contact, and a defined support response commitment.
Building deletion into the data model in week one is a day of work. Retrofitting
it across forty tables and six processors is a quarter.
Phase 8 — Prove it works
Load testing-strategy and observability-slo.
- The vertical slice's test is the template: unit tests for rules, integration
tests across the real database, E2E for the critical journeys.
- CI blocks merge on red. No exceptions culture from day one, because it never
gets established later.
- Structured logs with a correlation id, error tracking wired to a real
destination, one dashboard, and one alert that pages a human.
- A defined SLO for the core transaction, even if it is a guess to start.
Phase 9 — Document the decisions
Load engineering-standards.
- README: what it is, how to run it in one command, how to test, how to deploy,
where the docs are.
- ADRs for every one-way door from Phase 2 and 3.
- A runbook for the three most likely failures.
CONTRIBUTING.md if anyone else will ever touch it.
Working with the user
- Show the plan before building it. A short architecture summary, then
build. Do not disappear for twenty tool calls and return with a finished repo
nobody agreed to.
- Build incrementally and verifiably. Each phase ends in something runnable.
- Explain the expensive choices. The user should understand why UUIDs, why
this database, why deletion is being built now — those are the choices they
will be asked to defend later.
- Push back on scope, not on quality. If the deadline is tight, cut features.
Never cut the security baseline, the deletion path, or the tests for the core
transaction. Say this plainly if asked to.
References and templates
references/stack-selection.md — how to choose, with defaults per product type
references/architecture-patterns.md — modular monolith, when to split, and when not to
references/scaffold-checklist.md — the full day-one checklist, per stack
references/product-type-blueprints.md — SaaS, marketplace, internal tool, API, mobile, content site
templates/adr.md — architecture decision record
templates/readme-skeleton.md — the README that gets someone running in 15 minutes
templates/env-example.md — config contract conventions
1---2name: project-blueprint3description: Architect, scaffold and guide the construction of a new project to senior professional standards — requirements, stack selection, architecture, data model, security baseline, CI/CD, testing, observability, legal and SEO surface — built in the right order so nothing expensive has to be retrofitted. Use when the user says "build me a", "start a new project", "create an app", "scaffold", "set up a new repo", "I want to build", "help me plan a system", "design the architecture", "what stack should I use", "greenfield", "MVP", "from scratch", "rewrite this properly" or describes a product they want to exist. By Devleck.4license: MIT5---67# Project Blueprint89Anything retrofitted costs five to fifty times what it costs to build in. The10order below is not stylistic — it is ordered by the cost of getting it wrong11later.1213**Never start typing code from a one-line brief.** Ten minutes of Phase 1 saves14weeks. But do not interrogate either: ask the questions whose answers change the15architecture, assume sensible defaults for the rest, and state the assumptions.1617---1819## Phase 1 — Understand what is actually being built2021Five questions. Ask only the ones you cannot infer from the brief.22231. **Who uses it, and how many?** Ten internal users and ten million consumers24 are different systems. If unknown, design for 10k and note the first25 bottleneck.262. **What is the core transaction?** The one thing that must never be wrong.27 Everything else is supporting cast.283. **What data does it hold?** Specifically: does it hold **personal data**,29 **payment data**, or **health/financial records**? Each adds non-optional30 obligations.314. **What must it integrate with?** Existing systems, auth providers, payment32 rails, data sources.335. **What are the constraints?** Team size and skills, budget, deadline,34 regulatory jurisdiction, self-host vs cloud.3536Then write, in five lines: what it is, who it serves, the core transaction,37the data classification, and the constraint that dominates. Confirm this before38building. Getting the brief wrong is the only unrecoverable error here.3940## Phase 2 — Choose the stack, and justify it4142See `references/stack-selection.md` for the decision framework.4344The default answer is **boring, well-supported technology the team already45knows**. Novelty is a cost paid in hiring, debugging and documentation for the46life of the system. Choose novelty only where it is the differentiator.4748Decide and record: language and runtime, framework, database, hosting, auth49strategy, CI, monitoring. Each with a one-line reason. These become the first50ADRs — see `templates/adr.md`.5152**Refuse to over-engineer.** No Kubernetes, no microservices, no event sourcing,53no CQRS, no service mesh for a product with no users. A modular monolith on a54managed platform with a managed Postgres is the correct answer for the55overwhelming majority of new products, and it is the answer that stays cheap to56change.5758## Phase 3 — Model the data first5960The schema outlives the code, the framework, and usually the company. Load61`database-engineering` and design it properly before writing a handler.6263- Entities, relationships, cardinality.64- Keys: prefer UUIDv7 or ULID for public identifiers — sequential integers leak65 volume and invite enumeration.66- Constraints in the database: `NOT NULL`, `UNIQUE`, `FOREIGN KEY` with an67 explicit `ON DELETE`, `CHECK` for invariants.68- Money as integer minor units or decimal, never float. Timestamps in UTC with69 timezone-aware types.70- **Tenancy decided now.** Shared-schema with a tenant column, schema-per-tenant,71 or database-per-tenant. Moving between them later is a migration project.72- **Personal data marked now.** Every column holding personal data gets flagged73 in the model. This becomes the data inventory that `privacy-compliance` and the74 deletion pipeline both consume. Deciding this at the end means auditing every75 table by hand.76- Retention: for each table, when does a row die?7778## Phase 4 — The security baseline, before the first feature7980Load `security-hardening`. These go into the skeleton, not the backlog:8182- Config from environment, validated at boot, failing loudly. Never a committed83 secret; `.env` in `.gitignore` from commit one; `.env.example` documenting84 every key.85- Auth chosen and wired: provider, session or token model, refresh strategy,86 logout invalidation, password reset.87- **An authorization layer that is impossible to forget.** Deny by default at the88 router; every route explicitly declares its policy. This single decision89 prevents the most common critical vulnerability in shipped products.90- Input validation with one schema library at the boundary.91- Security headers and a CSP from day one — retrofitting a CSP onto a built app92 is genuinely painful; starting with one costs nothing.93- Rate limiting on auth and mutation.94- Dependency scanning enabled in the repository from the first commit.9596## Phase 5 — Scaffold in this order9798```991. Repo + .gitignore + README + LICENSE + .editorconfig1002. Language toolchain, formatter, linter, strict type checking1013. Config module (validated env) + secrets handling1024. Database + first migration + seed script1035. Auth + authorization middleware1046. One vertical slice, end to end: route -> validation -> authz -> domain105 -> persistence -> response -> test1067. CI: install, lint, type check, test, build, dependency audit — blocking1078. Error tracking + structured logging + health endpoint1089. Deploy pipeline to a real environment (staging), with rollback10910. Then, and only then, feature work110```111112**Step 6 is the load-bearing step.** One complete vertical slice — with its test,113its authorization check, its error path, its log line — establishes the pattern114every subsequent feature copies. Get it right and quality scales for free; get it115wrong and every feature inherits the flaw.116117**Step 9 before feature work.** A product that has never deployed does not know118what it costs to deploy. Ship the skeleton to staging on day one.119120## Phase 6 — The public surface, if there is one121122For anything with a public website, load `web-presence-audit` and123`accessibility-audit`. Build these in, do not bolt them on:124125- Per-route metadata: unique title, unique meta description, canonical URL,126 Open Graph and Twitter card image.127- `robots.txt`, a generated `sitemap.xml`, and a custom 404 that helps rather128 than dead-ends.129- Semantic HTML, keyboard operability, visible focus, contrast, alt text — a130 component library built accessibly is free; an inaccessible one is a rewrite.131- Structured data (`Organization`, `WebSite`, `LocalBusiness` if there is a132 physical location, `FAQPage`, `BreadcrumbList`).133- Sticky mobile CTA, internal linking structure, trust pages.134135## Phase 7 — The legal and trust surface136137Load `privacy-compliance`. If the product touches personal data — and almost138every product does, an email address is personal data — these ship with v1:139140- A privacy policy generated from the actual data inventory, naming every real141 processor.142- A cookie consent mechanism that **gates scripts before consent**, with143 rejecting as easy as accepting.144- A **self-service data export and deletion path**, built as an endpoint and a145 UI, wired to a job that propagates to every store and processor.146- Terms of service, a security contact, and a defined support response commitment.147148Building deletion into the data model in week one is a day of work. Retrofitting149it across forty tables and six processors is a quarter.150151## Phase 8 — Prove it works152153Load `testing-strategy` and `observability-slo`.154155- The vertical slice's test is the template: unit tests for rules, integration156 tests across the real database, E2E for the critical journeys.157- CI blocks merge on red. No exceptions culture from day one, because it never158 gets established later.159- Structured logs with a correlation id, error tracking wired to a real160 destination, one dashboard, and one alert that pages a human.161- A defined SLO for the core transaction, even if it is a guess to start.162163## Phase 9 — Document the decisions164165Load `engineering-standards`.166167- README: what it is, how to run it in one command, how to test, how to deploy,168 where the docs are.169- ADRs for every one-way door from Phase 2 and 3.170- A runbook for the three most likely failures.171- `CONTRIBUTING.md` if anyone else will ever touch it.172173---174175## Working with the user176177- **Show the plan before building it.** A short architecture summary, then178 build. Do not disappear for twenty tool calls and return with a finished repo179 nobody agreed to.180- **Build incrementally and verifiably.** Each phase ends in something runnable.181- **Explain the expensive choices.** The user should understand why UUIDs, why182 this database, why deletion is being built now — those are the choices they183 will be asked to defend later.184- **Push back on scope, not on quality.** If the deadline is tight, cut features.185 Never cut the security baseline, the deletion path, or the tests for the core186 transaction. Say this plainly if asked to.187188## References and templates189190- `references/stack-selection.md` — how to choose, with defaults per product type191- `references/architecture-patterns.md` — modular monolith, when to split, and when not to192- `references/scaffold-checklist.md` — the full day-one checklist, per stack193- `references/product-type-blueprints.md` — SaaS, marketplace, internal tool, API, mobile, content site194- `templates/adr.md` — architecture decision record195- `templates/readme-skeleton.md` — the README that gets someone running in 15 minutes196- `templates/env-example.md` — config contract conventions