Nine spreads. Each has a picture, the idea, and the commands or code you'd use. It's language-neutral, with small examples in JavaScript, SQL, and shell.
"We scoped the smallest useful version, modeled the data, built the API and UI, tested it, shipped through CI, and watch it in production."
Use the tabs or the ← → keys to turn pages.
Most failed apps solved a problem nobody had. Write down who the user is, what they're trying to do, and how you'll know it works, before choosing any tools.
"What's the smallest thing a real user would pay for or use daily?"
Keep responsibilities apart: the client shows things, the server enforces rules, the database stores truth. Never trust the client for security checks.
| Piece | Job | Common picks |
|---|---|---|
| Client | UI, input | React, Vue, Swift, Kotlin |
| Server | logic, auth, API | Node, Python, Go, Java |
| Database | durable data | PostgreSQL, MySQL, SQLite |
| Cache | fast repeats | Redis |
| Queue/worker | slow jobs: emails, reports | BullMQ, Celery |
"Boring tech, a single deployable, and a clean boundary between the UI and the API."
List the things your app knows about, and how they relate. A relational database enforces those rules for you.
CREATE TABLE users ( id SERIAL PRIMARY KEY, email TEXT UNIQUE NOT NULL, pw_hash TEXT NOT NULL ); CREATE TABLE orders ( id SERIAL PRIMARY KEY, user_id INT NOT NULL REFERENCES users(id), created_at TIMESTAMPTZ DEFAULT now() ); CREATE INDEX ON orders (user_id); SELECT u.email, count(o.id) AS orders FROM users u LEFT JOIN orders o ON o.user_id = u.id GROUP BY u.email ORDER BY orders DESC;
"Constraints in the database, migrations in git, and an index on every foreign key I query by."
// Node + Express
const app = require('express')();
app.use(require('express').json());
app.post('/api/orders', requireAuth, async (req, res) => {
const { productId, qty } = req.body;
if (!Number.isInteger(qty) || qty < 1)
return res.status(400).json({ error: 'qty must be >= 1' });
const order = await db.createOrder(req.user.id, productId, qty);
res.status(201).json(order);
});
app.listen(3000);
$ curl -s -X POST localhost:3000/api/orders \
-H 'Authorization: Bearer $TOKEN' -H 'Content-Type: application/json' \
-d '{"productId":7,"qty":2}'
/v1/…, so you can change without breaking clients"Nouns in the path, verbs in the method, honest status codes, validated input."
// React
function TodoList() {
const [items, setItems] = useState([]);
const [status, setStatus] = useState('loading');
useEffect(() => {
fetch('/api/todos')
.then(r => r.ok ? r.json() : Promise.reject(r.status))
.then(d => { setItems(d); setStatus('ok'); })
.catch(() => setStatus('error'));
}, []);
if (status === 'loading') return <p>Loading…</p>;
if (status === 'error') return <p>Couldn't load. Retry?</p>;
if (!items.length) return <p>Nothing yet.</p>;
return <ul>{items.map(i => <li key={i.id}>{i.text}</li>)}</ul>;
}
"State lives in one place, the UI is a function of it, and every fetch handles loading and failure."
const bcrypt = require('bcrypt');
// signup: store only the hash
const pw_hash = await bcrypt.hash(password, 12);
// login: compare, then issue a session
const ok = await bcrypt.compare(password, user.pw_hash);
if (!ok) return res.status(401).json({ error: 'bad credentials' });
// authorization: is this order theirs?
if (order.user_id !== req.user.id) return res.sendStatus(403);
// SQL: parameters, never string concatenation
db.query('SELECT * FROM users WHERE email = $1', [email]);
.gitignore"Hashed passwords, HTTPS, parameterized queries, and an authorization check on every endpoint."
Tests let you change code without fear. They also document what the code is meant to do.
// total.test.js (Jest)
const { orderTotal } = require('./total');
test('adds line items in cents', () => {
expect(orderTotal([{ cents: 1200, qty: 2 }])).toBe(2400);
});
test('empty cart is zero', () => {
expect(orderTotal([])).toBe(0);
});
test('rejects negative quantity', () => {
expect(() => orderTotal([{ cents: 100, qty: -1 }])).toThrow();
});
$ npm test # run everything $ npm test -- --watch # rerun on save $ npm test -- --coverage # what's untested?
"The bug gets a failing test first, then the fix, so it stays fixed."
$ git switch -c feature/wishlist $ git add -A && git commit -m "Add wishlist endpoint" $ git push -u origin feature/wishlist # open a pull request, get a review, merge to main
name: ci
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 20 }
- run: npm ci
- run: npm run lint
- run: npm test
- run: npm run build"Trunk-based, short-lived branches, required checks on main, auto-deploy on green."
FROM node:20-slim WORKDIR /app COPY package*.json ./ RUN npm ci --omit=dev COPY . . EXPOSE 3000 USER node CMD ["node", "server.js"]
$ docker build -t myapp:1.0 . $ docker run -d -p 3000:3000 --env-file .env --name myapp myapp:1.0 $ docker logs -f myapp $ curl -f localhost:3000/health || echo "unhealthy"
"Immutable image, config from the environment, health checks, and a one-step rollback."