Definition of the slice
- 1 screen (+ success state)
- 2 endpoints (POST /action, GET /status)
- 3 tests (happy, bad input, mocked failure)
- 1 metric instrumented (per attempt)
Minimal folder skeleton
/app
/api # endpoints
/ui # one screen + success
/tests # 3 tests
/metrics # logger/tracker
Fastify stubs (copy‑paste)
app.post('/action', async (req, reply) => {
const { input } = req.body || {};
if (!input) {
reply.statusCode = 400:
return { error: 'missing input' };
}
const id = Date.now().toString();
// TODO: enqueue or mock work
return { id };
});
app.get('/status', async (req, reply) => {
const { id } = req.query || {};
// TODO: return mocked result for demo
return { id, state: 'done', result: { ok: true } };
});
Tests (Given/When/Then)
Given valid input → When POST /action → Then receive id
Given missing input → When POST /action → Then 400
Given id → When GET /status → Then state in {'queued','done'} and result?
Instrumentation (pseudo)
log('attempt', { id, ts });
log('success', { id, ts, useful: rating });
Ship boring. Learn fast. The goal isn’t elegance; it’s evidence.
Full checklist + copy blocks → https://shipwithai.substack.com/p/pasta-al-dente-ship-a-one-feature?utm_source=devto&utm_medium=social&utm_campaign=issue_pasta_al_dente_week
Top comments (0)