Skip to content

aanujkhurana/TreeChart-Vue.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Vue Version Vite Version TypeScript Version D3 Version

License: MIT PRs Welcome

Netlify Status

TreeChart Playground

A highly customized version of the d3-org-chart. It provides a flexible and visually appealing way to display hierarchical data in a tree-chart format.

TreeChart Playground is a visual, Org Chart built with Vue 3, D3, and Express.js. Users can view, explore, and dynamically add new nodes to the chart with data persisted on a backend server.

πŸ”— Live Demo

Frontend: treechartplayground.netlify.app

Backend: tree-chart-backend.onrender.com
(Render takes ~50 seconds to cold start)


πŸ›  Tech Stack

Frontend

Backend


πŸ“¦ Project Structure

treechart-playground/
β”œβ”€β”€ client/                 # Vue 3 frontend
β”‚   β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ Chart/              # D3 logic, render, UI components
β”‚   β”œβ”€β”€ App.vue
β”‚   └── main.ts
β”œβ”€β”€ service/                # Express backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ models/
β”‚   β”‚   └── index.js
β”‚   └── db/                 # Local JSON-based storage
β”œβ”€β”€ .env
β”œβ”€β”€ ecosystem.config.js     # PM2 configuration
β”œβ”€β”€ README.md
└── package.json

πŸš€ Getting Started

1. Clone the Repository

git clone https://github.com/yourusername/treechart-playground.git
cd treechart-playground

2. Install Frontend Dependencies

cd client
npm install

3. Install Backend Dependencies

cd ../service
npm install

4. Start the Development Servers

Backend

cd service
npm run dev

Frontend

cd ../client
npm run dev

The app should now be running at http://localhost:5173

🌐 API Endpoints

Method Endpoint Description
GET /api/nodes Fetch all nodes
POST /api/nodes Add a new node

All data is saved in a flat JSON format under the db/ directory.

βš™οΈ Environment Variables

Create a .env file in the client/ directory:

VITE_API_URL=https://tree-chart-backend.onrender.com

πŸ”’ CORS Setup (Backend)

Express server uses CORS middleware to allow requests from:

origin: ["http://localhost:5173", "https://treechartplayground.netlify.app"]

πŸ§ͺ Future Improvements

  • βœ… Editable nodes and inline updates
  • πŸ›  Drag & drop node rearrangement
  • πŸ” Advanced search/filtering
  • 🧱 Modular component system
  • 🧾 Undo/redo history support

How to Contribute

Contributions are welcome! If you have ideas for improvements or bug fixes, feel free to open an issue or submit a pull request.

πŸ“„ License

MIT License. Use freely for learning or commercial purposes.

About

A highly customised d3-org-chart, using Vue.js with Typescript and CSS

Topics

Resources

Stars

Watchers

Forks