Galaxy

PostgreSQL

Reliable relational database with strict structure. Perfect for production applications and complex data relationships.

PostgreSQL on Galaxy

PostgreSQL is a relational database with strict structure and powerful querying. You define tables and relationships upfront, and the database enforces them. It's the safe choice for production apps where data accuracy matters.

The Production-Ready Choice

PostgreSQL is battle-tested, reliable, and scales beautifully. When in doubt, PostgreSQL is probably the right choice.


When to Use PostgreSQL

Choose PostgreSQL for most production applications. It's the safe choice when you need reliable data, complex relationships, and powerful queries. Use PostgreSQL unless you have a specific reason not to.

Default to PostgreSQL

PostgreSQL is the default choice for production apps. MongoDB is better if your data structure changes frequently. Both work great on Galaxy.


Create a PostgreSQL Database

Setting up PostgreSQL takes just a couple of minutes.

Open Your Dashboard

Go to your Galaxy dashboard and click Databases in the sidebar.

Start Database Creation

Click Create Database and select PostgreSQL as your database type.

Configure Your Instance

Choose your PostgreSQL version and instance size. Pick the region closest to your app for best performance.

Create and Wait

Click Create Database & Start Billing. Galaxy provisions your database in a few minutes. You'll see "Running" when it's ready.

Same Region = Best Performance

Deploy your database in the same region as your app. This minimizes latency and keeps your data transfer free.


Connect to Your App

Click your database in the dashboard to see the connection string. Copy it and add it as an environment variable in your app's settings.

The exact variable name depends on your framework:

  • Node.js apps: Often DATABASE_URL, DB_HOST, or separate DB_USER, DB_PASSWORD, DB_DATABASE variables
  • Python apps: Typically DATABASE_URL
  • AdonisJS apps: Usually DB_CONNECTION, DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE

Keep Your Connection String Secure

Never hardcode your connection string in your code. Always use environment variables so it stays secure and out of version control.


Security

Your PostgreSQL database is protected with username and password authentication. All connections from your Galaxy apps are private and don't traverse the public internet.

How It Works

Communication between your app and database uses secure authentication. Your connection credentials (username and password) protect access, and the connection itself stays within Galaxy's network.

Planned Security Features

A couple of security enhancements are on our roadmap:

IP Whitelisting: In a future release, you'll be able to restrict database access to specific IP addresses for an additional layer of network security. This will let you lock down connections even further. We're working on this and expect to ship it soon.

SSL/TLS Encryption: We're also planning to add SSL/TLS support for encrypted connections. This will add transport-level encryption on top of your authentication layer.

Already Secure

Your database credentials are already protected through authentication. These additional features will add extra security layers when they ship. In the meantime, environment variables keep your connection details safe from version control.


Features

PostgreSQL on Galaxy gives you everything needed for production:

Relational Tables: Define structure upfront with columns, types, and constraints. Your data stays consistent and validated.

Foreign Keys: Enforce relationships between tables. If a user gets deleted, their posts can automatically be cleaned up too.

Powerful SQL: Complex queries, joins, aggregations, window functions, and more. PostgreSQL handles sophisticated data operations with ease.

Automatic Backups: Daily backups included with all plans. Your data is protected without extra configuration.


Common Questions


What's Next?