Deploy Anki Sync Server
Official Anki flashcard sync server: decks and media on your own volume
Anki Sync Server
Just deployed
/anki_data
Deploy and Host Anki Sync Server on Railway
Anki Sync Server is the official self-hosted sync server from Ankitects, the makers of the Anki flashcard app. It keeps your decks, review history and media in step between Anki Desktop, AnkiDroid and AnkiMobile, the same way AnkiWeb does, but on a server you control.
About Hosting Anki Sync Server
This template builds Anki 26.09.4's sync server from our public GitHub repo (the official anki package from PyPI, pinned by version and hash) and runs it as one service. It listens on Railway's port behind an HTTPS domain, keeps every account's collection and media on a Railway volume at /anki_data, and passes a /health check before traffic is switched. The first account is created from ANKI_USERNAME and a password generated at deploy, so there is no default login. After deploying, copy the password from the Variables tab, set the custom sync server in each Anki client, and run the first sync.
Common Use Cases
- Sync Anki between a computer and phones without relying on AnkiWeb, or without an AnkiWeb account at all
- Keep long study breaks safe: your collection isn't removed for inactivity
- Give a family, class or study group their own accounts on one private server
Dependencies for Anki Sync Server Hosting
- An Anki client: Anki Desktop, AnkiDroid or AnkiMobile, ideally no newer than the server's version
- A Railway volume for collections and media (included in the template)
Deployment Dependencies
- Anki self-hosted sync server documentation: https://docs.ankiweb.net/sync-server.html
- Anki releases: https://github.com/ankitects/anki/releases
- Template source and changelog: https://github.com/aalfath/anki-sync-server-railway-template
Implementation Details
The template deploys one service, Anki Sync Server (no database needed; each account's collection is an SQLite file on the volume). Deploy-time variables:
ANKI_USERNAME(defaultanki) andANKI_PASSWORD(generated): the first sync accountPORT(8080)
After deploy:
- Copy
ANKI_USERNAMEandANKI_PASSWORDfrom the service's Variables tab. - In Anki Desktop open Preferences → Syncing, set the self-hosted sync server to
https://YOUR-DOMAIN.up.railway.app/(your service's public domain, trailing slash included), restart Anki, then click Sync and log in. AnkiDroid and AnkiMobile have the same custom sync server setting. - On the first sync choose Upload on the device that holds your collection; other devices then choose Download.
More accounts: add SYNC_USER2=user:password, SYNC_USER3=… in the Variables tab. Large collections: raise MAX_SYNC_PAYLOAD_MEGS (default 100). Anki's messages still say "AnkiWeb" when a custom server is set.
Updates: when we release a new Anki version in the GitHub repo, Railway offers you an update; read the repo's CHANGELOG and apply it. Keep the server at least as new as your Anki clients, because newer clients may need a newer sync protocol. Your data stays on the volume across updates and redeploys.
Why Deploy Anki Sync Server on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Anki Sync Server on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
Anki Sync Server
aalfath/anki-sync-server-railway-template