How paragkoche/group-16-it works
Project Overview & Type
• This is a full-stack application with a clearly separated backend (built with Node.js/Express and TypeScript) and frontend (built with Next.js).
• The README details how to launch both servers, which run on different ports (backend on 8080, frontend on 3000).
Main Components
a. Frontend:
• Next.js Application
– Pages grouped under different segments: (auth) (login, register), (dashboard) (dashboard, share-files, upload-file), and (landing) pages.
– API endpoints under src/api, which likely interact with the backend.
– Common UI components (Card, Header, Nav, SideDrawer) and providers (auth.provider) that manage application state or authentication.
• Data flow: User interactions in the frontend trigger API calls (through the Next.js endpoints) to the backend.
b. Backend:
• Express Server based on TypeScript (src/app.ts, server.ts) that sets up APIs.
• Routers:
– Route handling is split across different modules (router/file.ts, router/users.ts) to handle file and user-related endpoints.
• Middleware:
– Authentication middleware (auth.middleware.ts) is used for request validation.
• Database Layer:
– Individual modules for handling files (files.ts), users (users.ts), a repository (repo.ts), and an index entry point.
– A local file-based database (new.db) is used.
• Helper/Utility Modules:
– JWT helper, password functions, schema validations, and possibly additional file utilities (under utl folder and helper modules).
c. External Linking:
• A static folder in the backend storing static assets suggests file serving.
• Environment configuration (.env in frontend) sets the API base URL.
Relationships and Interactions
• The user’s browser interacts with the Next.js frontend.
• The frontend communicates with the backend over HTTP requests (using the API base URL defined in the .env).
• The backend routes receive the request, process authentication via middleware and helper functions (JWT verification, password hashing) and then interact with the database modules.
• Data from the database or responses built by the backend are sent back to the frontend.
Architectural Patterns & Design Principles
• Separation of concerns: Clear division between frontend and backend.
• MVC or similar layered patterns in the backend – routers/controllers, middleware, and database abstraction layers.
• Use of module-based design in both frontend (components, providers, pages) and backend (routes, middleware, database access helpers).
• Dependency management via package.json files, and configuration support via environment files.
Final Assembly
• Expand the backend to show its internal organization (routers, middleware, database layer, helper functions).
• Notes on development tools (npm, TypeScript configuration, etc.) if needed for clarity.