How pmg1601/memories works
Project type and purpose
• This is a MERN-style full-stack web application named “memories.”
• Purpose: allow users to sign up/log in, create/read/update/delete “memory” cards (posts) with titles, messages, images, and comments.
File structure
Top-level:
• client/ – React single-page application
• server/ – Node.js + Express REST API
• HowItWorks.md, README.md – documentation
client/:
• src/ – React components, Redux actions & reducers, API wrapper
• public/ – static HTML, manifest, redirects
• build/ – production bundle (static assets)
server/:
• index.js – app entrypoint (Express app, DB connection, middleware)
• controllers/ – postsController.js, userController.js (business logic)
• routes/ – postsRoutes.js, userRoutes.js (URL → controller mapping)
• models/ – Mongoose schemas (postMessageModel.js, userModel.js)
• middleware/ – authMiddleware.js (JWT verification)
• Procfile – Heroku deployment descriptor
README
• Confirms that the app is for posting and browsing life memories in card form.
• Likely uses JWT for auth, MongoDB for storage, Redux for client-side state.
a. Main components
1. Browser/Client (React + Redux SPA)
2. REST API Server (Node.js + Express)
3. Database (MongoDB via Mongoose)
4. Authentication layer (JWT issuing & validation)
5. (Optional) Static asset host or CDN for client build
6. Deployment platforms (Heroku for server, Netlify/Vercel for client or bundled in Express)
b. Relationships & interactions
• User ▶ React UI (interacts via clicks, form submissions)
• React ▶ Redux store ▶ dispatch(actions) ▶ API calls (axios/fetch)
• Frontend HTTP requests ▶ Express routes (e.g. /posts, /users/auth)
• Express routes ▶ middleware ▶ controllers ▶ models ▶ MongoDB
• Controllers return JSON ▶ client updates UI via Redux
c. Architectural patterns
• Client: Flux/Redux for unidirectional data flow, container/components split
• Server: MVC-inspired (routes → controllers → models)
• RESTful API design for CRUD operations on “memories” and user auth
• JWT-based stateless authentication (authMiddleware)
d. Key technologies & libraries
• React, Redux, React-Redux, React Router (frontend)
• Axios or fetch for HTTP calls (client/src/api)
• Express, Mongoose, JSON Web Token (server)
• Heroku (Procfile), Node.js, npm