Crunchy Bridge

Crunchy Bridge and Koyeb

Crunchy Bridge (opens in a new tab) is a fully managed PostgreSQL service from Crunchy Data (opens in a new tab). It runs and manages your PostgreSQL database and offers backups, disaster recovery with point-in-time recovery, and built-in connection pooling.

This guide explains how to connect a Crunchy Bridge PostgreSQL database to an application running on Koyeb. To successfully follow this documentation, you will need to have:

The application that connects to the Crunchy Bridge PostgreSQL database uses Prisma as an ORM. Prisma is an open-source ORM. We use it to synchronize our database schema with our Prisma schema.

If you already have a freshly created Crunchy Bridge PostgreSQL database running and want to quickly preview how to connect your database to an application running on Koyeb, use the Deploy to Koyeb button below.

Deploy to Koyeb (opens in a new tab)

Make sure to replace the DATABASE_URL environment variable with the connection string of your Crunchy Bridge PostgreSQL database.

Create a Crunchy Bridge PostgreSQL database

To create a Crunchy Bridge PostgreSQL database, sign in to your Crunchy Bridge account (opens in a new tab).

On the Crunchy Bridge control panel, start by clicking the Create Cluster button to provision a cluster and access the database creation page:

  1. Give a name to your cluster, e.g., postgres-koyeb.
  2. Select the Cloud Service provider for your PostgreSQL database between AWS, Azure, or GCP. For this guide, we use AWS.
  3. Pick the Region to run the database in. Here, we use EU Central (Frankfurt) as our compute will be deployed in this region on Koyeb.
  4. Select a database Tier. Depending on the tier you select you will be able to access different instance types. For this guide, we use the Hobby tier.
  5. Choose the Instance size according to your needs. Here we use the Hobby-0 with 0.5 GB memory and 2vCores.
  6. Pick the PostgreSQL Version to use for the database. Here we use PostgreSQL 15.
  7. Choose the amount of Storage needed for your database, e.g., 10 GB.
  8. Depending on your project's criticality, there is an option to enable High Availability. In our case, we don't need it and keep the default value to No.

When you are done configuring your database, click the Create Cluster button. Your cluster will be provisioned.

Retrieve your Crunchy Bridge Postgres connection string

On the Crunchy Bridge control panel, click on the Connection tab to retrieve the connection string to connect the database.

By default, three Roles are created to connect your database with different privileges. You can learn more about these roles and permissions in the Crunchy Bridge's User Management documentation (opens in a new tab).

For this guide, we will use the application role, which has standard permissions, to connect to the database. Select the URL format and copy it.

The connection string should be similar to the following:


Save it in a safe place, we will need it in the next step to connect our application to the database.

Deploy the application on Koyeb

You can deploy on Koyeb using the control panel or via the Koyeb CLI.

To deploy the example application (opens in a new tab) using the control panel (opens in a new tab), follow these steps:

  1. Create a new Koyeb App.
  2. Set as the GitHub repository to deploy and keep the default branch main.
  3. Set npm run postgres:init as the Build command.
  4. Add a DATABASE_URL environment variable to tell the application how to connect to the PostgreSQL database. Give the environment variable the name DATABASE_URL and enter the connection string from earlier as the value.
  5. Name your service, for instance, express-crunchy-bridge.
  6. Click the Deploy button.

A Koyeb App and Service will be created. Your application will be built and deployed to Koyeb. Once the build has finished, you will be able to access your application running on Koyeb by clicking the URL ending with

The example application exposes a /planets endpoint that you can use to list planets from the database. Once your deployment is live, you should see the following results when navigating to https://<YOUR_APP_URL>

    "id": 1,
    "name": "Mercury"
    "id": 2,
    "name": "Venus"
    "id": 3,
    "name": "Mars"

Delete the example application and Crunchy Bridge PostgreSQL database

To delete the example application and the Crunchy Bridge PostgreSQL database and avoid incurring any charges, follow these steps: