Problem
Your company is building a new product with a React web app, a React Native mobile app, and plans for a public API. The frontend team is advocating for GraphQL, while the backend team prefers REST. As the tech lead, you need to evaluate both options and make a decision that serves all three consumers.
The Application
A project management dashboard with:
- Dashboard view: Shows a summary of multiple entities (user info, recent projects, pending tasks, notifications count, team activity) in a single page load.
- Detail views: Show a single entity with deep nested data (a project with its tasks, each task with assignees and comments).
- List views: Paginated lists with sorting, filtering, and search.
- Mutations: Create/update/delete operations on projects, tasks, comments.
- Real-time: Live updates for task assignments and comments.
- Public API: Third-party developers will build integrations.
Decision Factors
- Data Fetching Efficiency: How many network requests does each page require? How much over-fetching or under-fetching occurs?
- Mobile Performance: Mobile networks are slow and unreliable. Minimizing requests and payload size matters.
- Type Safety: How well does each option integrate with TypeScript?
- Caching: How does caching work for each option (CDN, browser, application)?
- Developer Experience: Learning curve, tooling, debugging.
- Versioning: How do you evolve the API without breaking existing clients?
- Public API: What experience do third-party developers expect?
Your Task
- Compare REST and GraphQL across all decision factors with concrete examples from the application.
- Evaluate the "dashboard problem" (multiple data sources for one page) under each approach.
- Make a recommendation and justify it.
- Address the losing option's strengths and how to compensate.
- Consider a hybrid approach and when it makes sense.
Constraints
- Team of 8 (4 frontend, 3 backend, 1 full-stack).
- The public API will be used by 50+ third-party developers.
- The mobile app must work well on 3G connections.
- The backend team has no GraphQL experience.