Creating a new Rails app is super easy by itself. And, creating a Rails app set up as an API is not much different. Because we are planning on deploying our app to Heroku we need to set it up with PostgreSQL as the database. The default database in Rails is SQLite, but it is not supported by Heroku Let’s start! 1) Make sure your Rails version is up to date Run the following line in your terminal to update Rails gem update rails and then this line to get the current version of Rails rails -v 2) Create the Rails API with PostgreSQL rails <<APP_NAME>> --api --database=postgresql new Replace the with the actual name of your app <<APP_NAME>> — create a new Rails app rails new — initialize the new app as an API. This means the newly created app will not have any views. And the ApplicationController will inherit from ActionController::API instead of ActionController::Base - -api — And, as you can probably guess, this last part sets up the app to use PostgreSQL as the database -- database=postgresql 3) Create a new GitHub repository for your app Keep track of the development of your API by storing your code on GitHub. Check this to see how to add an existing project to a Github repository. link 4) Sign up for free on Heroku Follow this to the Heroku Sign up page. link 5) Install Heroku CLI Next, we will need to install the Heroku CLI to be able to deploy our little project. Check this to see how to install the Heroku CLI. link Once installed the command is available from your terminal. heroku 6) Log in using your Heroku account details Run the following command in your terminal and enter your Heroku credentials when prompted heroku login Press Enter at the prompt to upload your existing ssh key or create a new one, used for pushing code later on 7) Create a new Heroku app Run the following command in your terminal to create a new app on Heroku heroku create After that, we are all set up to deploy our app to Heroku! 8) Deploy the project We are finally here! Run the following commands in your terminal to deploy your app to Heroku git add . git commit -m git push heroku master "Deploy my super awesome Rails API" Side note — if you are working on a different branch from the master branch. You can run the following command to deploy your code For example, if you are working on the feature-branch git push heroku feature-branch:master 9) Our app is deployed! That’s it, our Rails API is now live! It’s an API-only application, it’s using PostgreSQL as the database and it’s deployed to Heroku. Congratulate yourself. And then, get back to work, you have only begun. Thanks for reading. And hopefully, this article helps you out.