How belmarbelmar/storage_service works
This repository implements a Zero-Trust file-storage API: users request and verify an email OTP, then use a JWT to upload, list, download, or delete files. Uploads are validated and stored as MinIO objects while metadata is persisted in PostgreSQL; downloads use pre-signed URLs. The README also documents Nginx routing and centralized logging/visualization. Source excerpts establish the API’s calls to authentication, storage, and metadata code; infrastructure relationships are included only where documented in the README.
Main entry points: main.py API routes · auth.py OTP and JWT · storage.py Storage service · database.py Metadata access
Components 14
API workflow
- API routes
api/main.py - Configuration
api/config.py - File validation
api/main.py
Identity
- OTP and JWT
api/auth.py
File storage
- Storage service
api/storage.py - MinIO objects
- Metadata access
api/database.py
Platform services
- Nginx proxy
nginx/conf.d/zerotrust.conf - SMTP / MailHog
- PostgreSQL
- Log collection
nginx/promtail-config.yml - Loki
nginx/loki-config.yml - Grafana
Other components
- User
Connections 13
- User → Nginx proxy: sends requests
README.md - Nginx proxy → API routes: routes requests
README.md - API routes → OTP and JWT: requests or verifies OTP
api/main.py - OTP and JWT → SMTP / MailHog: sends OTP email
api/auth.py - API routes → OTP and JWT: validates JWT
api/main.py - API routes → File validation: validates uploads
api/main.py - API routes → Storage service: stores and retrieves objects
api/main.py - Storage service → MinIO objects: reads and writes objects
api/storage.py - API routes → Metadata access: writes and queries metadata
api/main.py - Metadata access → PostgreSQL: persists metadata
api/database.py - API routes → Configuration: reads settings
api/main.py - Log collection → Loki: ships logs
README.md - Grafana → Loki: visualizes logs
README.md