A self-hosted version of the old (deprecated) Unsplash Source API.
Point any <img src="..."> at it and get a real Unsplash photo back.
- Go to https://unsplash.com/developers and log in / sign up
- Click "Your apps" -> "New Application"
- Accept the terms, name it anything (e.g. "My Source Alt")
- Copy the Access Key shown on the app's page
Demo apps are limited to 50 requests/hour — plenty for testing and small personal projects. You can apply for production access later if you need more.
pip install flask requestsWSL / Linux / Mac:
export UNSPLASH_ACCESS_KEY=your_key_hereWindows (cmd):
set UNSPLASH_ACCESS_KEY=your_key_here(Or just paste it directly into ACCESS_KEY = ... in app.py for local testing —
just don't commit that to a public repo.)
python app.py<img src="http://localhost:5000/photo?query=cat">
<img src="http://localhost:5000/random/800x600">Works as a normal image URL in any app, since it just 302-redirects to the real Unsplash CDN link — no JSON parsing needed on the client side.
| URL | What it does |
|---|---|
/random |
Random photo, original size |
/random/800x600 |
Random photo, cropped to 800x600 |
/photo?query=cat |
Random photo matching "cat" |
/photo?query=cat&w=800&h=600 |
Keyword photo, sized |
This project now ships with a Dockerfile, so Coolify can build and run it
directly — no buildpacks needed.
In VS Code's terminal (inside this project folder):
git init
git add .
git commit -m "Unsplash source alternative"Create an empty repo on GitHub/GitLab (whichever Coolify is connected to), then:
git remote add origin <your-repo-url>
git branch -M main
git push -u origin mainFrom now on, any git push from VS Code updates this repo, and Coolify can
auto-redeploy on push (see step 3).
- In Coolify: + New Resource -> Public/Private Git Repository
- Point it at your repo/branch
- Build Pack: Dockerfile (Coolify should auto-detect it)
- Set the Port Coolify exposes to match the container —
3000(matches the Dockerfile's default) unless you changeENV PORTin the Dockerfile
In the resource's Environment Variables tab, add:
UNSPLASH_ACCESS_KEY=your_key_here
Mark it as a runtime variable (not build-time) — it's only needed when the app is running, not while building the image.
Click Deploy. Coolify builds the Dockerfile and starts the container via gunicorn. Once it's up, attach your domain (or use the Coolify-generated one) and test:
https://your-coolify-domain/photo?query=cat
Enable the webhook Coolify shows you in the resource's Webhooks tab (or
turn on its GitHub App integration) so every git push from VS Code
triggers a new deploy automatically.