How valentincasas/laterne_web works
Project type and purpose
• This is a full-stack Node.js/Express web application (laterne_web) with server-side rendering (Jade templates) and client-side dynamic behaviors (fetch-based CRUD).
• It provides CRUD endpoints for resources like users, products, categories, events, testimonials, businessInfo, openingHours, and uses JWT for authentication.
File structure
• Top-level:
• app.js / index.js: Express server entrypoints
• config.js / db.js: configuration and database connection
• routes/: HTTP route definitions
• controllers/: request handlers that invoke business logic
• models/: ORM models and associations (MySQL schema via laterne.sql)
• middlewares/: auth checks (JWT validation)
• libs/jwt.js: JWT creation/verification
• views/: Jade templates for each page
• public/: static assets (CSS, JS, images, fetch scripts)
• Patterns:
• MVC: routes → controllers → models → DB
• RESTful endpoints under routes/*
• Server-side rendering + client-side fetch for dynamic UI
README
• Minimal description (“web laterne gino vale”) – no explicit architecture section.
• We infer stack: Node.js, Express, Jade (Pug), MySQL, JWT, Tailwind/PostCSS, Bootstrap/swiper.
Detailed capture of essential elements
• Break the server into sub-components matching the file tree:
• app.js/index.js (entry)
• config.js + db.js (setup)
• routes/ (10+ resource routes)
• controllers/ (CRUD + auth business logic)
• models/ (entities + associations)
• middlewares/authMiddleware.js
• libs/jwt.js
• public/ (static assets)
• Which controllers use JWT auth middleware.
• How dynamic fetch interactions bypass standard page rendering and hit JSON endpoints.