Skip to content

Samadali123/Scribbly-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scribbly Backend

The backend API for Scribbly — a note-taking app where users can create, organize, search, and manage their notes securely. Built with Node.js, Express, and MongoDB. Handles everything from authentication to full CRUD for notes, with JWT-based auth stored in HTTP-only cookies.

What It Covers

  • User registration and login with JWT authentication
  • HTTP-only cookie-based session management (no tokens floating in localStorage)
  • Full CRUD for notes — create, read, update, delete
  • Search and filter notes by title, content, or tags
  • Middleware-level auth protection on all private routes
  • Error handling and validation middleware so the controllers stay clean
  • DAO layer separating database queries from business logic

Project Structure

Scribbly-backend/ ├── config/ # MongoDB connection and environment setup ├── controllers/ # Route handlers — request in, response out ├── dao/ # Data access layer — all DB queries live here ├── middlewares/ # Auth verification, error handling, input validation ├── models/ # Mongoose schemas for User and Note ├── routes/ # Express route definitions wired to controllers ├── utils/ # Shared helpers, constants, token utilities ├── .gitignore ├── package.json └── README.md

The DAO layer is worth calling out — instead of writing Mongoose queries directly inside controllers, all database interaction goes through the dao/ folder. Controllers stay focused on request/response logic and delegate data work to the DAO. Makes testing and swapping out DB logic much easier down the line.

Tech Stack

Node.js · Express.js · MongoDB · Mongoose · JWT · Cookie-based auth · CORS

Getting Started

bash git clone https://github.com/Samadali123/Scribbly-backend.git cd Scribbly-backend npm install

Create a .env file in the root:

env PORT=5000 MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret NODE_ENV=development

Then start the server:

bash

Development (with auto-reload)

npm run dev

Production

npm start

Server runs on http://localhost:5000`.

Deployment

Hosted on Render. To deploy your own instance, connect the repo to Render, set up a Web Service with npm start as the start command, and add your environment variables in the Render dashboard.

Author

Syed Samad Ali — LinkedIn

About

The backend API for Scribbly — a note-taking app where users can create, organize, search, and manage their notes securely. Built with Node.js, Express, and MongoDB. Handles everything from authentication to full CRUD for notes, with JWT-based auth stored in HTTP-only cookies.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors