
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).
- Specify file or folder paths (e.g.,
- 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"
.
- Instead of
"Draw an architecture diagram of this repo"
, try"Draw a service architecture diagram of the payment process"
.
- Example:
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/
"
See Other Diagram Generators
Trusted by leading technical teams globally
FAQs
How do I get started?
Try one of our presets. Select an option under "Load a preset" and click "Generate Diagram". You can also browse our use case video library for more inspiration.
Can I edit my diagram?
Yes, the diagrams can be edited in Eraser, a docs and diagram tools built for engineering teams. Click on "Save and Edit Diagram". In Eraser, the diagrams can be edited using Eraser's diagram-as-code syntax.
Who made this and what is Eraser?
DiagramGPT was created by the team at Eraser, leveraging OpenAI's GPT-4. Eraser (eraser.io) is a whiteboard for engineering teams. You can edit your DiagramGPT generated diagrams using Eraser.
How can I share feedback?
We'd love to hear from you. Reach out to us at hello@tryeraser.com, on Twitter (@eraserlabs), or join our Slack community.
What types of diagrams can it draw?
4 types are currently available – flow charts, entity relationship diagrams, cloud architecture diagrams, and sequence diagrams.
Is there an API?
Yes, you can read our API documentation here. Due to LLM costs, the API is only available to Professional Plan teams.
Will my data be used for LLM training?
No. OpenAI nor Eraser will use your data to train AI models. Eraser may analyze your usage to improve and enhance our AI feature.
What's next?
It only gets better from here. We're working to improve accuracy and layout customization. If there's something you'd really like to see, drop us a note at hello@tryeraser.com.