How fitsumhelina/business-directory-backend works
This is an Express backend for a business directory. Users register or sign in, then access profile and password-recovery APIs; business owners can register and manage listings, while users can browse, search, and filter them. Route modules dispatch requests to controllers, which query PostgreSQL through Prisma; authentication middleware verifies JWTs on protected routes. The README also describes ratings/reviews and admin approval, but those implementations are not visible in the sampled source, so they are shown as documented capabilities rather than inferred runtime flows.
Main entry points: userController.js User accounts · businessController.js Listings and search · app.js Express server · userRoutes.js User routes
Components 14
API and routing
- Express server
app.js - User routes
routes/userRoutes.js - Business routes
routes/businessRoutes.js
Identity and access
- JWT verification
middleware/authMiddleware.js - User accounts
controllers/userController.js - Image uploads
utils/upload.js
Business directory
- Listings and search
controllers/businessController.js - Category seeding
prisma/seed.js - Ratings and reviews
controllers - Admin approval
controllers
Persistence and integrations
- Prisma ORM
controllers/businessController.js - PostgreSQL
prisma/schema.prisma - Email delivery
Other components
- API client
Connections 15
- API client → Express server: sends requests
app.js - Express server → User routes: mounts routes
app.js - Express server → Business routes: mounts routes
app.js - User routes → User accounts: dispatches to
routes/userRoutes.js - Business routes → Listings and search: dispatches to
routes/businessRoutes.js - User routes → JWT verification: guards profiles
routes/userRoutes.js - Business routes → JWT verification: guards changes
routes/businessRoutes.js - User accounts → Image uploads: invokes upload
controllers/userController.js - User accounts → Prisma ORM: queries users
controllers/userController.js - Listings and search → Prisma ORM: queries listings
controllers/businessController.js - Prisma ORM → PostgreSQL: persists data
- Category seeding → PostgreSQL: seeds categories
- User accounts → Email delivery: sends reset code
controllers/userController.js - Ratings and reviews → Listings and search: supports directory
readme.md - Admin approval → Listings and search: approves listings
readme.md