Marmelab helped Arte migrate from a complex GraphQL-based backend-for-frontend to a simpler REST API architecture using Zod for runtime type validation. The original GraphQL layer, implemented in 2017 to aggregate data across multiple platforms, had evolved into a REST API that internally used GraphQL.js, creating maintenance overhead and onboarding friction. By prototyping with the most complex endpoint first, the team discovered Zod could provide the same runtime type safety as GraphQL schemas while reducing architectural complexity. Key challenges included handling runtime validation, JSON serialization gotchas with undefined values, and filtering extra properties. Advanced patterns like using merge() instead of intersection() for discriminated unions proved essential. The migration reduced cognitive load while maintaining type safety, demonstrating that architectural decisions should evolve with project needs.
Table of contents
Context: When GraphQL Becomes a BurdenProblem: The Hidden Complexity TaxSolution Journey: Discovering Zod’s PowerTechnical Implementation: Advanced PatternsTeam Learnings: Embracing EvolutionBroader Implications: Choosing the Right ToolConclusion4 Comments
Sort: