Internal tools are the unsung heroes of a company's operations. They power customer support, manage inventory, and provide critical business insights. Yet, building them is often a thankless task, relegated to the bottom of the backlog. One of the most common and frustrating features to build is search. Crafting complex SQL, handling edge cases, and making it user-friendly can take days, if not weeks.
What if you could build a powerful, intelligent search engine for your internal applications in less time than it takes to get lunch?
With database.do, you can. This tutorial will walk you through creating a smart internal search tool that understands user intent, requires zero complex query logic, and can be deployed in under an hour.
If you've ever built search for an internal dashboard, you know the headaches:
This is where an AI-native approach changes everything. Instead of telling the database how to find something, you simply tell an AI agent what you want to find.
database.do is an AI-powered agentic workflow platform that provides a unified, intelligent API for interacting with your databases. Think of it as a brilliant data assistant who understands your database schema and can perform complex operations on your behalf.
By connecting your data sources to database.do, you gain access to:
Let's stop talking about it and start building.
For this tutorial, we'll imagine we have a users table in our database and we want to build a UI for our support team to quickly find customer information.
First things first, you need to grant database.do access to your data.
Security is paramount. database.do ensures all connections are encrypted and provides robust credential management, so your data remains secure and under your control.
Now, let's bring the power of database.do into your application. We'll use the Node.js SDK for this example.
First, install the package:
npm install @do-sdk/core
Next, initialize the client in your project. You'll need your API key from the database.do dashboard.
// src/lib/doClient.ts
import { createDo } from '@do-sdk/core';
// Initialize the .do client with your API key from an environment variable
const doClient = createDo(process.env.DO_API_KEY);
export default doClient;
This is where the magic happens. Instead of writing a massive SQL query, we'll write a single, intuitive function call.
Let's create an API endpoint that will take a search query from our frontend.
// src/pages/api/search-users.ts
import doClient from '../../lib/doClient';
export async function POST(request: Request) {
const { query } = await request.json();
if (!query) {
return new Response(JSON.stringify({ error: 'Query is required' }), { status: 400 });
}
try {
// This is it. This is the entire backend search logic.
const users = await doClient.database.search('users', {
query: query,
limit: 10, // Optional: limit the number of results
});
return new Response(JSON.stringify({ users }), { status: 200 });
} catch (error) {
console.error('Search failed:', error);
return new Response(JSON.stringify({ error: 'Failed to search for users' }), { status: 500 });
}
}
Notice what we're doing here with doClient.database.search. We're not specifying columns or writing LIKE clauses. We can pass a query like "active user from California named John" and the AI agent will:
Your frontend can now call this endpoint with the user's input from a search bar, instantly creating a powerful and intuitive user experience.
The power of database.do isn't limited to search. The entire suite of CRUD (Create, Read, Update, Delete) operations is simplified.
Need to find a specific user by their email?
import doClient from '@do-sdk/core';
async function findUserByEmail(email: string) {
const user = await doClient.database.findUnique('users', {
where: { email },
});
console.log('Found user:', user);
return user;
}
Need to update a user's status?
async function updateUserStatus(userId: number, newStatus: string) {
const updatedUser = await doClient.database.update('users', {
where: { id: userId },
data: { status: newStatus },
});
console.log('User updated:', updatedUser);
return updatedUser;
}
The unified API remains the same, abstracting away the underlying database syntax and complexity. This dramatically speeds up development and makes your codebase cleaner and easier to maintain.
In under an hour, we've designed a secure, intelligent, and scalable search functionality that would have traditionally taken a significant engineering effort. By leveraging an AI-native data access layer, you can stop wasting time on boilerplate data logic and start focusing on building features that truly empower your team.
Ready to interact with your data like never before?
Get started with database.do today and build your first AI-powered workflow.