# Codebase diagrams

## What are Codebase Diagrams?

Codebase diagrams are **AI diagrams generated from a Git repository**. By providing a prompt, Eraser scans relevant files to create the requested diagram, helping teams quickly understand architecture, infrastructure, schemas, and application logic.

<Figure src="/assets/c6129997d955a02776eddbf17af8f4529d8b9b54b34e8163c0db3065c8e86edd-image.png" alt="" />

## Connect GitHub Repository

To generate codebase diagrams using **private repositories**, they must be connected to Eraser. The steps to do this are detailed in the [Connecting Git repositories](/connecting-git-repositories) documentation.

You can skip this step if you're looking to generate codebase diagrams from **public repositories**.

## Generating a Codebase Diagram

<Figure src="/assets/be74f36675adcfdf56c0edb66e560f01b0f4dd6ee84dee45a714544ad9656de5-image.png" alt="" />

Once your repository is connected, follow these steps to generate a codebase diagram:

1. Insert a blank AI diagram
2. Click on "Add repo or library"
3. Select either private repositories or public repositories.
4. Write a prompt
   1. Provide a clear description of what you want the diagram to represent.
   2. Including a specific folder or file path can yield better results.
5. Click "Generate diagram"

### Example Prompts

Here are some example prompts you can use to generate meaningful diagrams:

* "Draw a cloud architecture diagram using `.tf` files in the wordpress-fargate folder."
* "Draw a high-level flowchart of the new user signup process."
* "Draw a data model using the `schema.prisma` file."
* "Generate a sequence diagram for API calls in the `handlers/ folder`."
* "Generate a service architecture diagram for the `payment-processing` service."
* "Draw a Kubernetes deployment diagram using YAML files in the `k8s-configs/ folder`."
* "Visualize the interactions between microservices in the `orders` and `inventory` services."
* "Generate an event-driven architecture diagram for the `checkout` workflow."
* "Create an ERD (Entity-Relationship Diagram) based on SQL schema files in the `database/ schemas`."
* "Draw a serverless function architecture for the AWS Lambda functions in `lambda/`."

These prompts guide the AI to focus on specific parts of the repository, helping it generate accurate and useful diagrams for your development workflow.

### Eraserbot (CI Integration)

Eraserbot is a CI integration that keeps diagrams updated automatically within your CI/CD pipeline, ensuring they reflect the latest code changes. This helps teams maintain accurate documentation with minimal effort.

Learn more in the [Getting started with Eraserbot](/eraserbot) documentation.
