Run it yourself
The website can stay online without the API. To analyze your own images, run the API on your computer or deploy your own copy.
Requirements
- Python 3.11 to 3.13 for the API.
- Node.js 20 or newer for the website.
- The first install is large because it includes PyTorch, so it can take a while.
1. Start the API
cd apps/api
python -m venv .venv
# Windows (PowerShell): .venv\Scripts\Activate.ps1
# macOS or Linux: source .venv/bin/activate
python -m pip install -r requirements.txt
# Windows (PowerShell): $env:CORS_ORIGINS = "http://localhost:3000"
# macOS or Linux: export CORS_ORIGINS=http://localhost:3000
uvicorn app.main:app --port 8000Open http://localhost:8000/api/health. When the model is loaded it answers with status ready. The first start also downloads the ResNet-50 weights, so it needs an internet connection.
The website runs on another port, so the API must allow its address. The API reads CORS_ORIGINS from the shell, not from a .env file. Set it in the same terminal before you start uvicorn. Without it the browser blocks the calls and the web app falls back to demo mode.
2. Start the website
cd apps/site
npm install
npm run devOpen http://localhost:3000. The web app at /app calls the address in NEXT_PUBLIC_API_URL, which defaults to http://localhost:8000. Copy .env.example to .env.local only if you need to change it.
Deploy your own copy
Website on Vercel
- Import the repository and set the root directory to apps/site.
- Use the Next.js preset, install command npm install and build command npm run build.
- Set NEXT_PUBLIC_API_URL to your API address. For the changelog also set GITHUB_REPO and GITHUB_WEBHOOK_SECRET.
- NEXT_PUBLIC values are baked in at build time, so redeploy after you change one.
API on Railway
- Create a service from the repository and set the root directory to apps/api. railway.json already holds the start command and the /api/health check.
- Set CORS_ORIGINS to your website address.
- Make sure the public domain targets the same port the service listens on (the PORT value Railway sets). A mismatch shows up as a 502 error even though the service is online.
Changelog webhook (optional)
Add a GitHub webhook to https://YOUR-SITE/api/webhooks/github with content type application/json, the same secret as GITHUB_WEBHOOK_SECRET, and only the Releases event. Tag web releases web-v and Android releases mobile-v.
Environment variables
| App | Variable | Purpose |
|---|---|---|
| API | CORS_ORIGINS | Site origins allowed to call the API, separated by commas. Empty turns CORS off. |
| API | PORT | Port to listen on. Railway sets it, default 8000. |
| API | RATE_LIMIT_PER_MINUTE | Accepted prediction calls per client per minute. Default 20, 0 turns the limit off. |
| API | RATE_LIMIT_TRUST_FORWARDED | Set to 1 only behind a proxy that adds the real client address to X-Forwarded-For. Not verified on Railway. |
| Site | NEXT_PUBLIC_API_URL | Public address of the API, used by the web app at /app. |
| Site | GITHUB_REPO | Repository whose releases feed the changelog. |
| Site | GITHUB_WEBHOOK_SECRET | Secret that verifies release webhooks from GitHub. |
| Site | GITHUB_TOKEN | Optional read token for a higher GitHub API rate limit. |
Demo mode
When the API cannot be reached, the web app falls back to four bundled samples. To rebuild those results from your own API, start it and run tools/export-stages.ps1 in PowerShell. The files go to apps/site/public/demo.