---
title: "Deploy Calendso (cal.com) on Railway"
description: "In this post, we go over the process of deploying Calendso (an open-source alternative to Calendly) connected to a PostgreSQL database on Railway!"
date: 2021-05-21T00:00:00.000Z
updated: 2026-10-29T11:13:06.157Z
topics: ["Guides"]
tags: []
url: https://railway.com/guides/calendso
---

# Deploy Calendso (cal.com) on Railway

In this post, we go over the process of deploying Calendso (an open-source alternative to Calendly) connected to a PostgreSQL database on Railway!

---

[Calendso](https://calendso.com/) is an open-source alternative to [Calendly](https://calendly.com/) which you can either self-host or use their hosted version of for $12/user/month. This post will talk about taking the self-hosted version from [Github](https://github.com/calendso/calendso) and deploying it on Railway.

To self-host your instance of Calendso, you need a [PostgreSQL database](https://docs.railway.com/databases/postgresql) (which Railway automagically sets up for you) and Google API credentials.

## Deploying with Railway

[https://railway.com/new/template?template=https%3A%2F%2Fgithub.com%2Fcalendso%2Fcalendso&plugins=postgresql&envs=GOOGLE_API_CREDENTIALS%2CBASE_URL%2CNEXTAUTH_URL%2CPORT&BASE_URLDefault=http%3A%2F%2Flocalhost%3A3000&NEXTAUTH_URLDefault=http%3A%2F%2Flocalhost%3A3000&PORTDefault=3000](https://railway.com/new/template?template=https%3A%2F%2Fgithub.com%2Fcalendso%2Fcalendso&plugins=postgresql&envs=GOOGLE_API_CREDENTIALS%2CBASE_URL%2CNEXTAUTH_URL%2CPORT&BASE_URLDefault=http%3A%2F%2Flocalhost%3A3000&NEXTAUTH_URLDefault=http%3A%2F%2Flocalhost%3A3000&PORTDefault=3000)

To deploy your Calendso instance to Railway, simply click the button above ([source code](https://github.com/calendso/calendso)). Before you can finish your deployment, you need to add the `GOOGLE_API_CREDENTIALS` environment variable which we will set up in the next step so we can proceed with the deployment!

<aside>
💡 Calendso also requires you to set up a PostgreSQL database but we automagically do that for you!

</aside>

NOTE: If your Calendso fails to deploy with dependency issues, you'll likely need to pin Node to 14. Example [here](https://github.com/FarazPatankar/calendso-test/commit/6513d93fb865d1e60942108b9e96749c041c9d90). Related thread [here](https://discord.com/channels/713503345364697088/713503345867882498/877233267848380547)

## Google API credentials

To allow Calendso to read from and write to our Google calendar, we need to create API credentials and provide them to Calendso. 

### Enable API

To do that, head to the [Google API console](https://console.cloud.google.com/apis/dashboard) and create a new project. It might take a little bit for Google to set up your project but once that's done, head over to the project and click the `Enable APIs and Services` button.

Once you click the button, you'll be taken to the API library. In the search box, look for `calendar` and select the `Google Calendar API` result and then enable it.

![Enabling the Google Calendar API](https://cms.railway.com/media/871c4d3a8a80aea13ccda4e6dc762d5f83845d603729306d002e2370c4e292dd.gif)

### Set scopes

Next, head to the [OAuth consent screen](https://console.cloud.google.com/apis/credentials/consent) and select your app type ([Internal or External](https://support.google.com/cloud/answer/10311615#user-type)) and enter the basic required details on the first page.

On the second page, you'll have to set up [scopes](https://developers.google.com/identity/protocols/oauth2/scopes). Scopes will define the things that this particular API would have access to. In this case, we want `auth/calendar.events`, `auth/calendar.readonly`, `auth/calendar`. Select these scopes and hit `Update` and move on to the next page.

![Scopes](https://cms.railway.com/media/8a7cdb68952b38da14c6223d1e953e5ca904ca10020b9545d16c2070f5332b9d.png)

On the third page, you will add test users. I only added myself but feel free to add others who might be testing/using the app with you. Once that's done, double-check that everything is fine on the summary page and head back to the dashboard.

### Create credentials

Next, head over to the [Credentials](https://console.cloud.google.com/apis/credentials) section and select `Create Credentials`. We want the type to be `OAuth Client ID`. For the application type, select `Web Application` and set a name.

Next, add the authorized origins and redirect URIs. For now, we'll add [`http://localhost:3000`](http://localhost:3000/) to our `Authorized JavaScript origins` and [`http://localhost:3000/api/integrations/googlecalendar/callback`](http://localhost:3000/api/integrations/googlecalendar/callback) to our `Authorized redirect URIs` and click `Create`.

<aside>
💡 We will come back to this part later to add our production URIs once we've deployed our application on Railway!

</aside>

![Authorized origin and redirect uri for development](https://cms.railway.com/media/34ef42d1558700ea8da99da0e5e95efae3c3a463b11fed9babaadd25d576dc32.png)

Your key will be created and you'll be redirected back to the Credentials page where you will see your newly generated OAuth 2.0 Client ID. Select the download option, save this file to your computer and open it in your editor of choice. Copy all the contents of the file and add that as the value for the `GOOGLE_API_CREDENTIALS` environment variable and hit the deploy button!

## Setting up locally

Once your project is deployed, clone the repository that was created for you during the deployment step and link it to your Railway project using [`railway link`](https://docs.railway.com/cli).

Next, to set up the database schema, run `railway run npx prisma db push`.

<aside>
💡 `railway run` injects all your environment variables for you, this way, you don't need to set anything up locally and everything just works.

</aside>

Next, head over to your project dashboard by running `railway open` in the CLI. Navigate to the PostgreSQL option from the sidebar and click the User model to add a new row to it. Make sure you encrypt your password with [BCrypt](https://bcrypt-generator.com/) when you enter it into the password field.

![Create user](https://cms.railway.com/media/491e98dc10ba4fed5946d2faa70dfa925de668d5a52d0c3585f75e5710247143.gif)

In the GIF above, I demonstrate the process of creating the user. Make sure you delete the extra trailing space when you paste your password in from BCrypt.

Now that the user is created, run `railway run yarn dev` to start the server and visit [`http://localhost:3000/`](http://localhost:3000/) to log in using the user you just created. After logging in, you should be able to add the Google Calendar integration, set your available times, and also create new events.

![Adding an integration and an event](https://cms.railway.com/media/03d4fdb103d568e75bf1106c8a449e82b9d20eb6cde170cfca307069c25dc0ff.gif)

### Moving to production

Given the fact that we set everything up to work locally, we are going to have to make a couple of minor changes before our self-hosted instance of Calendso is ready to be shared with the world.

First, let's head over to the project dashboard and update our `NEXTAUTH_URL` variable from [`http://localhost:3000`](http://localhost:3000/) to our production domain for our app. You can find yours under the `Deployments` tab.

NOTE: There should be NO TRAILING SLASH IN THE NEXTAUTH_URL

Next, let's head back to our [credentials page](https://console.cloud.google.com/apis/credentials) in the Google API console so we can edit the Calendso OAuth ID we created earlier and add our production origin and redirect URI.

![Authorized origin and redirect uri for production](https://cms.railway.com/media/5dca6e59fe0f376f352807ddee49bcababa57c29e7be634acbf1e63bbb24e8d5.png)

Hit save and download the updated JSON. Then, just like before, copy the contents of the JSON and update the value of the `GOOGLE_API_CREDENTIALS` environment variable on Railway.

Once you've updated both the environment variables, just run `railway up` from the CLI and your self-hosted instance of Calendso should be ready to use!

### Caveats

The changes we made in the previous step to make our app work in production ironically stop it from working in development. I personally am okay with that outcome as I will only be using this in production.

But, if you'd like to make changes and work on the codebase in development, you can create an additional [environment](https://docs.railway.com/environments) on Railway and set the environment variables we had previously. That way, everything should work as expected both in development and in production.

## Closing

And with that, our self-hosted instance of Calendso should be fully functional. You should be able to create events, share those links and have people booking slots on your calendar just fine. Feel free to [reach out to us](https://discord.com/invite/xAm2w6g) if you run into any issues.

If you have any suggestions for more open-source self-hosted solutions you'd like to see guides for, let us know. Or even better, submit a pull request to our [starters repository](https://github.com/railwayapp/starters) on Github!