Member-only story
How to Build a Good API with Rails 8

Whether you are writing code for a living or for fun, at some point you will find yourself building an API. The problem is building a good API is not as easy as it sounds.
But Rails makes your life easier.
Guide assumptions

This guide assumes you have a basic knowledge in programming and a good understanding of how an API works.
It should be treated as a brief introduction to API development in Rails.
A previous experience with Ruby and Rails is a bonus.
What you will need:
- RubyOnRails on your machine.
- A database server/engine : sqlite, mariabd, etc.
- Code editor: I recommend Visual Code. Rubymine is amazing if you have some extra bucks to spare.
- Internet Connection.
What makes a good API?

A good api has 4 traits
- predictable and consistent: code reuse for api end points.
- static: an api should not change in a breaking way.
- simple and clear: an api should return what’s expected.
- flexible: easy to scale and maintain.
Why Rails?

RubyOnRails is mostly known for rapid agile web apps development. Following the current trends, Integrating a frontend framework has become challenging and even time consuming.
In fact, modern web app architectures nowadays consist of a client app that consumes a JSON API. Indeed, Rails 5 introduced the api mode years ago ; A bootstrapped skeleton for api only apps.