Set up a consistent API contract, reusable request/response helpers, and your first e-commerce endpoint. You’ll learn Remix’s resource route model (API endpoints implemented via loader/action) and establish the foundation that every other endpoint will reuse.
Overview
Syllabus
- Unit 1: Building Remix Backend Foundations
- Observe the standard API response envelope in a Remix resource route
- Implement ApiSuccess/ApiError and the ApiResponse union
- Implement success(), error(), and parseJson() helpers
- Return consistent envelopes from /api/debug/\* and /api/products
- Unit 2: Validating Domain Models
- Observe query param validation and the product domain model
- Write isUUID, isString, isInt, and isEnum
- Implement parseOptionalIntParam() with bounds and good messages
- Validate query/page/pageSize and return an empty Product[] envelope
- Unit 3: Wiring PostgreSQL Products
- Observe route -> service -> repo -> database wiring
- Create the pool singleton, query helper, and transaction helper
- Implement isPostgresError/mapPostgresError and ok()/fail()
- Implement searchProducts, listProducts, and the /api/products loader