Serverless Postgres Public Preview
6 minWe'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.
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:
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:
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.
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.
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:
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 .koyeb.app
) to access the application:
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.