Before you get too excited and run rails new thecoolest --api on your terminal, it might be a good idea to take some time to consider what your needs are.

How different is a Rails API-only from a full-stack Rails app?

As you can see in the image below, the API-only is a lighter version of a full stack Rails app:

Rails API-only app structure

The reason why it’s lighter is because Rails API-only won’t render HTML pages, handle user sessions & cookies, nor display any assets.

Rails API-only was built for the scenarios where you need a Rails application that serves JSON resources to an API client or client-side framework.

That said, if you need to render HTML pages or files, you’ll be better off building an API on top of a Rails app.

Rails API-only Cheat Sheet

Check out this cheat sheet with the most important things to consider when deciding which Rails app configuration you should go with:

Rails API-only Cheat Sheet

Download your Rails API-only Cheat Sheet

Sidenote: if you’re building an API, please consider following the OpenAPI specification. You can use Swagger for implementing it. rwsagger is the most popular option.