Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shared-ToDo-list-API

Backend of the Shared-ToDo-list-App

Table of Contents:

Installation On Local Machine

  1. Navigate in Console/CMD to the desired location and clone the repository:
git clone https://github.com/HaimGoldest/Shared-ToDo-List-API.git
  1. Open the Shared-ToDo-List-API folder:
cd Shared-ToDo-List-API
  1. Install dependencies:
npm install
  1. Build and Run the Server Locally:
npm start

Important

Verify your port 3000 is free! (or change the port in the code)

Design Decisions and Patterns Used in the Backend

Layered Architecture

The backend is organized into distinct layers:

  • Routes: Define the API endpoints and handle HTTP requests.
  • Controllers: Handle business logic and delegate tasks to repositories or utilities.
  • Repositories: Abstract database interactions, enabling separation of concerns and maintainability.
  • Utilities: Provide shared helper functions. This structure improves modularity and makes the code easier to extend or modify

Repository Pattern

Centralizes all database queries for each entity, keeping controllers clean and focused on business logic. This abstraction reduces redundancy and simplifies testing, as repositories can be mocked for unit tests.

Singleton Pattern

Ensures only a single instance of the Socket.IO server exists across the application. This avoids duplicate WebSocket server instances and ensures all clients are connected to the same Socket.IO instance.

Factory Pattern

Centralizes the creation of structured WebSocket event objects for consistency. This reduces repetitive logic when emitting events and ensures uniformity in event structures.

Middleware for Cross-Cutting Concerns

Handles reusable concerns like authentication and input validation. This ensures consistent behavior across routes and avoids redundant code in controllers.

  • Using "express-validator" package for routes and user inputs validations.

WebSocket Integration for Real-Time Updates

Provides real-time task updates across all connected clients. This avoids duplicate WebSocket server instances and ensures all clients are connected to the same Socket.IO instance.

Token-Based Authentication

Centralizes the creation of structured WebSocket event objects for consistency. This design improves user experience by enabling real-time task synchronization.

Cloud Database

Leveraging MongoDB-Atlas provides a centralized, pre-configured database solution for all clients, eliminating individual database setup requirements.

About

Backend of the Shared-ToDo-List-App

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages