AR
Aryan9inja/Synote-Backend
Backend for Synote, a full-stack note and task management app built with Node.js, Express, and MongoDB. It features secure JWT authentication, RESTful APIs for notes and tasks (including subtasks), AI integration for summarizing notes, and cookie-based session management. Built with scalability and modularity in mind.
๐ง Synote Backend
This is the backend server for Synote, a note and task management app. Built using Node.js, Express, MongoDB, and JWT authentication, it also integrates AI summarization using the Mistral 7B model via OpenRouter.
๐ Project Structure
server/
โโโ source/
โโโ controllers/ # Route logic
โโโ db/ # DB connection setup
โโโ middlewares/ # Auth & error middlewares
โโโ models/ # Mongoose models
โโโ routes/ # Express routes
โโโ services/ # Token / AI / utility services
โโโ utils/ # Misc helpers
โโโ app.js
โโโ constants.js
โโโ server.js
โจ Features
- โ JWT-based authentication with secure cookies
- โ User registration, login, logout, refresh tokens
- โ Notes and Tasks CRUD APIs
- โ Subtasks system nested under tasks
- โ AI-powered note/task summarization using Mistral 7B
- โ Express middleware for route protection and error handling
- โ Clean modular code and service-oriented architecture
๐ API Endpoints
All endpoints are prefixed with
/api/v1/
๐ค Auth (/users)
| Method | Route | Description |
|---|---|---|
| POST | /register |
Register new user |
| POST | /login |
Login user |
| GET | /me |
Get current user |
| PATCH | /me |
Update user (avatar, etc.) |
| POST | /logout |
Logout user |
| POST | /refresh-tokens |
Refresh access token |
๐ Notes
| Method | Route | Description |
|---|---|---|
| POST | /notes/ |
Create a new note |
| GET | /notes/ |
Fetch all notes |
| GET | /notes/:id |
Get note by ID |
| PATCH | /notes/:id |
Update note |
| DELETE | /notes/:id |
Delete note |
โ Tasks
| Method | Route | Description |
|---|---|---|
| POST | /tasks/ |
Create new task |
| GET | /tasks/ |
Fetch all tasks |
| GET | /tasks/:id |
Get task by ID |
| PATCH | /tasks/:id |
Update task |
| DELETE | /tasks/:id |
Delete task |
| GET | /tasks/tasks-with-subtasks/ |
Tasks with subtasks |
โป Subtasks
| Method | Route | Description |
|---|---|---|
| POST | /tasks/:id/subtask |
Add subtask to task |
| GET | /tasks/:id/subtask |
List all subtasks for task |
| PATCH | /tasks/:id/subtask/:subtaskId |
Update a specific subtask |
| DELETE | /tasks/:id/subtask/:subtaskId |
Delete a specific subtask |
๐ง AI-Powered Summarization
| Method | Route | Description |
|---|---|---|
| GET | /ai/notes/:noteId/summarize |
Summarize a note |
| GET | /ai/tasks/:id/summarize |
Summarize a task |
๐ ๏ธ Setup & Running
Install & Run Backend
cd server
npm install
npm run dev๐ ENV Configuration (server/.env)
PORT=8000
MONGODB_URI=your-mongo-db-uri
CORS_ORIGIN=your-cors-origin-url
ACCESS_TOKEN_SECRET=your-access-token-secret
ACCESS_TOKEN_EXPIRY=15m
REFRESH_TOKEN_SECRET=your-refresh-token-secret
REFRESH_TOKEN_EXPIRY=7d
OPEN_ROUTER_API_KEY=your-openrouter-api-keyโ๏ธ Tech Stack
- Node.js, Express.js
- MongoDB (Mongoose ODM)
- JWT (access & refresh tokens)
- AI Summarization via OpenRouter API
- Middleware: auth, error handling, validation
- Tooling: dotenv, nodemon, Postman, ESLint, Prettier
๐ License
MIT ยฉ 2025 Aryan Singh Thakur