How to create diagram of your project's folder structure in 3 simple steps | convert your folder structure to diagram
Tags: chart, howto, chatgpt, tutorial
Published: 2024-06-29 15:11:23

Converting your project's folder structure to a diagram can be useful in case of presentation, teaching best practices for the folder structure or it can be a requirement for you to explain your code's structure.

to convert folder structure to the diagram or a flowchart can be done by using many ways such creating manually a graph by following your project's code structure or you can use ChatGPT to solve this problem. But wait! ChatGPT can not create a graph for free right?

So what's the solution?. well that's right free versions of ChatGPT is not able to create a flow chart.

But we can achieve this by following these steps.

- Write a raw folder structure text to your readme or save it anywhere.
- Create a prompt for ChatGPT to convert this structure to mermaid code.
- Convert mermaid graph to easily readable & editable flow chart.

## Write raw folder structure

There are many ways to convert your folder structure to text but for now let's keep things simple. I have already created a post in which I clearly mentioned that How you can complete this part so check this out:

> 📓 [how to convert your project's structure to text](https://your-codes.vercel.app/how-to-easily-create-folder-structure-in-readme-with-two-simple-steps)

## Convert to mermaid

After converting your project's folder structure to text you have to convert it to mermaid code So that how you can easily convert it to mermaid graph right.

### step 1: Write a prompt

Get your text form of project's structure and tell ChatGPT to convert it to mermaid like this

![chatgpt for mermaid code generation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6to487u8cynj24nv8urj.png)
The code that ChatGPT provided is that

```
graph TD;
    A[tailwindPostCss]
    A1[assets]
    A1-1[img]
    A2[blog]

    A --> A1
    A1 --> A1-1
    A --> A2
```
And This mermaid code created this diagram

![Flow chart using chatgpt's mermaid code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9oqyloezn0jxn5swki7r.png)

Although this diagram is not editable by mouse And it is very difficult to add comments and description about your folder structure through mermaid graphs.

But you do not need to worry about it. it's time for the next step.

## Convert mermaid to easily editable Flow chart diagram
Now you have mermaid code for the flow chart of your folder structure.

So what you need to do is to go to https://excalidraw.com/

Now click on

- more tools
 - mermaid to excalidraw (under generate)

![Convert mermaid code to excalidraw](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z61vh1pwngrun96zvcun.png)
now just paste your project structure's mermaid code. on the left input

just like this

![mermaid to excalidraw flow chart generation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bhnqvgoy1lv0kcamlh6t.png)
After pasting mermaid code your flow chart will be generated to the left.

just click on insert button then it will be available for you on editor.

By creating diagram or flow chart of your project's folder structure to the excalidraw you are allowed to edit it freely and you can also export it as png as well.