Skip to content

Open a database from your machine

A database you run on Flui is not on the internet. It has no public address, no port anyone can scan and nothing to point a client at. That is the safe default, since a database exposed to the world is an expensive mistake, but it means you need a way in the first time you want to look at a row.

There are two ways in:

  • A tunnel. flui db tunnel puts the database on your own machine, at 127.0.0.1, for as long as the command runs. Your usual tools connect to it: psql, DBeaver, mongosh, your application’s ORM.
  • The console in the browser. Nothing to install or run, and read-only by default. Good for a quick check.

Neither one opens the database to anybody else. The tunnel is bound to your loopback address and closes with the command. The console runs every request through Flui’s own API, so the browser never talks to the database.

The tunnel, and the console

The application’s name is the only argument:

Terminal window
flui db tunnel my-database

It stays in the foreground, so an open tunnel is always visible in a terminal. Press CTRL-C to close it.

While it is open, it prints everything a client needs:

✅ Tunnel up. Connect a client to:
Host: 127.0.0.1
Port: 55432
Database: appdb
User: appuser
Password: ...
📝 Connection string:
postgresql://appuser:...@127.0.0.1:55432/appdb
🧪 PostgreSQL client:
PGPASSWORD='...' psql -h 127.0.0.1 -p 55432 -U appuser -d appdb

Copy the connection string into your ORM, or paste the client line into a second terminal. Both match the engine you are running.

If the connection drops, the command reconnects on its own and prints the coordinates again. Pass --no-retry to turn that off when you would rather see the failure.

Which port it binds

The local port is chosen per engine and differs from the engine’s usual port: 55432 instead of 5432, so a tunnel does not clash with a Postgres already running on your machine. Tunnels to different kinds of database do not collide either, except Redis and Valkey, which share one port.

EngineLocal port
PostgreSQL55432
MariaDB53306
Redis / Valkey56379
FerretDB57017

Pass --local-port <n> to pick another port, for example to run tunnels to two Postgres databases at the same time.

The tunnel covers only these five engines. For anything else it answers that the database is not supported. For Kafka, an object store or a search engine, use the browser console.

The other flags, and the other commands

-c, --cluster <name|id> picks the cluster. You can leave it out when your profile has only one.

The rest of the db commands work on the same databases:

CommandWhat it does
flui db credentials <app>The in-cluster address and credentials, which another app running on Flui uses. The password is hidden unless you pass --show.
flui db dump <app-id>A logical SQL dump of a Postgres or MariaDB database, produced by the engine’s own tool. -o <file> to name it, or --s3-destination <id> to send it to a backup destination instead of downloading.
flui db restore <app-id> <file>Runs a dump back into the live database. It overwrites existing data and asks before it does; --yes skips the prompt.
flui db disk <app-id>How full the storage under the database is. When it is full, the database can no longer write.
flui db backup-status <app-id>For Postgres: whether continuous backup is on, how far back you can recover, and the last base backup. --json for machine-readable output.
flui db pitr-restore <app-id> --name <new>Rebuilds a Postgres database as of a point in time into a new install. The source is never touched. --at <ISO-8601> sets the moment; without it, the latest.

tunnel and credentials take a name, a slug or an id; the others take the application’s id, from flui app list.

What the tunnel needs from you

If you can run the CLI, you already have both things the tunnel needs.

The first is access to the application, the same access opening its console needs. See Who is allowed to open one below.

The second is a way onto the cluster. There is no key to set up: the CLI signs a short-lived certificate for you from the SSH authority your profile manages, uses it and discards it.

That connection is also why the tunnel can show the password. The API returns only the coordinates (engine, database, user), and the CLI reads the password from the cluster itself, over the connection it already opened. No password crosses the HTTP API on this path, which is the same rule the console follows.

Who is allowed to open one

Opening a database is decided by the same access engine as every other route in the product:

  • Owning the application is not enough by itself. You need a grant that reaches it (the same grant that lets you operate it anywhere else) and the right to reach an application’s data, which every role carries except Platform operator.
  • Revoked access applies here too. A grant revoked, or narrowed to a different set of applications, closes the console and the tunnel along with everything else.
  • An agent credential is checked first, before the application is even looked up. A key scoped to reading logs cannot reach an arbitrary query prompt, even when the person who created it owns the database.
  • Applications the platform installed for itself open only to someone with authority over the whole installation.
  • A refusal does not say “it belongs to somebody else”. It reads as an absence, with the same words every time. Trying ids until one answers differently tells you nothing.

The whole db family shares that gate: the tunnel, the credentials, the dumps, the disk report and the point-in-time restore all run the same check before they answer.

Every query the console runs is recorded on the server, whether it succeeded or not.

See who is connected

A database that slows down, runs out of connections or stops on a lock usually has one session behind it. For a managed PostgreSQL, the Sessions view shows every session connected to the database and what each one is doing, and lets you stop one.

For each session you see:

  • Who it is. Flui names the application when it recognises it from its address. Otherwise you get the name the client gave itself, or else its address. A session that comes through the connection pooler is marked as such.
  • Its state (running, idle, idle in transaction, waiting for a lock), how long it has been in it, and what it is waiting on.
  • Who blocks whom. A session waiting for a lock is drawn under the session that holds it.
  • The query, with every value in it hidden. You see the shape of the statement, never the data in it.

When the database has a connection pooler, a Pooler section follows: each pool with its clients and database connections, and the clients waiting in the pooler for a connection. See Connect an application to a managed PostgreSQL for what the pooler is.

There are three ways to stop something, from the gentlest:

ActionWhat happens
Cancel the queryThe running statement stops with an error in the application that sent it. The connection stays open.
Close the sessionThe connection is closed and its open transaction, if any, is rolled back. The application has to reconnect.
Close a pooled clientThe pooler drops that client’s connection, with the database connection it holds. Its open transaction is rolled back and the application has to reconnect.

Each one asks you to confirm first, is recorded in the activity log, and needs the right to change the application, not only to read it. If the session has already ended when you confirm, nothing is stopped and you are told so.

Terminal window
flui db sessions my-postgres
flui db sessions my-postgres --all
flui db sessions my-postgres --watch 2

The first line sums it up: how many sessions are connected out of the database’s maximum, how many are running, idle in a transaction or blocked, and how many clients wait in the pooler. Idle sessions are left out unless you pass --all. --watch <n> redraws every n seconds until you press CTRL-C, and --json prints the same data for a script.

To stop one, take the session’s number (its pid) or the pooled client’s id from that list:

Terminal window
flui db sessions cancel my-postgres 4242
flui db sessions terminate my-postgres 4242
flui db sessions close-client my-postgres 17

Each asks you to confirm. --yes (-y) skips the question, for scripts. The flags are in the databases CLI.

No agent opens a console or a tunnel

No tool on the agent surface opens a console or a tunnel, by design. A tunnel is a live connection to your data and a console is an arbitrary query prompt; a person opens, watches and closes both. An agent that needs a fact about your data should be asked for a query you run yourself.

The Sessions view is different: it shows who is connected, not your data, so an agent can read it as described above.

The platform’s own two databases

Two names do not belong to any application, and flui db tunnel handles them itself: platform-postgres and identity-provider. They are Flui’s own database and the identity provider’s. The browser console never opens them. The tunnel is the only way in, and it needs authority over the whole installation.

They have their own page: Reach the platform’s own database.

Where this goes next