Deploy TeslaMate
Self-hosted Tesla data logger with Grafana dashboards, behind a login
Just deployed
/var/lib/grafana
Just deployed
/var/lib/postgresql/data
teslamate
Just deployed
/opt/app/import
Just deployed
Deploy and Host TeslaMate on Railway
TeslaMate is an open-source, self-hosted data logger for Tesla cars, written in Elixir. It records drives, charging sessions, battery health, efficiency and vampire drain into PostgreSQL, and ships more than 20 Grafana dashboards to explore that data. It can also publish live car data over MQTT for Home Assistant and similar tools.
About Hosting TeslaMate
TeslaMate has to run all the time to keep logging, next to a PostgreSQL database and Grafana. This template runs TeslaMate 4.5.0 and its Grafana image (Grafana 13.3.1), each built from a small GitHub repo that pins the official image by version and digest, on Railway's Postgres. TeslaMate has no login of its own, so a Caddy gateway is the only public service: it asks for a password before TeslaMate and serves Grafana, which has its own login, under /grafana. Every password and the token encryption key are generated at deploy time. The database and Grafana keep their data on volumes.
Common Use Cases
- Keep a private, complete history of every drive and charge of your Tesla
- Track battery degradation, efficiency, charging costs and vampire drain over months and years
- Feed live car state into Home Assistant over MQTT
Dependencies for TeslaMate Hosting
- PostgreSQL (Railway's Postgres, with a volume)
- A Tesla account access token and refresh token, entered in TeslaMate after the deploy
Deployment Dependencies
- TeslaMate on GitHub
- TeslaMate 4.5.0 release
- TeslaMate documentation
- How to get the Tesla tokens
- Template repo (Dockerfiles and changelog)
Implementation Details
First login. Open the gateway service's Variables tab and copy WEB_PASSWORD. Open the gateway's domain and log in as admin with it. Then sign in to Tesla with your access and refresh token.
Dashboards. Open https://YOUR-DOMAIN/grafana and log in as admin with the grafana service's GF_SECURITY_ADMIN_PASSWORD. The TeslaMate datasource and dashboards are already set up. The Web App and Dashboards links in TeslaMate's Settings are filled in from the domain on first start.
Keep ENCRYPTION_KEY. It encrypts your Tesla tokens in the database. If it changes, you have to sign in to Tesla again.
Optional settings, not in the template: on the teslamate service, TZ (for example Europe/Berlin) and MQTT_HOST, MQTT_PORT, MQTT_USERNAME, MQTT_PASSWORD to publish to your own MQTT broker. MQTT stays off while MQTT_HOST is empty. If you add a custom domain, change VIRTUAL_HOST and GF_SERVER_ROOT_URL and the URLs in TeslaMate's Settings.
Updates. The app services build from the template repo's main branch. When a new TeslaMate release is pinned there, Railway shows you an "update available" notice and you choose when to apply it. TeslaMate runs its database migrations on start. Read the repo's CHANGELOG.md first.
Why Deploy TeslaMate 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 TeslaMate 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

