NEXUS AI Database: The Complete Guide

NEXUS AI Database gives your apps a production database without running a database server yourself. You create it with one command, attach it to a.

What it is

NEXUS AI Database is the database layer of the NEXUS AI deployment platform. It comes in two forms that share one workflow: create, attach to an app, redeploy, connect.

Option Where it runs Engines Networking
NEXUS AI hosted (provider NEXUS_DOCKER) On NEXUS AI itself, beside your apps on the primary host PostgreSQL 17, 16, 15; Redis 7 Attaches to apps deployed on NEXUS AI (local Docker apps)
Managed cloud A managed instance in AWS RDS, GCP Cloud SQL, or Azure Database, created and wired by NEXUS AI PostgreSQL, MySQL AWS: public with an allowlist, or private VPC. GCP: org credentials. Azure: always private

Two related pieces round it out:

Why use it

The main reason is that the database lives in the same place as the app, so wiring, secrets, and backups stop being separate chores.

Who it is for

It fits any team that deploys on NEXUS AI and would rather not run database servers. Creating a standalone database requires a paid NEXUS AI plan.

Who What they get
Solo founders and small startups A PostgreSQL or Redis database next to the app in one command, with backups on by default
Product and full stack teams Connection settings injected at deploy time, so no secrets are copied by hand between environments
Platform and DevOps teams One workflow across NEXUS AI, AWS, GCP, and Azure, plus snapshots and restores into new instances
Regulated or security minded teams Private networking (AWS VPC, Azure VNet), audit logged credential access, and portable backups
AI engineers and AI assisted developers MCP tools that let an assistant inspect schemas, run safe queries, and propose fixes with confirmation

When to use which option

Start hosted on NEXUS AI for speed; move to a managed cloud instance when you need MySQL, more storage control, or private cloud networking.

Situation Choose Why
Prototype, MVP, or internal tool NEXUS AI hosted PostgreSQL Ready in minutes, no cloud account needed, attaches to apps on NEXUS AI
Cache, queues, or sessions NEXUS AI hosted Redis 7 Runs beside the app with password auth and an optional ACL user
Production app that needs MySQL Managed cloud (AWS RDS or GCP Cloud SQL) MySQL is available only on cloud providers
Data must stay on a private network AWS with vpc networking, or Azure AWS VPC mode is reachable only from the App Runner VPC connector; Azure is always private
You need a chosen size or region Managed cloud Set instance class, 20 to 1,000 GB of storage, and region
An existing database stays where it is External database source Adds inspection, safe queries, and AI fixes without migrating data

Two moments call for action regardless of option: before a risky migration (take a snapshot or backup first) and before launch (run a restore drill, covered below).

How it works

Whichever option you pick, the database reaches your app through the same four steps.

[embedded content: NEXUS AI database lifecycle · create to connected app]

Creation is asynchronous, so a new database is attachable only once its status reads AVAILABLE. Attaching changes nothing until the app is redeployed, because the connection variables are injected at deploy time; detaching likewise takes effect on the next deploy.

How to set one up

Setup takes five steps, from the NEXUS AI CLI or from any MCP client connected to NEXUS AI (tool names in brackets).

  1. Create the database (nexusai_managed_db_create). Give it a name (3 to 63 lowercase letters, digits, or hyphens) and an engine: POSTGRES, MYSQL, or REDIS.
    • For a database on NEXUS AI, set provider to NEXUS_DOCKER. Optional: engineVersion (17, 16, or 15 for Postgres; 7 for Redis), databaseName (default appdb), username (default nexusadmin), and password (12 to 128 characters; if omitted, one is generated and shown once).
    • For a cloud database, set provider to AWS_RDS, GCP_CLOUD_SQL, or AZURE_DATABASE, plus a required engineVersion (for example 17.10 or 8.0.46 on AWS, 16 or 8.0 on GCP). Optional: instanceClass (such as db.t3.micro), allocatedGb (20 to 1,000, default 20), region, and on AWS networkMode (public or vpc).
  2. Wait until it is AVAILABLE. Provisioning runs in the background; poll the status before attaching.
  3. Attach it to your app (nexusai_managed_db_attach) with the database and deployment IDs. Use envPrefix to rename the variables, for example ANALYTICS for a second database.
  4. Redeploy the app (nexusai_deploy_redeploy) so the new variables are injected.
  5. Verify the connection by running SELECT 1 with nexusai_managed_db_query, or by checking the app's logs.

A real example: SenalOps runs on NEXUS AI with a managed PostgreSQL database and two services, created like this:

nexusai managed-db create --name senalops-db
nexusai secrets create DATABASE_URL "postgres://..."
nexusai deploy create --name senalops-web    --source apps/web    --start "pnpm --filter @ai-monitring/web start"
nexusai deploy create --name senalops-worker --source apps/worker --start "pnpm --filter @ai-monitring/worker start"
nexusai deploy logs   --name senalops-worker

For local development against a hosted database, nexusai_managed_db_connection reveals the host, user, and password; every reveal is audit logged. Cloud databases do not support reveals, so attach them to a deployment instead.

Backups, snapshots, and restore

Database services attached to deployments use file backups you can download; managed cloud databases are backed up by their cloud provider, and NEXUS AI adds on demand snapshots that restore into a new instance.

Deployment database services Managed cloud databases
Take a backup On demand (nexusai_db_backup) Snapshot on demand (nexusai_managed_db_snapshot_create), asynchronous
Automatic backups Daily schedule (nexusai_db_backup_schedule), retention 7 days minimum, can be raised Handled by the cloud provider (AWS, GCP, or Azure) under its own backup settings
Download Signed URL valid 30 seconds to 1 hour (default 5 minutes) Not available
File format pg_dump custom, mysqldump, mongodump tar.gz, Redis RDB Provider snapshot
Restore Into the same service, or into another service in the org (PostgreSQL to PostgreSQL only) Into a new instance; the source is left unchanged

Two restore behaviors matter before you press the button:

Prove your backups restore

A backup that has never been restored is a hope, not a plan. Run a restore drill before launch, after major schema changes, and at least quarterly:

  1. Restore the latest backup or snapshot into a new, non production database.
  2. Point a temporary DATABASE_URL at it and run your migrations.
  3. Start the app against it and load a representative account.
  4. Record how long the restore took (recovery time) and how old the backup was (recovery point).
  5. Delete the scratch database, since it holds production data.

To automate this, a tool such as Senal Recover validates every backup and can restore each one into a scratch database on a schedule.

Querying and AI assisted schema fixes

NEXUS AI separates reading from changing, so you or an AI assistant can explore data freely while every write needs an explicit step.

Task Tool Safeguard
Read data from a managed database nexusai_managed_db_query Only SELECT; writes and DDL are rejected. Private databases are reached through an in VPC or VNet proxy
Change data or schema in a managed database nexusai_managed_db_execute Requires the manage scope; SQL is safety checked
Connect an existing database nexusai_db_source_connect Tests the connection first; supports SSL modes from disable to verify-full
See the schema nexusai_db_inspect_schema Returns a normalized schema graph, cached until you refresh it
Try a statement without running it nexusai_db_query_preview Runs EXPLAIN plus a safety analysis
Run a statement on a connected database nexusai_db_query_execute UPDATE and DELETE need a WHERE; any write or DDL needs confirmed=true; up to 10,000 rows returned
Fix a schema error from your logs nexusai_db_propose_fix, then nexusai_db_apply_fix The fix is proposed as DDL for review and applied only on confirmation

A typical AI assisted repair looks like this: a deploy fails with a database error such as a missing column; you pass the log snippet to nexusai_db_propose_fix, read the proposed DDL, dry run it with nexusai_db_query_preview, then apply it. Functions, triggers, views, and procedures are supported, including bodies that use $ quoting.

Security and access

The safest setup keeps credentials out of people's hands: attach the database to the app and let NEXUS AI inject the connection settings.

Limits and open questions

Most surprises come from defaults and from changes that wait for a redeploy.

NEXUS AI confirmed the answers to these questions:

Sources: NEXUS AI's platform tool definitions (database, backup, and deployment tools) and the SenalOps production runbooks for NEXUS AI deployment and backup verification.

About NEXUS AI

NEXUS AI is an agentic AI app builder and full-stack deployment platform. Explore the AI App Builder, learn more on the About page, read the documentation, or contact the team through nexusai.run/contact.

Start for free · Read the documentation · About NEXUS AI · Contact