API development
The API root is an orchestration repository. Each pinchana-* directory is an independent Python 3.13+ package with its own pyproject.toml, uv.lock, Dockerfile, and src/pinchana_<name>/ package. Shared models, storage, music, Docker, plugin, and VPN code live in pinchana-core.
Run one service
Section titled “Run one service”Work inside its package:
cd pinchana-instuv syncVPN_ENABLED=false uv run uvicorn pinchana_inst.main:app --reload --port 8082uv run python -c "import pinchana_inst; print('ok')"Service ports are gateway 8080, TikTok 8081, Instagram 8082, Shorts 8083, SoundCloud 8084, YouTube Music 8085, Spotify 8086, Deezer 8087, Threads 8088, and Twitter 8089. Gluetun control is 8000.
Build a service image from the repository root because Dockerfiles copy both core and target service:
docker build -f pinchana-inst/Dockerfile -t pinchana-inst .docker compose -f docker-compose.dev.yml up -d --buildCoverage is currently module-specific. Instagram has the documented suite:
cd pinchana-instuv run pytestPINCHANA_INST_LIVE=1 uv run pytestThreads also contains pytest tests. Live tests contact external platforms and must be explicitly enabled/provided with their documented target; ordinary validation should prefer unit tests, imports, and local /health requests.
Add a scraper module
Section titled “Add a scraper module”- Add a
pinchana-<name>package/submodule withsrc/pinchana_<name>/main.py, a FastAPIapp,POST /scrape,GET /health, Dockerfile,pyproject.toml, anduv.lock. - Depend on
pinchana-core, useScrapeRequest/ScrapeResponse, store files beneath the shared cache, and return/media/{platform}/{post_id}/{filename}paths. - Register URL patterns, port, endpoint, image tag, name, network, volume, and environment in
config/modules.yaml. - Add matching production and development Compose services. Production shares Gluetun’s namespace; development exposes a direct port and uses its Compose DNS endpoint.
- Add every configurable port, endpoint, name, image, and module-specific option to
.env.example. - Extend
.github/workflows/docker-publish.ymlservice detection and Dockerfile mapping, then document the platform/result behavior.