Skip to content
How to generate a diagram from a git codebase
Step-by-step guide on generating diagrams from a git codebase
- Copy the repository URL
- Ensure the repository is public on GitHub.
- For private repos, sign up for a free Eraser account to enable access.
- Select a diagram type
- Supported diagrams: Architecture diagrams, Sequence diagrams, Entity-Relationship diagrams, and Flowcharts.
- Write a clear prompt
- A simple one-liner can work, but detailed prompts usually yield better results.
- Follow this framework for an effective prompt:
- Specify file or folder paths (e.g.,
/deployments/dev) for context. - Describe the topic you want to visualize (e.g., signup flow, service architecture, user data model).
- Include visualization instructions (e.g., what to include/exclude, grouping preferences).
- Generate the diagram using the completed prompt.
- Refine the diagram
- Use Eraser's diagram-as-code DSL for manual changes.
- Adjust the layout manually with GUI controls (requires signing into Eraser).
Tips on generating diagrams from a git codebase
- Be specific with paths
- Example:
"Draw a cloud architecture diagram from .tf files in /deployments/dev" is clearer than "Draw a cloud architecture diagram from this repo".
Break down complex diagrams- Instead of
"Draw an architecture diagram of this repo", try "Draw a service architecture diagram of the payment process".
Examples of effective prompts
- "Create an architecture diagram showing the API services in
/src/api/ and how they interact with database models in /src/models/" - "Generate a sequence diagram for the user checkout process from the files in
/src/services/checkout/ and /src/controllers/payment/"
- "Draw an entity relationship diagram of the user, order, and product models from the files in
/src/database/schemas/"