How fullerzz/smolvault works
Project type and purpose
• Smolvault is a backend‐only, self‐hosted file storage service. It’s a Python REST API built with FastAPI, designed to run on a Raspberry Pi.
• Responsibilities: manage users, store file metadata in SQLite, store file contents in S3, and cache files locally for faster subsequent downloads.
File structure
• Top‐level:
• src/smolvault – core application code
– auth/ (token decoding, auth models)
– cache/ (cache_manager.py)
– clients/ (AWS S3 & SQLite DB clients)
– main.py, config.py, models.py, validators/
• scripts/ – startup/test shell scripts
• terraform/ – IaC to provision AWS IAM roles, policies & S3 bucket
• tests/ – pytest suite covering API endpoints, cache, security
• CI config in .github/workflows
• Key configuration: logging.conf, pyproject.toml, requirements.txt
README for additional insights
• Confirms FastAPI, SQLite for metadata, AWS S3 for storage, local file caching on server.
• Terraform directory provisions IAM resources & S3 bucket.
• Client (curl/HTTP client)
• FastAPI Application
– Authentication Module
– Request Validation
– Business Logic
– Cache Manager
• SQLite Database (metadata store)
• Local File Cache (filesystem on Raspberry Pi)
• AWS S3 Bucket (remote object store)
• AWS IAM (roles/policies provisioned by Terraform)
• Terraform (IaC controller)
• CI/CD pipelines (GitHub Actions) – optional overlay
b. Relationships & interactions:
1. Client → FastAPI (HTTPS)
2. Auth Module ↔ JWT Decoder → validators
3. FastAPI → SQLite Client → metadata table
4. FastAPI → AWS S3 Client → S3 bucket (PUT/GET)
5. File GET: check Local Cache → hit? serve. miss? fetch from S3 → write Local Cache → serve.
6. Terraform → AWS (IAM & S3 provisioning)
7. GitHub Actions → on push: run tests, linters, gitleaks
c. Architectural patterns & principles:
• Layered API design (routing → validation → business logic → data access)
• Dependency‐injection via FastAPI’s DI for clients & config
• Separation of concerns: auth, caching, storage, validation modules
• Infrastructure as code for repeatable AWS resource provisioning
d. Relevant technologies & frameworks:
• FastAPI, Pydantic (models & validation)
• SQLite (sqlite3 or SQLAlchemy client)
• boto3 (AWS S3)
• Terraform (IaC)
• pytest, pytest-factoryboy for testing
• GitHub Actions for CI/CD