How stepsisstuck/sp-y2-s2-sc-ca-project works
Project Type and Purpose
• This is a full-stack web marketplace application (“SnapSell”) comprising:
• A static front-end (HTML/CSS) served by a Node.js server.
• A back-end REST API (Express) with JWT authentication, models for listings/offers/users/images/likes, and a relational database.
• CI workflow for CSV export and deployment via GitHub Actions.
File Structure Analysis
• Top-Level Directories:
• BackEnd/ – Express app:
– server.js (entry-point)
– controller/app.js (API routes)
– auth/verifyToken.js (JWT middleware)
– model/… (databaseConfig.js + ORM or query definitions for user, listing, offer, image, likes)
– public/… (static assets, seed SQL file)
– config.js (environment settings)
• FrontEnd/ – Static client:
– server.js (serves HTML/CSS)
– public/… (HTML pages, CSS styles)
• .github/workflows/CSV_Export.yml – CI job exporting data
• snapsell.sql & Set Up Instructions.txt – database schema + setup docs
Guidance
a. Main Components
1) Client Browser
2) Front-End Server (Node.js) – delivers static HTML/CSS/JS
3) Back-End Server (Express) – handles REST API endpoints, business logic, authentication
4) Authentication Layer – JWT verification middleware
5) Database (MySQL or PostgreSQL) – persistent storage for users, listings, offers, likes, images
6) Static Asset Store – local public folder for images and SQL seeds (could be S3 in production)
7) CI/CD Pipeline – GitHub Actions for CSV export and deployment
b. Relationships & Data Flow
• Browser → Front-End Server: HTTP GET to load pages (login, listings, view/edit pages)
• Browser → Back-End Server: AJAX/Fetch calls (login, CRUD listings/offers, profile updates)
• Back-End Server → Auth Layer: verifyToken.js validates incoming JWTs
• Back-End Server → Database: model/databaseConfig.js opens DB connection; models perform queries
• Back-End Server → Static Asset Store: serve or upload images via public/ folder
• CI Pipeline → Back-End Server & Database: runs CSV_Export workflow to dump data
c. Architectural Patterns & Principles
• MVC-style separation in BackEnd (controllers ↔ models ↔ config)
• RESTful API design for CRUD operations
• Stateless authentication with JWT tokens
• Clear separation of concerns: static client vs. dynamic API
d. Key Technologies
• Node.js & Express.js
• JWT (JSON Web Tokens) for auth
• Relational DB (MySQL/Postgres) via databaseConfig.js & snapsell.sql
• HTML/CSS (no SPA framework) for UI
• GitHub Actions for CI/CD