How thiagops5/jwt-api works
This is a Node.js REST API for library operations. The main workflow is an attendant or administrator sending requests to the API: authentication and role checks gate resource operations; catalog and reader records support loan creation and returns; the API persists state in SQLite and exposes administrator dashboard totals. The README documents the domain capabilities and module layering. Relationships below are limited to README statements and source-index references or excerpts; unsampled implementation details are not inferred.
Main entry points: index.js HTTP Server · models/index.js Model Associations · auth.service.js Token Service · auth.router.js Auth Routes
Components 27
API and Auth
- HTTP Server
index.js - Auth Routes
auth/auth.router.js - Auth Controller
auth/auth.controller.js - Token Service
auth/auth.service.js - Auth Guards
auth/auth.middleware.js - Refresh Tokens
auth/refreshToken.model.js - Logout Blacklist
auth/logoutList.model.js
People and Catalog
- User Routes
user/user.router.js - User Controller
user/user.controller.js - User Service
user/user.service.js - User Model
user/user.model.js - Category API
category/category.controller.js - Category Service
category/category.service.js - Author API
author/author.controller.js - Author Service
author/author.service.js - Book API
book/book.controller.js - Book Service
book/book.service.js
Circulation
- Reader API
reader/reader.controller.js - Reader Service
reader/reader.service.js - Loan API
loan/loan.controller.js - Loan Service
loan/loan.service.js
Reporting
- Dashboard API
report/report.controller.js - Report Service
report/report.service.js
Persistence
- Model Associations
models/index.js - SQLite Connection
config/db.js - SQLite Store
database.sqlite
Other components
- API Client
Connections 37
- API Client → HTTP Server: sends requests
README.md - HTTP Server → Auth Routes: mounts routes
index.js - HTTP Server → User Routes: mounts routes
index.js - HTTP Server → Category API: mounts routes
index.js - HTTP Server → Author API: mounts routes
index.js - HTTP Server → Book API: mounts routes
index.js - HTTP Server → Reader API: mounts routes
index.js - HTTP Server → Loan API: mounts routes
index.js - HTTP Server → Dashboard API: mounts routes
index.js - HTTP Server → SQLite Connection: connects database
index.js - HTTP Server → Model Associations: initializes models
index.js - HTTP Server → Auth Routes: loads seed
index.js - Auth Routes → Auth Controller: routes requests
auth/auth.router.js - Auth Routes → Auth Guards: guards routes
auth/auth.router.js - Auth Controller → Token Service: calls
auth/auth.controller.js - Auth Guards → Token Service: verifies tokens
auth/auth.middleware.js - Token Service → User Service: looks up users
auth/auth.service.js - Token Service → Refresh Tokens: rotates tokens
auth/auth.service.js - Token Service → Logout Blacklist: blacklists tokens
auth/auth.service.js - User Routes → User Controller: routes requests
user/user.router.js - User Routes → Auth Guards: guards routes
user/user.router.js - User Controller → User Service: calls
user/user.controller.js - User Service → User Model: queries users
user/user.service.js - Category API → Category Service: calls
category/category.controller.js - Category Service → Model Associations: uses models
category/category.service.js - Author API → Author Service: calls
author/author.controller.js - Author Service → Model Associations: uses models
author/author.service.js - Book API → Book Service: calls
book/book.controller.js - Book Service → Model Associations: uses models
book/book.service.js - Reader API → Reader Service: calls
reader/reader.controller.js - Reader Service → Model Associations: uses models
reader/reader.service.js - Loan API → Loan Service: calls
loan/loan.controller.js - Loan Service → Model Associations: uses models
loan/loan.service.js - Dashboard API → Report Service: calls
report/report.controller.js - Report Service → Model Associations: uses models
report/report.service.js - Model Associations → SQLite Connection: uses connection
models/index.js - SQLite Connection → SQLite Store: stores data
config/db.js