GitHunt
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