How kyrawest/runningthoughts works
Project type and purpose
• Full-stack server-rendered web application.
• Built on Node.js/Express with server-side EJS templates and Bootstrap.
• Organizes spoken or typed notes into “runs” per user, with authentication (Passport.js) and MongoDB persistence.
Main components
a. Frontend (Browser)
– Static assets: CSS, JS (speech recognition UI), images (src/public)
– EJS views & partials (src/views)
b. Backend (Express)
– Entry point: src/index.js & src/app.js
– Middleware: Helmet, bodyParser, Passport.js, connect-flash, custom error handlers
– Routes (src/routes) → Controllers (src/controllers) → Handlers (src/handlers) → Models (src/models)
– Validation: src/validators/validators.js
c. Database
– MongoDB via Mongoose schemas (user, run, note)
d. External / Browser APIs
– Passport.js (auth)
– WebKit SpeechRecognition (client-side speech-to-text)
Relationships & data flow
• Browser → HTTP requests (form or AJAX) → Express routes
• Routes → Controllers → Business logic (handlers/validators)
• Controllers → Mongoose models → MongoDB
• Controllers → render EJS views or redirect back → Browser
• Browser’s mic button leverages Web Speech API → sends text to server
Architectural patterns & principles
• MVC-style separation: Routes (entry), Controllers (coordination), Models (data)
• Middleware pipeline for auth, error handling, sanitization
• RESTful endpoints for CRUD on runs and notes
• Server-side rendering (no SPA) with progressive enhancement for speech input
Final checklist
• Clear labels (module names, file paths if desired)