This article assumes that you have Crystal and Heroku CLI installed.

Create a sample application

Create a new application using

You should see the following on your terminal

now cd to the root of the app, $ cd sample-app  and add Kemal to shrad.yml file

and run $ crystal deps for installing dependencies.

Add a “/” route

Open sample-app.cr file and add replace the contents with the following code

now run $ crystal src/kemal_sample.cr  and go to http://localhost:3000on your browser. You should see ur app running and the message ‘Hello World’.

Deploy to Heroku

So far so good 🙂 Now let us deploy our app to Heroku. Run

$ heroku create your-custom-name --buildpack https://github.com/crystal-lang/heroku-buildpack-crystal.git

You should see something like the following on your terminal.

You are all set. Commit and push to heroku

To see your app running go to https://your-custom-name.herokuapp.com/ . Congratulations you just deployed your crystal app to production

Happy Coding