You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.5 KiB
2.5 KiB
Architecture
Iron is an async Python modular monolith with a React single-page Web app.
System Overview
Browser UI
|
FastAPI app
|
Services
|
Repositories
|
SQLite metadata database
|
Storage adapters: local, S3
Backend
Core stack:
- FastAPI
- SQLAlchemy 2.x async ORM
- SQLite via
aiosqlite - Alembic migrations
- durable in-process jobs stored in SQLite
Important packages:
app/api/: route handlers and dependency wiringapp/services/: business logicapp/repositories/: database accessapp/models/: SQLAlchemy entitiesapp/schemas/: API schemasapp/adapters/storage/: storage backends
Frontend
Core stack:
- Vite
- React
- TypeScript
- React Router
- TanStack Query
Source lives in frontend/. Built assets are emitted into app/web/dist/ and
served by FastAPI at /app.
Data Model
Main tables:
usersauth_sessionsdirectoriesfile_entriesfile_versionsblobsblob_replicasbackendsupload_sessionsupload_session_partsjobsplacement_policiespreview_artifactscache_entries
Design principles:
- logical namespace is separate from physical storage placement
- files have immutable content versions
- physical content is represented as blobs and replicas
- user-facing deletion uses recycle-bin semantics
- jobs are durable and retryable
- backend-specific configuration stays behind adapter boundaries
Upload And Read Path
Uploads use tus transport under /files.
Flow:
- create upload session
- append bytes with
PATCH - finalize through the API
- create file metadata, version, blob, and local replica
- enqueue replication or preview jobs when needed
Read path:
- resolve file and current version
- find the best local or cached blob
- if needed, materialize a ready remote replica into cache
- serve download, preview, or range stream
Browser File Access
JSON APIs use bearer-token authorization through the shared frontend API client.
Browser preview and download must not use naked /api/files/... media URLs in
img, iframe, video, or window.open. Fetch file content with
authorization, create an object URL, use it, then revoke it.
This is covered by the Playwright E2E flow.
Jobs
Jobs are stored in SQLite and executed by the in-process job loop.
Current job types include:
- blob replication
- preview artifact generation
- backend health checks
- full reconcile
- file reconcile
Every job should be safe to retry.