---
title: "Deploy TeslaMate"
description: "Self-hosted Tesla data logger with Grafana dashboards, behind a login"
category: "Analytics"
url: https://railway.com/deploy/teslamate-1
---

# Deploy TeslaMate

Self-hosted Tesla data logger with Grafana dashboards, behind a login

**[Deploy TeslaMate on Railway](https://railway.com/template/teslamate-1)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/teslamate-1/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** Analytics

## Template content

### grafana https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/grafana.png

- **Source:** https://github.com/aalfath/teslamate-railway-template
- **Health check:** /grafana/api/health

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### teslamate https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/teslamate.png

- **Source:** https://github.com/aalfath/teslamate-railway-template
- **Health check:** /health_check

### gateway https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/teslamate.png

- **Source:** https://github.com/aalfath/teslamate-railway-template
- **Health check:** /healthz
- **Public domain:** Yes

## Documentation

# 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](https://github.com/teslamate-org/teslamate)
* [TeslaMate 4.5.0 release](https://github.com/teslamate-org/teslamate/releases/tag/v4.5.0)
* [TeslaMate documentation](https://docs.teslamate.org/)
* [How to get the Tesla tokens](https://docs.teslamate.org/docs/installation/tokens)
* [Template repo (Dockerfiles and changelog)](https://github.com/aalfath/teslamate-railway-template)

### 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.



## Similar templates

- [Plausible WordPress](https://railway.com/deploy/deploy-plausible-for-wordpress-sites) — Cookie-free WordPress stats from your own Plausible
- [Typesense Multilingual](https://railway.com/deploy/deploy-typesense-multilingual-search) — Locale-aware multilingual search with Typesense
- [Formbricks](https://railway.com/deploy/formbricks-surveys) — Surveys, NPS and in-app feedback on your own Postgres, Hub and Cube

Open this page in a browser: https://railway.com/deploy/teslamate-1
