All blog posts

Serverless Postgres Public Preview

6 min

We're excited to announce the Koyeb Serverless Postgres public preview - a fully managed, fault-tolerant, and scalable serverless Postgres Database Service.

What do all modern applications have in common? They all have APIs, workers, and databases. Deploying APIs and workers with Koyeb has long been possible. Starting today, you can spin up databases too!

Using Koyeb Serverless Postgres, you can easily start a resilient Database Service alongside your apps in a few seconds. You can build, run, and scale your full stack apps and manage their databases on a single platform with a unified experience.

During the public preview, you can run one Postgres Service with 0.25 CPU, 1GB memory, and 1GB storage in Frankfurt (Germany), Washington, D.C. (USA), or Singapore for free.

Our Postgres databases are feature-packed. Here are some highlights:

  • Auto-sleeping: Databases auto-sleep after 5 minutes of inactivity.
  • Postgres extensions support: Add your beloved Postgres extensions including pgVector, PostGIS, TimescaleDB, and over 40 more.
  • Latest Postgres version: 14, 15 and 16.
  • Logical databases and role management: Manage your logical databases and users directly in the control panel.
  • Global availability: Regions in North America (Washington, D.C.), Europe (Frankfurt, Germany), and Asia (Singapore) are available today.
  • Highly-available: Our Postgres databases are fault-tolerant by design.
  • 100% Postgres compatible: Start using with psql or any other compatible Postgres client. We provide examples for popular languages and frameworks including Node.js, Django, Symfony, Ruby on Rails, Go, and Prisma to get you started quickly.

Connect to database tutorials

Behind the scenes, we partnered with Neon to build this. Neon's serverless philosophy is aligned with our vision — no infrastructure to manage, no servers to provision, no database cluster to maintain — making them the obvious partner to power our serverless Postgres offering.

In the coming weeks, you can expect additional customization with different database sizes and flexible pricing following your usage. We will maintain a free tier for Postgres to get you started on the platform.

To learn more about Koyeb Serverless Postgres, check out the documentation or go ahead and create your first Database Service from the Koyeb Dashboard.

To get a full run down of how to create your first Database Service using the CLI and connect it with your Koyeb App, keep reading!

Create your first Database Service

With a single command, you can create a managed Postgres database with the Koyeb CLI (be sure to update to the latest release!).

If you wanted to create a new Database Service called pg-on-koyeb in the Washington, D.C. region, this is how you would do it:

$ koyeb database create pg-on-koyeb --region was
INFO[0001] Database creation in progress. To access the connection strings, run `koyeb database get aca0cbf4` in a few seconds.

The Database Service is being provisioned and will be ready in a few seconds. Once it's ready, you can get the connection strings to connect to it by typing:

$ koyeb db get pg-on-koyeb
aca0cbf4	pg-on-koyeb	was   	Postgres 16	HEALTHY	0.1h/100h  	29MB/3072MB (0%)	23 Nov 23 17:38 UTC	postgres://koyeb-adm:******

In addition to returning the connection strings, the koyeb database get command also provides some information about the Database Service including the amount of time active and amount of storage used.

Connect to your Database Service

With the Database Service created, you can easily connect to it using the psql client. Below, we connect to the Database Service and list all of its logical databases.

$ psql postgres://koyeb-adm:******
psql (16.1 (Debian 16.1-1.pgdg120+1), server 16.0)
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off)
Type "help" for help.

koyebdb=> \l
                                                        List of databases
   Name    |    Owner    | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules |       Access privileges
 koyebdb   | koyeb-adm   | UTF8     | libc            | C       | C     |            |           | =Tc/"koyeb-adm"               +
           |             |          |                 |         |       |            |           | "koyeb-adm"=CTc/"koyeb-adm"   +
           |             |          |                 |         |       |            |           | neon_superuser=CTc/"koyeb-adm"
 postgres  | cloud_admin | UTF8     | libc            | C       | C     |            |           |
 template0 | cloud_admin | UTF8     | libc            | C       | C     |            |           | =c/cloud_admin                +
           |             |          |                 |         |       |            |           | cloud_admin=CTc/cloud_admin
 template1 | cloud_admin | UTF8     | libc            | C       | C     |            |           | =c/cloud_admin                +
           |             |          |                 |         |       |            |           | cloud_admin=CTc/cloud_admin
(4 rows)

Let's now see how to connect to the Database Service from a Service running on Koyeb with the Express.js application using Prisma example application.

Before deploying the application, we will create a new Koyeb Secret to securely store our Postgres connection string. Koyeb Secrets are reusable, meaning you can reuse a Secret value in different Services, allowing you to pass the credentials securely to your applications as environment variables.

To create a new Secret, run the following command and set the value to the Postgres connection string returned by the koyeb database get command.

$ koyeb secret create pg-on-koyeb-connection-string
Enter your secret: ********
ID      	NAME                         	TYPE  	VALUE	CREATED AT
cf8cdb72	pg-on-koyeb-connection-string	SIMPLE	*****	27 Nov 23 13:33 UTC

All good! We are now ready to deploy our application on Koyeb.

Deploy on Koyeb

To deploy the application, we will use the Deploy to Koyeb button, which offers a way to easily to deploy applications with a single click:

Deploy to Koyeb

When you click the button above, you will be redirected to the App creation page in the Koyeb control panel with all of the required settings pre-filled.

In the Environment variables section, you will find the DATABASE_URL variable. This variable is used by the application to connect to the Postgres Database Service. Change the environment variable type to Secret and select the Secret we created earlier.

We are now ready to deploy the application. Click Deploy and wait a few seconds for the application to be deployed.

Once the Service is healthy, open the app's public URL (ending with to access the application:

Prisma on Koyeb

Tutorial - Deploy and accelerate databases at the edge with Neon, PolyScale, and Koyeb

Up next: larger databases, autoscaling, and pricing

We're excited to see what you will build with Koyeb Serverless Postgres and we're looking forward to your feedback to help us shape the product.

In the coming weeks, we will release larger databases, autoscaling, and share the pricing of this new offering.

Sign up today and start deploying your Database Service for free!

Finally, you can keep up with all the latest updates by joining our vibrant and friendly serverless community or follow us on X at @gokoyeb.


Welcome to Koyeb

Koyeb is a developer-friendly serverless platform to deploy any apps globally.

  • Start for free, pay as you grow
  • Deploy your first app in no time
Start for free
The fastest way to deploy applications globally.