Full-stack graph processing system for the SRM Full Stack Engineering Challenge.
FullStack_Bajaj/
├── backend/
│ ├── server.js # Express entry point
│ ├── package.json
│ ├── routes/
│ │ └── bfhlRoutes.js # POST /bfhl route
│ ├── controllers/
│ │ └── bfhlController.js # Request validation & response
│ ├── services/
│ │ └── graphService.js # Business logic + user metadata
│ └── utils/
│ └── graphProcessor.js # Core graph engine (zero deps)
├── frontend/
│ ├── index.html
│ ├── css/styles.css
│ └── js/app.js
├── .gitignore
└── README.md
cd backend
npm install
npm run dev # starts on http://localhost:3000Open frontend/index.html in a browser, or serve it:
cd frontend
npx -y serve . # starts on http://localhost:3000 (use another port)Note: Update
API_BASE_URLinfrontend/js/app.jsif your backend runs on a different URL.
Health check.
Response:
{ "status": "ok", "service": "BFHL Graph Processing API", "timestamp": "..." }Process directed edges.
Request:
{ "data": ["A->B", "A->C", "B->D"] }Response:
{
"user_id": "arsh_verma_24042004",
"email_id": "arsh@example.com",
"college_roll_number": "RA2211003012345",
"hierarchies": [
{
"root": "A",
"tree": { "A": { "B": { "D": {} }, "C": {} } },
"has_cycle": false,
"depth": 3
}
],
"invalid_entries": [],
"duplicate_edges": [],
"summary": {
"total_trees": 1,
"total_cycles": 0,
"largest_tree_root": "A"
}
}