Hacker News new | ask | show | jobs
by JustSteveKing 825 days ago
API design is more of an artform than anything. GraphQL is great when you are perhaps using a noSQL database and the schema is somewhat fluid. However, if you have a relational database - you will get the best results using actual REST APIs.

The best way to think of an APIs design is; why do you need an API in the first place. Creating an API for the sake of having an API is what leads to terrible APIs. Instead design your API for its use case, and if you have multiple use-cases - maybe you need multiple APIs, or a more clever API design that blends well

1 comments

Thanks for the explanation! That makes sense to consider the database structure when choosing between REST and GraphQL. I hadn't thought about purpose-driven design before - focusing on the use case sounds key to avoiding bloated APIs. Do you have any favorite resources on designing for specific use cases?

Also, are there any tools that can help with documenting or visualizing different API design options?

For documenting APIs swagger is an standard that is widely used.