API Design First Approach with Rails

I have been lately looking at an API design first approach with Ruby on Rails and was thinking, what if it could be part of the framework itself?

Rails has always promoted the best practices the industry has to offer with strong emphasis on conventions and rapid prototyping and development.

An API Design First approach could fit what Rails stands for. I am curious to know what other members in this forum think about this.

In short an API design first approach would enable us to do the following

  • Prototype APIs with mock responses.
  • Ability to generate openapi specifications for the routes.
  • Generate mock responses using the specifications.
  • Ability to force any mock response documented, by the clients.

Potential Impact:

  • Teams can start integrations faster without needing to wait for full API implementations.
  • More iterative approach to API development.
1 Like

I’d say that while Rails is happy to support use cases where Rails is just a “Backend” and presents an API instead of a full stack offering… it’s pretty clear that the primary philosophy of modern RoR is that pure-APIs are generally speaking not the best practice for the majority of use cases- and that building your app with pure HTML, a little bit of Javascript in the browser, and modern web standards is the best choice for the vast majority of use-cases.

If anything, RoR as a framework is actively pushing against API-first development!

3 Likes