How alejandro-albiol/todopro works
Project Overview & Context
• toDoPro is a full-stack task manager that enables users to manage and prioritize tasks, enhanced with AI-powered recommendations via the GROQ API.
• It’s structured as a monorepo containing distinct backend, frontend, and public (static assets) directories.
• The backend is built with Node.js, Express, and TypeScript; the frontend uses TypeScript, HTML5, and CSS3; PostgreSQL is used as the database.
• The project is organized with a strong emphasis on SOLID principles and modular design (e.g., separate modules for auth, tasks, users, and AI).
Key Components
a. Frontend Components:
• A frontend directory containing business logic handlers written in TypeScript.
• Static HTML pages and CSS in the public folder that provide the UI.
• These represent the user interface and view layer.
b. Backend Components:
• API Server: The backend (express server) starting with entry point files (src/app.ts, index.ts) handling application routing.
• Modular Controllers and Routes:
• Auth Module: Handles user registrations, login, token management.
• Tasks Module: Manages task creation, updates, and deletion.
• Users Module: User management functions.
• AI Module: Provides AI recommendations using the GROQ API.
• Middlewares and Validators: Centralized middleware for authentication, error handling, data validation, and logging.
• Shared Services and Utilities: Common exception handling, hashing (e.g., argon2 in the hash.service), and error utilities.
• Configuration: App and database configuration files that set up environment variables etc.
• Documentation: Swagger setup from the docs folder for API documentation.
c. Database:
• PostgreSQL database that stores users and tasks tables.
• The backend uses configuration files (in config) for database connectivity and queries within the respective modules.
d. External Services:
• GROQ API: An external AI integration that provides intelligent recommendations for tasks.
Relationships & Data Flow
• The Frontend sends HTTP/HTTPS requests (e.g., login, task operations) to the Backend API.
• The backend routes (via the express server) process these requests using the respective controllers.
• Controllers then interact with service layers (e.g., ai-recommendation.service, user.service, task.service) and repository layers to perform business logic and data persistence.
• Database interactions occur via repositories which execute CRUD operations against PostgreSQL, and shared exceptions help handle any errors during this process.
• For AI-powered task prioritization, the backend’s AI module calls the GROQ API and integrates the recommendations into the overall task management response.
Architectural Patterns & Principles
• Modular Design: Each domain (auth, tasks, users, AI) is separated into its own directory with a clear contract defined by interfaces (see files like i-auth.controller.ts, i-task.service.ts, etc.).
• SOLID Principles: The project adheres to good separation of concerns, including well-defined controllers, services, repositories, and utilities.
• MVC-Like Pattern: Although not a pure MVC, there is a clear separation between the controllers (handling HTTP requests), services (business logic), and models/entities (data representation).