How to determine API boundaries?
Hello, just wondering if I can get some guidance on how to think about APIs in Ash. I'm trying to add Ash to an existing application, and just not quite sure where to begin. Should I just start with a single API, focus on resources and break it out later? Curious to hear your thoughts.
3 Replies
I'd suggest starting with a single api is a good idea, especially if you don't know where to start.
Some example APIs from real applications:
Accounts
Finances
Features
(for feature flagging)
TheEntireApp
(some people just have big apis and don't split it up)
ExternalService
(an api that has resources that interact w/ an external service only)
Splitting up your app used to be harder than it is now. Now, on any relationship that has a resource in a different Api, you just have to say api TheOtherApi
and there won't be any downsides (joins/queries will all work the same).
So easiest is to start w/ one api and get pen to paper, and then think of splitting it up if necessary later down the lineCool. Is there any pros/cons to separate APIs then or is it just a code organization thing at that point?
separating APIs will save some compile time once you have a large amount of resources
A non negligable amount of compile time
but also, that may be a solvable problem at a core level