Let's first create our API app. The --api makes our app only have the essential code and cuts out any unneeded code an API wouldn't need. The -T tells it not to install any test suite. The -d specifies which database should be used.
rails new app_name --api -T -d postgresql
Create the database.
rails db:create
Use a scaffold.
rails g scaffold NAME title:string description:string file_url:text image_url:text
Migrate it to the database.
rails db:migrate
Enable CORS gem in the gemfile and then uncomment the section in initializers/cors.rb