How rohmanahmad/api-core works
Salesapp is a Fastify API for marketplace-style sales workflows, with client, partner and admin zones. Requests enter through registered v1 routes, are dispatched to controllers, and (where shown) invoke domain services before returning JSON. Product discovery, categories, reviews, authentication and Google sign-in are distinct API stages; PostgreSQL-backed models provide persistence. The repository also exposes Swagger documentation and UI. Several routes, services and models are indexed but not excerpted, so their internal call paths are left unspecified rather than inferred.
Main entry points: models/index.js SQL model base · routes/index.js v1 route registry · CallbacksController.js Google callback · bootstrap.js Fastify server
Components 34
API runtime
- Fastify server
bootstrap.js - v1 route registry
modules/v1.0/routes/index.js - Product routes
modules/v1.0/routes/components/ProductsRoutes.js - Category routes
modules/v1.0/routes/components/CategoriesRoutes.js - Review routes
modules/v1.0/routes/components/ReviewsRoutes.js - Authentication routes
modules/v1.0/routes/components/AuthenticationRoutes.js - Callback routes
modules/v1.0/routes/components/CallbacksRoutes.js - Account routes
modules/v1.0/routes/components/UserAccountsRoutes.js - Webview routes
modules/v1.0/routes/components/WebviewRoutes.js
Marketplace domains
- Product controller
modules/v1.0/controllers/ProductsController.js - Category controller
modules/v1.0/controllers/CategoriesController.js - Review controller
modules/v1.0/controllers/ReviewsController.js - Product service
modules/v1.0/services/ProductsService.js - Category service
modules/v1.0/services/CategoriesService.js - Review service
modules/v1.0/services/ReviewsService.js
Identity
- Authentication controller
modules/v1.0/controllers/AuthenticationController.js - Authentication service
modules/v1.0/services/AuthenticationService.js - Google callback
modules/v1.0/controllers/CallbacksController.js - Google auth helper
modules/v1.0/helpers/GoogleAuthHelper.js - User controller
modules/v1.0/controllers/UserController.js - Account service
modules/v1.0/services/UserAccountsService.js - Token service
modules/v1.0/services/UserTokensService.js - Authentication middleware
modules/v1.0/middlewares/AuthenticationMiddleware.js
Persistence
- Product records
modules/v1.0/models/components/ProductsModel.js - Category records
modules/v1.0/models/components/CategoriesModel.js - Review records
modules/v1.0/models/components/ReviewsModel.js - Account records
modules/v1.0/models/components/UserAccountsModel.js - OTP records
modules/v1.0/models/components/OTPCodeModel.js - User token records
modules/v1.0/models/components/UserTokensModel.js - SQL model base
modules/v1.0/models/index.js
API documentation
- Swagger plugin
customize/fastify-swagger/index.js - Dynamic spec
customize/fastify-swagger/dynamic.js - Spec and UI routes
customize/fastify-swagger/routes.js
Other components
- API clients
Connections 30
- API clients → Fastify server: sends request
bootstrap.js - Fastify server → v1 route registry: registers routes
bootstrap.js - v1 route registry → Product routes: includes
- v1 route registry → Category routes: includes
- v1 route registry → Review routes: includes
- Product routes → Product controller: dispatches to
modules/v1.0/routes/components/ProductsRoutes.js - Category routes → Category controller: dispatches to
modules/v1.0/routes/components/CategoriesRoutes.js - Review routes → Review controller: dispatches to
modules/v1.0/routes/components/ReviewsRoutes.js - Authentication routes → Authentication controller: dispatches to
- Callback routes → Google callback: dispatches to
- Account routes → User controller: dispatches to
- Product controller → Product service: calls
modules/v1.0/controllers/ProductsController.js - Category controller → Category service: calls
- Review controller → Review service: calls
modules/v1.0/controllers/ReviewsController.js - Authentication controller → Authentication service: calls
- Google callback → Google auth helper: validates token
modules/v1.0/controllers/CallbacksController.js - Google callback → Account service: gets account
modules/v1.0/controllers/CallbacksController.js - Google callback → Token service: gets token
modules/v1.0/controllers/CallbacksController.js - Authentication service → Account records: looks up login
modules/v1.0/services/AuthenticationService.js - Authentication service → OTP records: checks OTP
modules/v1.0/services/AuthenticationService.js - Fastify server → Swagger plugin: registers docs
bootstrap.js - Swagger plugin → Dynamic spec: loads spec
customize/fastify-swagger/index.js - Dynamic spec → Spec and UI routes: uses routes
customize/fastify-swagger/dynamic.js - Spec and UI routes → API clients: serves spec and UI
customize/fastify-swagger/routes.js - Product records → SQL model base: extends
- Category records → SQL model base: extends
modules/v1.0/models/components/CategoriesModel.js - Review records → SQL model base: extends
modules/v1.0/models/components/ReviewsModel.js - Account records → SQL model base: extends
- OTP records → SQL model base: extends
- User token records → SQL model base: extends