How ajahwisdomagaba/nysc-connect works
NYSC Connect is an Express API for corps members relocating to unfamiliar states. Its central workflow is account registration/login, then searching vetted accommodation by location and budget; landlords can submit listings and photos, while users can save items and report problems for admin review. The API also provides local guides and state/location data. The graph follows documented route wiring and sampled controller/service calls; some capabilities are represented at their source directories because their implementation excerpts were not provided.
Main entry points: index.js API router · accommodation.controller.js Listing intake and detail · report.controller.js Scam reporting and moderation · auth.routes.js Auth routes
Components 27
API runtime
- Express server
server.js - API router
src/routes/index.js
Identity and access
- Auth routes
src/routes/auth.routes.js - Registration and login
src/controllers/auth.controller.js - JWT access guard
src/middlewares/auth.middleware.js
Housing and media
- Accommodation routes
src/routes/accommodation.routes.js - Listing intake and detail
src/controllers/accommodation.controller.js - Housing search
src/services/accommodation.service.js - Search filters
src/utils/buildAccommodationQuery.js - Photo upload
src/controllers/media.controller.js - Upload handling
src/middlewares/upload.middleware.js - Cloudinary upload helper
src/utils/cloudinaryUpload.js
Guides and safety
- Local guide routes
src/routes/localinfo.route.js - Local information
src/controllers/localInfo.controller.js - State and LGA lookup
src/controllers/location.controller.js - Saved items
src/controllers/saved.controller.js - Scam reporting and moderation
src/controllers/report.controller.js
Persistence and locations
- User records
src/models/User.js - Accommodation records
src/models/Accommodation.js - Local guide records
src/models/LocalInfo.js - Location records
src/models/Location.js - Saved records
src/models/SavedItem.js - Report records
src/models/Report.js - Database connection
src/config/db.js
Other components
- Corps member
- MongoDB
- Cloudinary
Connections 26
- Express server → API router: mounts routes
server.js - Express server → Database connection: connects database
server.js - API router → Auth routes: mounts
src/routes/index.js - API router → Accommodation routes: mounts
src/routes/index.js - API router → Local guide routes: mounts
src/routes/index.js - Corps member → Express server: uses API
- Auth routes → Registration and login: routes requests
src/routes/auth.routes.js - Auth routes → JWT access guard: protects profile
src/routes/auth.routes.js - Registration and login → User records: reads and writes
src/controllers/auth.controller.js - JWT access guard → User records: loads account
src/middlewares/auth.middleware.js - Accommodation routes → Listing intake and detail: routes requests
src/routes/accommodation.routes.js - Accommodation routes → JWT access guard: protects changes
src/routes/accommodation.routes.js - Listing intake and detail → Housing search: searches listings
src/controllers/accommodation.controller.js - Housing search → Search filters: builds filters
src/services/accommodation.service.js - Housing search → Accommodation records: queries listings
src/services/accommodation.service.js - Listing intake and detail → Accommodation records: creates and updates
src/controllers/accommodation.controller.js - Listing intake and detail → User records: checks ownership
src/controllers/accommodation.controller.js - Photo upload → Cloudinary upload helper: stores photos
src/controllers/media.controller.js - Local guide routes → Local information: routes requests
src/routes/localinfo.route.js - Local information → Local guide records: reads and writes
src/controllers/localInfo.controller.js - State and LGA lookup → Location records: reads locations
- Saved items → Saved records: manages saved items
src/controllers/saved.controller.js - Scam reporting and moderation → Report records: creates and reviews
src/controllers/report.controller.js - Scam reporting and moderation → Accommodation records: hides reported listing
src/controllers/report.controller.js - Scam reporting and moderation → Local guide records: hides reported guide
src/controllers/report.controller.js - Database connection → MongoDB: connects