How kadakwnl/crowd-connect works
CrowdConnect is a classic MERN, two-tier web app:
• Frontend: React (Vite) SPA with React Router, Leaflet maps, Axios.
• Backend: Node/Express REST API with JWT auth + bcrypt, MongoDB via Mongoose.
• Purpose: discover and create local events, with map-based browsing and pin-drop event creation; role-gated “host” capabilities.
• SPA → REST API → MongoDB
• Auth flows (JWT issuance + JWT-protected routes)
• Event/map data flow (events list used to render markers/cards; event creation captures lat/lng)
• Role/authorization constraints (host-only create; owner-only update/delete)
Use the repository structure to drive a high-fidelity decomposition.
From frontend/src:
• Entry + routing shell
• main.jsx (bootstraps app)
• App.jsx (router/layout orchestration)
• Pages (route-level components): src/pages/*
• Home.jsx (likely map + event list)
• EventDetail.jsx
• CreateEvent.jsx (pin-drop / geolocation)
• ManageEvents.jsx (host CRUD)
• AttendeesList.jsx (implies event-attendance or participants view)
• HostToggle.jsx (host status switch)
• Login.jsx, Signup.jsx
• UserProfile.jsx, About.jsx
• Reusable components
• components/Navbar.jsx
• components/EventCard.jsx
• API client / integration point
• services/api.js (Axios wrapper; attaches JWT from localStorage)
• Styling
• src/styles/* including Leaflet.css and per-page CSS
• External dependency shown in README
• Leaflet / react-leaflet using OpenStreetMap tiles
From backend/:
• App entry
• server.js (Express app, routing mount points, CORS, env, listen)
• DB connectivity
• config/db.js (connect MongoDB via Mongoose)
• Models (domain objects)
• models/User.js (includes isHost flag; hashed password)
• models/Event.js (title/details + geolocation fields; probably owner/user reference)
• Middleware (cross-cutting)
• middleware/auth.js (JWT verification; attaches user to request; used by protected routes)
• Routes (REST surface area)
• routes/auth.js → /api/auth/* (signup/login issues JWT)
• routes/users.js → /api/users/* (me, toggle-host)
• routes/events.js → /api/events/* (CRUD; host-only create; owner-only update/delete)
• Collections correspond to User and Event Mongoose schemas.
Frontend renders
• Leaflet markers (lat/lng from events)
• EventCard list
CreateEvent.jsx captures lat/lng by
• Click (pin drop), or
• Browser geolocation API (“Use My Location”)
Important architectural patterns to highlight (from tree + README)
• SPA + REST separation (frontend independent of backend)
• Express Router modularization (routes/*) + cross-cutting auth middleware
• Mongoose ODM as data access layer
• Role-based access (host flag) and resource ownership checks (owner-only updates)
• External dependency for mapping tiles (OpenStreetMap) + client-side map rendering (Leaflet)
What “very detailed” means for this repo (specific checklist)
• Explicit mention of localStorage as token store on the frontend
• Explicit role constraint: host-only event creation
• Explicit owner constraint: update/delete by owner
• Explicit Leaflet + OpenStreetMap tiles dependency (often missed, but core to the product)