Refactor the backend for production-style reliability. Replace manual validation with Zod, standardize responses, and introduce a repository pattern. Add in-memory and file-based persistence, enabling flexible data storage while keeping the API stable and predictable.
Overview
Syllabus
- Unit 1: Validation and Response Helpers
- Creating Task Zod Schemas
- Implementing JSON Response Helpers with Meta
- Wiring Zod & Response Helpers into Task Routes
- Unit 2: Repository Pattern Basics
- Defining the TaskRepository Interface
- Implementing the In-Memory Map Task Repository
- Refactoring the Service Layer to Use TaskRepository
- Unit 3: File Persistence with JSON
- Implementing a File-Backed Task Repository
- Switching the Service Layer to the File Repository
- Creating and Seeding data/tasks.json