Alethia - Docs

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

PlatformProsCons
Cloudflare WorkersFree tier, global edge, fast10ms CPU limit on free tier
VercelEasy deployment, good DXCold starts
Netlify FunctionsSimple setupCold starts
AWS LambdaScalable, flexibleMore complex setup

Traditional Hosting

PlatformProsCons
RailwaySimple, cheapLess control
Fly.ioGlobal deploymentLearning curve
DigitalOceanFull control, affordableSelf-managed
VPSComplete controlSelf-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:

BenefitDescription
Local source integrationConnect to self-hosted services like Komga, Suwayomi, Kavita, or LANraragi
ObservabilityIntegrate with Prometheus, Grafana, or other monitoring stacks for detailed metrics and alerting
PrivacyKeep all traffic on your local network without relying on third-party services
No rate limitsControl your own resource allocation without platform restrictions
Custom cachingImplement 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:

  1. Be accessible by your device — Alethia needs to reach it from user devices (and in extension, publically if you want others to use it)
  2. Use HTTPS — Required for security
  3. Handle CORS — Allow requests from Alethia Tools like the migrator
  4. 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, Authorization

Migration 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.moe

Testing 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-1

Adding Your Host to Alethia

Once deployed:

  1. Open Alethia
  2. Go to Sources tab
  3. Tap the + button
  4. Enter your host URL (e.g., https://your-host.com)
  5. Tap Test to verify connectivity
  6. 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.

On this page