What's the ideal project layout for a REST API?

REST is an implementation detail.

“What’s the ideal project layout for a REST API?” someone recently asked.

What are your thoughts?

Here are mine:

This is like asking what’s the ideal number of wheels on a blue vehicle.

Or what’s the ideal height for a metal building?

The ideal number of wheels on a blue vehicle may be anywhere from zero (for a hoverboard) to dozens (for a train). The only detail we’ve been given is its color, which is irrelevant to its function.

The ideal height of a metal building may be a few centimeters (if it’s a model or a toy) to hundreds of stories tall. The only detail we know is that it’s made of metal. Most buildings contain at least some metal. This is not a useful charactaristic when determining the ideal hight. Will this be a barn? Or a highrise office complex?

REST is an implementation detail. It tells us nothing about the purpose the software serves. And the purpose it serves is what dictates an ideal structure. Will this be a stock trading platform? A messaging app for gamers? These are the details that matter when architecting project structure.

Not the fact that you’ve chosen to implement a REST API.

Share this