miruzo-core is the FastAPI/SQLModel backend that powers the miruzo photo archive. It serves REST APIs for image browsing, scoring, and love actions, and ships an importer pipeline that ingests gataku assets into SQLite or PostgreSQL.
- REST API for listing images, fetching contexts, and posting love actions
- Importer tooling to populate the database and generate thumbnails/variants
- SQLite (default) and PostgreSQL repositories with shared business logic
- Pure helper modules for variant normalization and query parsing
- OpenAPI metadata automatically generated via Pydantic models
Human-friendly size units are not universal — they are shaped by culture and convention.
miruzo defines manbytes, a size unit based on a 104-byte scale (the Japanese “man” unit), and uses it in its API to represent image file sizes.
While inspired by the Japanese numeric system, manbytes is designed for practical use: it provides a stable, human-scaled representation that works well for image-heavy UIs and delivery strategies.
For a detailed explanation of the rationale, design trade-offs, and exact
definitions, see docs/unit.md.
Run miruzo-core locally by following these steps.
- Python 3.13 (respect
.python-version; keep code 3.10+ compatible) - Git
- Docker (only if you need to run the PostgreSQL repository tests)
- Clone and install dependencies
git clone https://github.com/mntone/miruzo-core.git && cd miruzo-core && pip install -r requirements.txt - Copy the sample environment file
cp .env.development .envand adjust paths/DSNs (see AGENTS.md). - Start the API
uvicorn app.main:app --reload - (Optional) Run importer help to confirm configuration
python importers/gataku_import.py --help
pytest: Run the default test suite (SQLite, service, variants, etc.)pytest tests/services/images/repository/test_postgre.py: Run Docker-backed PostgreSQL repository tests (pullspostgres:18-alpine)ruff check app tests: Lint the codebase
-
Start the API (
uvicorn app.main:app --reload). -
Point miruzo-web or other clients to the running host (default
http://127.0.0.1:1024/api). -
Use importer commands to populate the database:
python importers/gataku_import.py --jsonl path/to/data.jsonl
-
Hit
/api/i/latestor/api/i/{ingest_id}to verify data is available.
All configuration flows through .env.development using
pydantic-settings. Key variables include:
DATABASE_BACKEND:sqlite(default) orpostgresDATABASE_URL: SQLAlchemy DSN (e.g.,sqlite:///var/miruzo.sqlite,postgresql://user:pass@host/db)GATAKU_ROOT/GATAKU_ASSETS_ROOT/MEDIA_ROOT: filesystem roots for importer + media filesVARIANT_LAYERS: loaded fromapp/config/variant.py
- SQLite: default development backend; in-memory mode used for most tests
- PostgreSQL: optional backend for production; Docker test suite available
This project is licensed under the terms of the GNU General Public License v3.0
(GPLv3). See the LICENSE file for full details. You are free to
use, modify, and distribute this software under the terms of the GPL, provided
that any derivative work is also distributed under the same license.
Interested in contributing? See CONTRIBUTING.md and
AGENTS.md.
- miruzo-web — Solid.js frontend that consumes the core APIs
- gataku — Source asset repository used by the importer
miruzo-core is developed and maintained by mntone.
- GitHub: https://github.com/mntone
- Mastodon: https://mstdn.jp/@mntone
- X: https://x.com/mntone