How flaidhack/sistem-peminjaman-buku works
This is a web library-loan system: a browser uses the gateway for login, browsing, borrowing, and returns. The gateway verifies JWTs for protected routes and proxies to three API-key-protected services. Auth owns users, catalog owns book availability, and loan owns active loans; the loan route coordinates user/book checks, database updates, and compensating rollback. The README documents health aggregation and loan limits/due dates. Edges reflect excerpts or README statements; service wiring not shown in excerpts is cited to the README.
Main entry points: proxy.js Route proxy · loans.js Borrow and return · auth.js Login and users · books.js Books and availability
Components 16
Gateway access
- Web interface
frontend/script.js - Route proxy
api-gateway/routes/proxy.js - JWT verification
api-gateway/middleware/verifyJwt.js - Health aggregation
api-gateway/server.js
Identity
- Login and users
auth-service/routes/auth.js - User database
auth-service/db.js - API key guard
auth-service/middleware/apiKey.js
Book catalog
- Books and availability
catalog-service/routes/books.js - Book database
catalog-service/db.js - API key guard
catalog-service/middleware/apiKey.js
Loan circulation
- Borrow and return
loan-service/routes/loans.js - Loan database
loan-service/db.js - API key guard
loan-service/middleware/apiKey.js - User lookup client
loan-service/services/authClient.js - Book lookup client
loan-service/services/catalogClient.js
Other components
- Library user
Connections 19
- Library user → Web interface: uses
README.md - Web interface → Route proxy: requests API
README.md - Route proxy → JWT verification: verifies protected routes
api-gateway/routes/proxy.js - Route proxy → Login and users: proxies auth routes
README.md - Route proxy → Books and availability: proxies book routes
api-gateway/routes/proxy.js - Route proxy → Borrow and return: proxies loan routes
api-gateway/routes/proxy.js - Route proxy → API key guard: injects API key
README.md - Route proxy → API key guard: injects API key
api-gateway/routes/proxy.js - Route proxy → API key guard: injects API key
README.md - Health aggregation → Login and users: checks health
api-gateway/server.js - Health aggregation → Books and availability: checks health
api-gateway/server.js - Health aggregation → Borrow and return: checks health
api-gateway/server.js - Login and users → User database: queries users
auth-service/routes/auth.js - Books and availability → Book database: reads and updates
catalog-service/routes/books.js - Borrow and return → User lookup client: validates user
loan-service/routes/loans.js - User lookup client → Login and users: fetches user
README.md - Borrow and return → Book lookup client: checks book and status
loan-service/routes/loans.js - Book lookup client → Books and availability: fetches and updates
loan-service/services/catalogClient.js - Borrow and return → Loan database: records loans
loan-service/routes/loans.js