How alimotassem164/library-management-api works
Bibliotheca is a full-stack library system: users register or log in, then browse and administer books, borrow and return copies, and view account or monitoring information. The browser UI calls the FastAPI application, whose routers delegate domain operations to services and persist records through SQLAlchemy. Authentication and role checks protect these workflows; Redis caching is optional, while monitoring exposes in-memory metrics and logs. The graph uses README and indexed source references; unsampled module internals and some wiring are therefore not asserted beyond those references.
Main entry points: main.py Application and routes · auth/routes.py Authentication routes · books/routes.py Book endpoints · borrow/routes.py Borrow endpoints
Components 26
Web client
- Login and register
frontend/index.html - Library dashboard
frontend/dashboard.html - Dashboard controller
frontend/js/dashboard.js - API client
frontend/js/api.js
API and access
- Application and routes
backend/app/main.py - Authentication routes
backend/app/auth/routes.py - Authentication service
backend/app/auth/service.py - JWT security
backend/app/auth/security.py - Authentication and roles
backend/app/auth/dependencies.py - User records
backend/app/models/user.py
Library workflows
- Book endpoints
backend/app/books/routes.py - Book operations
backend/app/books/service.py - Book records
backend/app/books/model.py - Borrow endpoints
backend/app/borrow/routes.py - Borrow lifecycle
backend/app/borrow/service.py - Borrow permissions
backend/app/borrow/permissions.py - Borrow records
backend/app/borrow/model.py
Monitoring and infrastructure
- Database sessions
backend/app/core/database.py - Application settings
backend/app/core/config.py - SQL database
- Redis cache
- Cache access
backend/app/system/cache.py - Metrics store
backend/app/system/metrics.py - Logging
backend/app/system/logger.py - Monitoring dashboard
backend/app/dashboard/routes.py
Other components
- Library user
Connections 39
- Library user → Login and register: starts account
README.md - Library user → Library dashboard: uses library
README.md - Login and register → API client: requests API
README.md - Library dashboard → Dashboard controller: loads controller
README.md - Dashboard controller → API client: calls
frontend/js/dashboard.js - API client → Application and routes: sends requests
README.md - Application and routes → Authentication routes: registers routes
backend/app/main.py - Application and routes → Book endpoints: registers routes
backend/app/main.py - Application and routes → Borrow endpoints: registers routes
backend/app/main.py - Application and routes → Monitoring dashboard: registers routes
backend/app/main.py - Authentication routes → Authentication service: delegates
backend/app/auth/routes.py - Authentication routes → JWT security: creates tokens
backend/app/auth/routes.py - Authentication routes → Authentication and roles: checks identity
backend/app/auth/routes.py - Authentication service → User records: uses users
backend/app/auth/service.py - Authentication and roles → User records: loads user
backend/app/auth/dependencies.py - Authentication and roles → Application settings: reads JWT config
backend/app/auth/dependencies.py - Book endpoints → Book operations: delegates
backend/app/books/routes.py - Book endpoints → Authentication and roles: requires access
backend/app/books/routes.py - Book endpoints → Cache access: uses cache
backend/app/books/routes.py - Book operations → Book records: operates on
backend/app/books/service.py - Borrow endpoints → Borrow lifecycle: delegates
backend/app/borrow/routes.py - Borrow endpoints → Authentication and roles: requires access
backend/app/borrow/routes.py - Borrow endpoints → Cache access: uses cache
backend/app/borrow/routes.py - Borrow lifecycle → Borrow records: manages records
backend/app/borrow/service.py - Borrow lifecycle → Book records: checks availability
backend/app/borrow/service.py - Borrow lifecycle → Borrow permissions: checks permissions
backend/app/borrow/service.py - Borrow records → User records: relates user
backend/app/borrow/model.py - Borrow records → Book records: relates book
backend/app/borrow/model.py - Application and routes → Database sessions: initializes schema
backend/app/main.py - Database sessions → Application settings: reads database config
backend/app/core/database.py - Database sessions → SQL database: stores records
README.md - Book endpoints → Redis cache: optional cache
README.md - Borrow endpoints → Redis cache: optional cache
README.md - Cache access → Application settings: reads cache config
backend/app/system/cache.py - Monitoring dashboard → Metrics store: reads metrics
backend/app/dashboard/routes.py - Monitoring dashboard → Logging: reads logs
backend/app/dashboard/routes.py - Application and routes → Logging: logs requests
backend/app/main.py - Authentication routes → Metrics store: records auth events
backend/app/auth/routes.py - Authentication routes → Logging: logs auth events
backend/app/auth/routes.py