In modern development, managing data is rarely a simple affair. Teams often juggle a mix of SQL and NoSQL databases, data warehouses, and caches, each with its own interface, authentication method, and operational quirks. This complexity can slow down development, introduce errors, and make scaling a nightmare. What if you could manage all of it as easily as you manage your application code?
At databases.do, we're turning this idea into a reality with our "Services as Software" philosophy. Our platform is built to help you provision, query, and scale distributed databases through a single, powerful API. Today, we're taking a deep dive into the cornerstone of this platform: the databases agent, the core API for managing your entire collection of data resources.
Before we jump into the code, it's essential to understand a key concept. You might see references to both database.do and databases.do.
Think of it like this: a single database is a book. The databases agent is the librarian's central catalog system. You don't use the catalog to read the book, but you use it to find out which books you have, where they are, and how to organize them. This agent is your single source of truth for all data resources in your project.
The core principle behind our platform is Database as Code. Instead of clicking through UI dashboards or running manual CLI commands, you define and manage your data infrastructure using simple, repeatable code.
The databases agent is your primary tool for this. Let's look at how you can get a complete overview of every data resource in your project with just a few lines of TypeScript.
import { databases } from '@do/sdk';
// List all databases within your project
async function listAllDatabases() {
try {
const allDbs = await databases.list();
console.log('Available Databases:', allDbs);
return allDbs;
} catch (error) {
console.error('Failed to retrieve databases:', error);
}
}
listAllDatabases();
Let's break down what's happening here:
The power of this command lies in its abstraction. It doesn't matter if you have a PostgreSQL database on AWS, a MongoDB on-prem, and a managed Redis cluster from another provider. The databases.list() command unifies them, returning a clean, organized list that your application can programmatically use. This simple API access is the key to transforming complex data operations into simple, repeatable workflows.
The code example above is more than just a convenience; it's a reflection of a fundamental shift in database management. When you treat your data infrastructure as code, you unlock several powerful benefits:
The databases.do agent isn't just for listing resources; it's designed for scalable database management. As your application grows, you can script operations to add read replicas, increase storage capacity, or apply security updates across multiple databases at once.
Because the platform is designed to be extensible, you can manage a wide variety of database types—SQL, NoSQL, and even graph databases. The databases agent acts as a universal control plane, giving you a consistent workflow regardless of the underlying technology.
Ready to stop wrestling with dashboards and start managing your data resources as code? Getting started is simple.
From there, you can explore provisioning new databases, querying them, and integrating databases.do into your automated workflows.
Visit databases.do to learn more, get your API key, and dive into the future of database management. Welcome to the era of "Services as Software."