Single Node.js backend for all personal projects. Each service is isolated with its own DB connection and mounted under /api/<service-name>.
cd HOMIE_101
npm install
cp .env.example .env # fill in your values
npm run dev| Variable | Description |
|---|---|
PORT |
Server port (default: 3000) |
ALLOWED_ORIGINS |
Comma-separated CORS origins |
NOTES_MONGO_URI |
MongoDB URI for Notes service |
JWT_SECRET |
Secret for JWT signing |
GOOGLE_CLIENT_ID |
Google OAuth client ID |
GOOGLE_CLIENT_SECRET |
Google OAuth client secret |
NOTES_GOOGLE_CALLBACK_URL |
Full callback URL for Google OAuth |
NOTES_FRONTEND_URL |
Frontend URL for post-OAuth redirect |
GROQ_API_KEY |
Groq API key for AI chat |
CSC_MONGO_URI |
MongoDB URI for Country/State/City service |
GET /ping
Response: { "status": "ok", "message": "HOMIE_101 is running" }
Base URL: http://localhost:3000/api/notes
Rate limit: 100 requests / 15 minutes per IP
POST /api/notes/auth/signup
Body:
{
"firstName": "John",
"lastName": "Doe",
"email": "john@example.com",
"password": "yourpassword"
}Response 201: { "message": "User created successfully" }
POST /api/notes/auth/login
Body:
{
"email": "john@example.com",
"password": "yourpassword"
}Response 200: { "token": "<jwt>" }
GET /api/notes/auth/google
Redirects to Google login. No body required.
GET /api/notes/auth/google/callback
Handled by Google. On success, redirects to NOTES_FRONTEND_URL?token=<jwt>.
All project routes require
Authorization: Bearer <token>header.
POST /api/notes/projects
Body: { "name": "My Project" }
Response 201: { "_id": "...", "name": "My Project", "user": "..." }
GET /api/notes/projects
Response 200: Array of projects belonging to the authenticated user.
DELETE /api/notes/projects/:id
Response 200: { "message": "1 project(s) deleted" }
All file routes require
Authorization: Bearer <token>header.
POST /api/notes/files
Body:
{
"name": "diagram.excalidraw",
"projectId": "<project_id>"
}Response 201: File object.
GET /api/notes/files/by-project/:projectId
Response 200: Array of files in the project.
GET /api/notes/files/:id
Response 200: File object with populated project.
PUT /api/notes/files/:id
Body:
{
"name": "updated-name",
"content": "{\"elements\": []}"
}Response 200: Updated file object.
DELETE /api/notes/files/:id
Response 200: { "message": "1 file(s) deleted" }
Requires
Authorization: Bearer <token>header.
POST /api/notes/chat
Body: { "message": "draw a flowchart with 3 steps" }
Response 200:
{
"elements": [
{ "type": "rectangle", "x": 100, "y": 100, "width": 200, "height": 100 }
],
"message": "Created your requested query on canvas"
}Base URL: http://localhost:3000/api/csc
Rate limit: 15 requests / 60 minutes per IP (public API)
GET /api/csc/search?search=<query>&limit=15&offSet=0
| Param | Required | Default | Description |
|---|---|---|---|
search |
yes | — | Search term (min 2 chars) |
limit |
no | 15 | Max results to return |
offSet |
no | 0 | Pagination offset |
Response 200:
{
"success": true,
"results": [
{ "_id": "...", "csc": "India > Maharashtra > Mumbai" }
]
}Response 400 (search too short):
{ "success": false, "message": "Search must be at least 2 characters" }- Create
src/services/<service-name>/index.js— export an async function(app) => {} - Connect its own DB via
connectDB('name', process.env.YOUR_MONGO_URI) - Mount routes under
/api/<service-name> - Register it in
src/index.js:await require('./services/<service-name>')(app);
- Add env vars to
.env.example
HOMIE_101/
├── src/
│ ├── index.js # Entry point
│ ├── config/
│ │ └── db.js # Multi-connection DB manager
│ └── services/
│ ├── notes/ # Notes + Excalidraw service
│ │ ├── index.js
│ │ ├── config/passport.js
│ │ ├── middlewares/auth.js
│ │ ├── models/index.js
│ │ └── routes/
│ │ ├── auth.js
│ │ ├── project.js
│ │ ├── file.js
│ │ └── gpt.js
│ └── csc/ # Country State City service
│ ├── index.js
│ ├── models/index.js
│ └── routes/search.js
├── .env.example
├── package.json
└── README.md