~/talk

APIs - Refactoring to Patterns

Talkat Conf42 JavaScript 2023 · on Thursday, 2023-11-16· [api-design, software-architecture]
slides:none on file

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

  1. 0:00intro
  2. 0:22preamble
  3. 1:01about gil
  4. 1:35code that works over and over again
  5. 2:12when you need to fix bugs in your microservice.again.
  6. 2:42refactor the code / use it as a trap
  7. 3:07we want the code to be...
  8. 6:15cohesion
  9. 6:46separation of concerns
  10. 6:56loose coupling
  11. 8:36entities
  12. 9:02architecture
  13. 9:40the api
  14. 10:11problems
  15. 11:35demo
  16. 16:43ports and adapters
  17. 18:24anti-corruption layer
  18. 19:50demo
  19. 21:03repository
  20. 24:04adapter win
  21. 25:03demo
  22. 28:07welcome to the factory
  23. 28:49singleton
  24. 29:26demo
  25. 32:43summaries
  26. 36:30any questions?
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.