Skip to content

modi-meet/Node-Projects

Repository files navigation

Node.js Projects Collection

A portfolio of Node.js projects demonstrating progressive learning from fundamentals to full-stack web development with authentication, database integration, and server-side rendering.

📋 Table of Contents

Overview

This repository showcases a learning journey through Node.js development, progressing from basic concepts to a production-ready URL shortening service with user authentication. Each project builds upon the previous one, demonstrating mastery of increasingly complex topics.

Projects

Hello World

A minimal Node.js application demonstrating core concepts.

Features:

  • Basic Node.js setup with npm
  • Using built-in os module to access system information

Project 01 - Hybrid Node Server

A RESTful API server demonstrating best practices for building hybrid applications that serve both web browsers and API clients.

Features:

  • Hybrid server architecture (SSR for browsers, JSON for APIs)
  • Express.js middleware implementation
  • MongoDB integration with Mongoose ODM
  • MVC (Model-View-Controller) pattern
  • Request logging middleware

Tech Stack:

  • Node.js, Express.js
  • MongoDB, Mongoose
  • dotenv for environment configuration

API Endpoints:

Method Endpoint Description
GET /api/users Get all users
GET /api/users/:id Get user by ID
POST /api/users Create new user
PATCH /api/users/:id Update user
DELETE /api/users/:id Delete user

Project 04 - URL Shortener with JWT Auth

A full-featured URL shortening service with user authentication and click analytics.

🔗 Live Demo: url-shotener-advanced.onrender.com

Features:

  • URL shortening with custom short IDs
  • Instant redirection to original URLs
  • Click analytics and visit tracking
  • User signup/login with JWT authentication
  • Role-based access control (NORMAL, ADMIN)
  • Rate limiting for API protection
  • Server-side rendering with EJS templates
  • Auto-expiring URLs (TTL: 24 hours)

Tech Stack:

  • Node.js, Express.js
  • MongoDB with Mongoose
  • JWT for stateless authentication
  • EJS templating engine
  • cookie-parser, express-validator
  • nanoid/uuid for short ID generation

API Endpoints:

Method Endpoint Description Auth
POST /url Create shortened URL Required
GET /url/:shortId Redirect to original URL -
GET /analytics/:shortId Get click analytics Required
POST /user/signup Register new user -
POST /user/login User login -

Project Structure:

proj04/
├── index.js           # App entry point
├── connection.js      # MongoDB connection
├── controller/        # Request handlers
├── models/            # Mongoose schemas
├── routes/            # API routes
├── middlewares/       # Auth & rate limiting
├── service/           # Business logic
└── views/             # EJS templates

Tech Stack

Technology Purpose
Node.js JavaScript runtime
Express.js Web application framework
MongoDB NoSQL database
Mongoose MongoDB object modeling
JWT Stateless authentication
EJS Server-side templating
dotenv Environment configuration

Key Learnings

Concepts Covered

  • Node.js Fundamentals - Event loop, modules, npm
  • Express.js - Routing, middleware, error handling
  • MongoDB/Mongoose - Schema design, CRUD operations, indexing
  • Authentication - JWT tokens, cookies, stateless auth
  • Security - Rate limiting, input validation, role-based access
  • Architecture - MVC pattern, RESTful API design, hybrid servers
  • SSR - Server-side rendering with EJS templates

RESTful API Guidelines

See REST-Rules.md for detailed RESTful API best practices followed in these projects.

Key Principles:

  1. Use proper HTTP methods (GET, POST, PATCH, PUT, DELETE)
  2. Design hybrid servers:
    • /users → Render HTML (SSR) for browsers
    • /api/users → Return JSON for mobile/frontend apps

Author

Meet Modi


⭐ If you found this helpful, please star this repository!

About

Bunch of Node.js Backend projects that I built

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors