> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Databases

> Deploy any database with one command

## What It Does

Your app needs a database. Monk detects that during [code analysis](/features/code-analysis), then provisions and configures it automatically — PostgreSQL, MongoDB, Redis, or any of 20+ supported databases.

You pick the deployment model: self-hosted containers, cloud-managed services, or third-party providers. Monk handles provisioning, connection strings, and configuration.

## How It Works

### Automatic Database Detection

During code analysis, Monk figures out what your app needs:

* Database type (PostgreSQL, MySQL, MongoDB, Redis, etc.)
* ORM or driver in use (Prisma, SQLAlchemy, Mongoose, etc.)
* Connection string references in your code
* Schema files and migrations
* Required features (full-text search, JSON columns, etc.)

No upfront configuration required. Monk reads the code and acts on it.

### Deployment Options

Once Monk knows which database you need, you choose how to deploy it.

#### Option 1: Self-Hosted in Containers

**Best for:** Development, staging, proof-of-concept

* Runs in a container on your infrastructure
* Monk handles setup, persistence, and configuration
* Fast to spin up, easy to tear down
* Full control over version and settings

#### Option 2: Cloud Provider Managed Database

**Best for:** Production, simplified operations, automatic backups

* Uses your cloud provider's managed service (AWS RDS, GCP Cloud SQL, Azure Database, DigitalOcean Managed Database)
* Automatic backups, updates, high availability
* You provide cloud credentials, Monk provisions and configures

#### Option 3: Third-Party Managed Database

**Best for:** Specialized features, global distribution, serverless scaling

* Uses specialized providers (MongoDB Atlas, Redis Cloud, Neon, PlanetScale)
* Often includes free tiers or serverless pricing
* Advanced features like multi-region replication

**Progression example (MongoDB):**

* Start with **MongoDB Community** (containerized) for development
* Move to **DigitalOcean Managed MongoDB** for production simplicity
* Scale to **MongoDB Atlas** for global distribution

Monk recommends the best option based on your stage, scale, and requirements. You decide.

### Supported Databases

Monk supports 20+ databases out of the box. Here are the highlights:

* **PostgreSQL** — the go-to relational database
* **MySQL** — widely supported, battle-tested
* **MongoDB** — flexible document store
* **Redis** — in-memory caching and data structures
* **Cassandra** — distributed, high-availability NoSQL
* **TimescaleDB** — time-series on top of PostgreSQL
* **Neo4j** — graph database
* **Elasticsearch** — full-text search and analytics

See [Integrations](/integrations) for the full list of supported databases.

### Automatic Connection Management

Monk generates and manages connection strings automatically via [Configuration & Wiring](/features/configuration-and-wiring):

* Connection string generation (`postgresql://user:pass@host:5432/db`)
* Credentials creation and secure storage
* Network configuration for database access
* Connection pooling settings
* SSL/TLS encryption setup

Switch between deployment options without changing your code.

<Warning>
  **Data migration between databases** isn't automated yet. When switching from
  self-hosted to managed (or vice versa), Monk updates connection strings but
  doesn't transfer data. You'll need to migrate data manually (export/import).
</Warning>

### Database Credentials

When you use managed databases (MongoDB Atlas, Redis Cloud, cloud provider databases), Monk requests the necessary credentials automatically.

**Third-party services:**

* MongoDB Atlas, Redis Cloud, Neon — Monk asks for API keys when needed

**Cloud-managed databases:**

* AWS RDS, GCP Cloud SQL, etc. — uses your cloud provider credentials

> [How to obtain database credentials](/getting-started/obtaining-credentials)

### Database Configuration

Monk can tune database settings to match your requirements:

* Memory allocation and caching
* Connection pool sizes
* Query timeouts
* Storage size and IOPS
* Replication settings
* Performance tuning parameters

Tell Monk what you need in plain language. It understands database-specific parameters for every supported engine.

### Backups & Restore

<Info>
  Automated backup integration via chat is still in development. Some managed services
  already expose backup APIs that Monk can leverage — check individual integration docs
  for details.
</Info>

**Managed databases with backup API support:**

* **MongoDB Atlas** (M10+ dedicated clusters)
* **AWS RDS** (PostgreSQL, MySQL, MariaDB, SQL Server, Oracle)
* **DigitalOcean Managed Databases** (PostgreSQL, MySQL, MongoDB, Valkey)
* **GCP Cloud SQL** (PostgreSQL, MySQL)
* **Azure Cosmos DB**
* **Redis Cloud** (Pro tier)
* **AWS DynamoDB**

**Self-hosted databases:**

For containerized databases, use manual backup procedures: volume snapshots, native tools (`mongodump`, `pg_dump`, `mysqldump`), or scheduled scripts.

## Roadmap

<Info>Data plane integration, custom management actions, and automated backups are on the roadmap. [Vote on what to prioritize](https://monk.io/roadmap).</Info>

<CardGroup cols={2}>
  <Card title="Integrations" icon="puzzle-piece" href="/integrations">
    Full list of supported databases, cloud providers, and third-party services.
  </Card>

  <Card title="Working with Databases" icon="terminal" href="/prompting/working-with-databases">
    Prompting examples for common database operations.
  </Card>
</CardGroup>
