Hosting
Deploy and host your sources
Hosting Your Sources
Once you've built your host, you need to deploy it somewhere publicly accessible. Alethia connects to your host via HTTPS.
Deployment Options
You can deploy your host anywhere that can serve HTTP requests:
Serverless Platforms
| Platform | Pros | Cons |
|---|---|---|
| Cloudflare Workers | Free tier, global edge, fast | 10ms CPU limit on free tier |
| Vercel | Easy deployment, good DX | Cold starts |
| Netlify Functions | Simple setup | Cold starts |
| AWS Lambda | Scalable, flexible | More complex setup |
Traditional Hosting
| Platform | Pros | Cons |
|---|---|---|
| Railway | Simple, cheap | Less control |
| Fly.io | Global deployment | Learning curve |
| DigitalOcean | Full control, affordable | Self-managed |
| VPS | Complete control | Self-managed |
Recommendation
For most use cases, Cloudflare Workers or Vercel are the easiest options. Both have generous free tiers and handle scaling automatically.
Self-Hosting
Running your own server (home server, NAS, or local machine) offers unique advantages:
| Benefit | Description |
|---|---|
| Local source integration | Connect to self-hosted services like Komga, Suwayomi, Kavita, or LANraragi |
| Observability | Integrate with Prometheus, Grafana, or other monitoring stacks for detailed metrics and alerting |
| Privacy | Keep all traffic on your local network without relying on third-party services |
| No rate limits | Control your own resource allocation without platform restrictions |
| Custom caching | Implement aggressive caching strategies with Redis, SQLite, or filesystem caches |
Local Sources
Self-hosting is particularly valuable for creating adapters to local media servers. Your host can translate Komga's or Suwayomi's API into Alethia's format, letting you read your local library through Alethia.
Requirements
Your host must:
- Be accessible by your device — Alethia needs to reach it from user devices (and in extension, publically if you want others to use it)
- Use HTTPS — Required for security
- Handle CORS — Allow requests from Alethia Tools like the migrator
- Respond with JSON — All endpoints return JSON
CORS Configuration
Your host should allow cross-origin requests. Example headers:
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Content-Type, AuthorizationMigration Tools
If you restrict CORS to specific origins, you must include https://tools.alethia.moe to allow users to use the migration tools. Without this, users won't be able to import their library from other apps.
Recommended origins (if not using *):
https://tools.alethia.moeTesting Your Host
After deployment, verify your endpoints work:
# Get host manifest
curl https://your-host.com/
# Get source metadata
curl https://your-host.com/mangadex
# Health check
curl https://your-host.com/mangadex/health
# Ping upstream
curl https://your-host.com/mangadex/ping
# Search (POST request)
curl -X POST https://your-host.com/mangadex/search \
-H "Content-Type: application/json" \
-d '{"query": "one piece", "page": 1, "sort": "relevance"}'
# Get manga
curl https://your-host.com/mangadex/some-manga-slug
# Get chapters
curl https://your-host.com/mangadex/some-manga-slug/chapters
# Get chapter pages
curl https://your-host.com/mangadex/some-manga-slug/chapters/chapter-1Adding Your Host to Alethia
Once deployed:
- Open Alethia
- Go to Sources tab
- Tap the + button
- Enter your host URL (e.g.,
https://your-host.com) - Tap Test to verify connectivity
- Tap Save
Your sources will now appear in the app.
Best Practices
Rate Limiting
Implement rate limiting to protect upstream sources from abuse:
100 requests per minute per IP (recommended)Error Handling
Return consistent error responses:
{
"error": {
"code": "MANGA_NOT_FOUND",
"message": "The requested manga could not be found"
}
}Caching
Cache upstream responses where appropriate to reduce load and improve performance. Consider:
- Source metadata: Cache for hours
- Search results: Cache for minutes
- Manga details: Cache for minutes to hours
- Chapter lists: Cache for minutes
- Page URLs: Don't cache (may expire)
Logging
Log requests and errors for debugging. Avoid logging sensitive data like authentication credentials.
Health Monitoring
Implement the /health and /ping endpoints so you can monitor your host's status and upstream connectivity.