How govtechmy/sekolahku-mod-api works
Sekolahku Mod API is a Fastify backend for Malaysian school data and related content. Requests enter through the server and registered API routes; the documented protected endpoints cover school search/catalog, events, broadcasts, and revalidation, with additional map, analytics, calendar, and visitor APIs. The shown school flow authenticates requests, runs controller logic and searches MongoDB-backed school records. The README documents broader features, but most domain route/controller wiring was not sampled, so those links are omitted rather than inferred.
Main entry points: index.route.ts Route registry · server.ts Fastify server · schools.routes.ts School routes · schools.controller.ts School handlers
Components 19
API Runtime
- Fastify server
src/server.ts - Route registry
src/routes/index.route.ts - API key auth
src/middleware/auth.middleware.ts - Zod schemas
src/schemas - Server plugins
src/plugins/index.plugin.ts
School Catalog
- School routes
src/routes/schools.routes.ts - School handlers
src/controllers/schools.controller.ts - School search
src/services/school-search.svc.ts
Content APIs
- Events API
src/routes/acara.route.ts - Broadcast API
src/routes/siaran.route.ts - Calendar API
src/routes/takwim.route.ts - Analytics API
src/routes/analitik.route.ts - Maps API
src/routes/map.route.ts - Revalidation API
src/routes/revalidate.route.ts - Visitor API
src/routes/pelawat.route.ts
Persistence
- School records
src/models/entiti-sekolah.model.ts - DB connections
src/config/db.config.ts - Content records
src/models
Other components
- API client
Connections 17
- API client → Fastify server: sends requests
README.md - Fastify server → Server plugins: registers plugins
src/server.ts - Fastify server → Route registry: registers routes
src/server.ts - Fastify server → DB connections: connects database
src/server.ts - Route registry → School routes: registers
src/routes/index.route.ts - Route registry → Events API: registers
src/routes/index.route.ts - Route registry → Broadcast API: registers
src/routes/index.route.ts - Route registry → Calendar API: registers
src/routes/index.route.ts - Route registry → Analytics API: registers
src/routes/index.route.ts - Route registry → Maps API: registers
src/routes/index.route.ts - Route registry → Revalidation API: registers
src/routes/index.route.ts - Route registry → Visitor API: registers
src/routes/index.route.ts - School routes → API key auth: guards requests
src/routes/schools.routes.ts - School routes → School handlers: dispatches handlers
src/routes/schools.routes.ts - School handlers → School search: uses search logic
src/controllers/schools.controller.ts - School handlers → School records: queries records
src/controllers/schools.controller.ts - School records → DB connections: uses connection
src/models/entiti-sekolah.model.ts