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

# Codebase and Database view

> Browsing the generated source tree and inspecting the application database, including running SQL against it.

Two panels let you inspect what the agent built: **Codebase** for the source tree, **Database** for the data behind it.

## Codebase

<Frame caption="The Codebase panel. The tree is on the left, the file viewer on the right, and the Git controls sit in the footer.">
  <img src="https://mintcdn.com/bluegenai/NDGsqiI6WIlzZ3zL/images/web-apps/codebase-and-database-codebase.png?fit=max&auto=format&n=NDGsqiI6WIlzZ3zL&q=85&s=0552854af1961361e3c7b86e566d0660" alt="The Codebase panel showing a file tree containing backend, frontend, dockerignore, env, gitignore backup and docker-compose entries, beside an empty file viewer reading No file selected, with Checkout, Pull and Push controls in the footer." width="1533" height="757" data-path="images/web-apps/codebase-and-database-codebase.png" />
</Frame>

The tree shows the project as the agent built it. Selecting a file opens it in the viewer; until you do, the viewer reads `No file selected`.

The header carries a download control and a refresh control. The footer carries **Checkout**, **Pull**, and **Push**; see [Git Integration](/web-apps/git-integration).

## Database

The **Database Viewer** has two modes, selected by a toggle in its header.

### Browse

<Frame caption="Browse mode before a table is selected. Schemas and their table counts are on the left.">
  <img src="https://mintcdn.com/bluegenai/NDGsqiI6WIlzZ3zL/images/web-apps/codebase-and-database-browse.png?fit=max&auto=format&n=NDGsqiI6WIlzZ3zL&q=85&s=59771b45ec7d5ccd7b1f5aa228deecf9" alt="The Database Viewer in Browse mode showing a TABLES heading with a count of 28, a filter field, and a schema tree listing drizzle with one table and public with 27, beside an empty state reading Select a table from the left to explore its data." width="1533" height="757" data-path="images/web-apps/codebase-and-database-browse.png" />
</Frame>

The left column lists schemas and their tables with a count, filterable by name. Selecting a table shows its rows.

The `drizzle` schema holds the migration bookkeeping the ORM maintains. Your application's own tables are in `public`.

### Query

<Frame caption="Query mode. The editor is pre-filled with a template, and Run stays disabled until you write something.">
  <img src="https://mintcdn.com/bluegenai/NDGsqiI6WIlzZ3zL/images/web-apps/codebase-and-database-query.png?fit=max&auto=format&n=NDGsqiI6WIlzZ3zL&q=85&s=ec7295896ad255d05ad01edcbf93cb46" alt="The Database Viewer in Query mode showing a SQL EDITOR heading, a keyboard hint reading command plus Enter to run, a disabled Run button, an editor containing a commented template with a SELECT statement, and an empty results area." width="1533" height="757" data-path="images/web-apps/codebase-and-database-query.png" />
</Frame>

The editor runs SQL against the application database. It opens with a template, and the results area reads `Run a query to see results here` until you run something. `⌘ + Enter` runs the query.

## Deleting the Database

<Frame caption="The delete confirmation lists exactly what is dropped.">
  <img src="https://mintcdn.com/bluegenai/NDGsqiI6WIlzZ3zL/images/web-apps/codebase-and-database-delete.png?fit=max&auto=format&n=NDGsqiI6WIlzZ3zL&q=85&s=25746a9597f6946dda34e4bfb9905560" alt="The Delete Database confirmation asking whether to delete the entire database, with a red-bordered box listing that it will drop all tables and data, drop all custom schemas, and that the action cannot be undone, above Cancel and Delete Database buttons." width="1533" height="757" data-path="images/web-apps/codebase-and-database-delete.png" />
</Frame>

<Warning>
  Deleting the database drops every table, all data, and any custom schemas. It cannot be undone, and it does not remove the code that expects those tables to exist.
</Warning>

## When Something Is Not Available

| Message                              | What it means                                                   |
| ------------------------------------ | --------------------------------------------------------------- |
| `Database connection is unavailable` | The application is not running, or its database has not started |
| `SQL query cannot be empty`          | Run was triggered with nothing in the editor                    |
| `Failed to get tables`               | The database responded but the schema could not be read         |

If the connection is unavailable, start the application and let its health checks pass before retrying. See [Deployment Guide](/web-apps/build-mode/deployment-guide).

## Your Next Step

Reading the code is one way to check the agent's work. Asking it to explain itself is another.

<CardGroup cols={2}>
  <Card title="Ask about the code instead of reading it" icon="magnifying-glass" href="/web-apps/ask-mode">
    A read-only mode that traces behaviour and cites its evidence.
  </Card>

  <Card title="Push the code to a repository" icon="code-branch" href="/web-apps/git-integration">
    Checkout, pull, and push from the Codebase panel.
  </Card>
</CardGroup>


## Related topics

- [Troubleshooting & FAQ](/tips-and-tricks/troubleshooting-faq.md)
- [Weekly release notes](/changelog/weekly-release-notes.md)
- [Deployment Guide](/web-apps/build-mode/deployment-guide.md)
- [Default Tech Stack](/web-apps/build-mode/tech-stack-reference.md)
- [Workflow](/web-apps/prototype-mode/workflow.md)
