Reply by: StartupCTO_Experience
My advice is start with REST. Its simpler to implement and debug. Once your application grows and you face issues like over-fetching or under-fetching data, then consider migrating to GraphQL. We started with REST and added GraphQL later only for specific use cases. Now we have hybrid approach - REST for simple endpoints and GraphQL for complex data fetching.
Reply by: MobileApp_Developer
From mobile developer perspective, GraphQL is great because I can fetch all needed data in single request instead of making multiple REST API calls. This reduces network overhead and makes app faster. But on backend side, GraphQL queries can be expensive if not optimized properly. You need to implement things like query depth limiting, complexity analysis etc to prevent abuse.
Reply by: BackendArchitect_Senior
REST is mature, well understood, and works perfectly fine for most applications. Use REST when your data model is simple and you have standard CRUD operations. GraphQL is better when you have complex data relationships and want to give clients flexibility to request exactly what they need. But GraphQL has learning curve and adds complexity. Dont use GraphQL just because its trendy.
User: APIdev_Questions
Subject: REST API vs GraphQL - when to use which?
I am designing APIs for new web application. Should I use traditional REST API or go with GraphQL? I see lot of hype around GraphQL but not sure if its really better than REST or just trend. What are pros and cons of each?