APIs - Refactoring to Patterns
summary
Starts from a single messy Next.js API that uses Mongoose and MongoDB and sends events with KafkaJS and refactors it into clear pieces: a ports and adapters boundary, an anti-corruption layer for validation, a repository pattern replacing direct Mongoose calls, and factories/singleton creation so tests can inject mocks. Live demos show moving code from route into MeetingValidator, MeetingRepository, Kafka adapter and a Factory, reducing integration tests to one end‑to‑end and enabling fast unit tests.
AI-written summary · about
chapters (26)
- 0:00intro
- 0:22preamble
- 1:01about gil
- 1:35code that works over and over again
- 2:12when you need to fix bugs in your microservice.again.
- 2:42refactor the code / use it as a trap
- 3:07we want the code to be...
- 6:15cohesion
- 6:46separation of concerns
- 6:56loose coupling
- 8:36entities
- 9:02architecture
- 9:40the api
- 10:11problems
- 11:35demo
- 16:43ports and adapters
- 18:24anti-corruption layer
- 19:50demo
- 21:03repository
- 24:04adapter win
- 25:03demo
- 28:07welcome to the factory
- 28:49singleton
- 29:26demo
- 32:43summaries
- 36:30any questions?
related talks
38mAPI Mastery: from the Design to Development
48mRefactoring of REST API
38mEvolving your APIs, a Pragmatic Approach
16mAPI Integration with JS: Scalable, and Future-Ready Systems
27mBuilding Great Web APIs
07h 08mAsyncAPI online conference | #asyncapiconf
20mPotential of API integrations, common traps and advices
35mAPI-First! Contract-First! Make API development great again!
