How resilient-labs/nourish works
Project type and purpose
• This is a full-stack MERN (MongoDB, Express.js, React, Node.js) application called “Nourish.”
• Purpose: A community-driven platform to locate Philly community fridges, share updates on restocking, maintenance, and general community posts.
File structure
• Top-level: “client” (React frontend) and “server” (Node/Express backend).
• client/src: React components (UI, pages, routing) plus Tailwind CSS and Flowbite for styling.
• server:
• config: database connection (MongoDB URI), Passport.js setup (JWT/local strategies)
• controllers: request handlers (auth, fridge, posts, profile, team)
• models: Mongoose schemas (User, CommunityFridge, Post, Comment, Team)
• middleware: auth guard, file uploads (multer + Cloudinary), error handling
• routes: express routers exposing RESTful endpoints (/auth, /fridge, /posts, /profile, /team)
README for additional insights
• Interactive map uses Leaflet inside React (FridgeMap component).
• Community board features comment posting, filtering by zip code.
• Authentication (sign up/in) with protected routes on the client.
• Cloudinary for storing images.
• Future roadmap: real-time updates, additional locations, user profiles.
Detail and essential architectural elements
• Server folders as sub-components: config, controllers, middleware, routes, models
• On the client side, show core pages (Home, FridgeLocations, Community) and shared components (Navbar, ProtectedRoute)
• Data flow for key scenarios:
1. User logs in → React form → POST /auth/login → Passport validates → JWT → stored in client
2. React fetches fridge list → GET /fridge → Express controller → MongoDB → JSON → React renders map + list
3. User posts a comment → React form → POST /posts → multer + Cloudinary → save in MongoDB → broadcast update