Back to Learning Library
PROJECTIntermediate 4 hours5 steps

Build a small API

Design an API that is understandable, testable, and immediately useful to another developer.

TARGET PROOF OF WORK DELIVERABLE:

A documented, validated TypeScript API contract with mock data generators and test suites.

STEP 01 OF 05

Define the resource contract

Model your domain entity with strict TypeScript types and Zod schemas. Separate create, update, and response shapes.

EXPECTED STEP ARTIFACT

Zod schema defining entity properties, optional fields, and string constraints.

CHECKPOINT VERIFICATION
Action Required

Write your entity schema and export the inferred TypeScript type.

COMMAND / IMPLEMENTATION
import { z } from "zod"
export const ItemSchema = z.object({ id: z.string().uuid(), title: z.string().min(3) })
STEP REFLECTION

What is the most likely invalid input a malicious user might send?

Discussion on Step 01 (0)
Ask questions or share tips with fellow builders
Posting as Curious Builder (Product Engineer)

No comments yet on this step. Be the first to share an insight!