How to deploy the Headless CMS Strapi app on Heroku
December 15, 2021
🚀Getting started with the Strapi
🤩Introduction to Strapi
In strapi, the API’s are created using the Strapi admin panel in which respective content-type maps and access by its endpoint.
Introduction to Heroku
Heroku is a container-based cloud platform as a service (PaaS) that enables developers to run, build and operate applications entirely on the cloud and supports several programming languages like Java, Nodejs, PHP, Go, Python, Clojure, Ruby, and Scala. Heroku is part of the Salesforce platform and it is so easy to use that’s a top choice for many deployment projects. Heroku is managed on containers called dynos within the Heroku paradigm system.
To get started, we need to have the following in place:
- You should have a GitHub account
- You should have a Heroku account
- Open any code editor for your repository
- Git installed on your machine
- Node.js v16+ installed
- Strapi installed locally
In this guide, we are going to:
- Create a new GitHub repository
- Create a new Strapi proejct
- Configure the Heroku CLI login with your GitHub repository
- Connect the Postgres add-on database with your Strapi project provided by Heroku
- Configure PostgreSQL for the production environment
📝Installing Strapi locally
To install Strapi locally, run this command in your GitHub repository.
💡 npx create-strapi-app@latest my-project --quickstart
💡 yarn create strapi-app my-project --quickstart
When the dependencies are installed and the local setup completes, it will create a project my-project, then you should be redirected to admin access http://localhost:1337/admin register an admin user using the form which opens in the browser.
If you’re redirecting for the first time then you’re redirecting to http://localhost:1337/admin/auth/register-admin. This is because we have no super admin yet in the database. By default, Strapi uses SQLite as a file-based database.
When you are registered successfully, you’re the super admin of your app. You can invite other folks through email to get access to the super admin, author, and editor roles.
Available commands in your project:
- yarn develop (Start Strapi in watch mode)