---
title: "Deploy ThingsBoard IoT Platform"
description: "Self-host IoT platform: device telemetry, MQTT, HTTP, dashboards, alerts."
category: "Analytics"
url: https://railway.com/deploy/thingsboard-iot-platform
---

# Deploy ThingsBoard IoT Platform

Self-host IoT platform: device telemetry, MQTT, HTTP, dashboards, alerts.

**[Deploy ThingsBoard IoT Platform on Railway](https://railway.com/template/thingsboard-iot-platform)**

- **Creator:** ProCode
- **Category:** Analytics
- **Total deploys:** 6

## Template content

### kafka https://cdn.simpleicons.org/apachekafka/white

- **Image:** apache/kafka:4.3.1

### thingsboard https://github.com/thingsboard.png

- **Image:** thingsboard/tb-node:4.3.1.4
- **Start command:** `/bin/bash -c 'echo "waiting for postgres $PG_HOST:$PG_PORT..."; until (echo > /dev/tcp/$PG_HOST/$PG_PORT) 2>/dev/null; do sleep 3; done; echo "postgres reachable"; if [ ! -f /data/.tb_installed ]; then if ( INSTALL_TB=true exec start-tb-node.sh ); then touch /data/.tb_installed; else echo "TB install failed" >&2; exit 1; fi; fi; exec start-tb-node.sh'`
- **Health check:** /login
- **Public domain:** Yes

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

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

## Documentation

# Deploy and Host ThingsBoard IoT Platform on Railway

ThingsBoard is an open-source IoT platform for device connectivity, data collection, processing, visualization, and device management. This template deploys a production-ready stack of ThingsBoard, PostgreSQL, and Apache Kafka, wired over private networking, so you get a restart-safe IoT backend in one click.

**Important:** ThingsBoard deploys with default admin passwords. Change them right after your first login. See **First-run setup** under Implementation Details below.

## About Hosting ThingsBoard IoT Platform

ThingsBoard connects devices over MQTT and HTTP, routes their telemetry through a rule engine, stores it in PostgreSQL, and renders it on customizable dashboards. A production deployment runs three coordinated services: the ThingsBoard node, a PostgreSQL database for entities and time-series data, and a Kafka broker for a durable message queue (the default in-memory queue loses in-flight data on restart). These services need private networking, persistent volumes, and the correct startup order. This template handles all of it: a single-broker Kafka in KRaft mode (no ZooKeeper), automatic schema installation on first boot, a healthcheck, and connection strings wired with reference variables, so you skip the assembly and debugging.

## Common Use Cases

- Ingesting and visualizing device/sensor telemetry (temperature, energy, GPS, industrial metrics)
- Building IoT dashboards with alerting and automation via ThingsBoard's rule engine
- Device management and provisioning for fleets of MQTT/HTTP-connected devices
- A self-hosted alternative to SaaS IoT platforms

## Dependencies for ThingsBoard IoT Platform Hosting

- PostgreSQL (included): stores entities and time-series telemetry
- Apache Kafka (included, single KRaft broker): the durable message queue for the rule engine

### Deployment Dependencies

- [ThingsBoard](https://thingsboard.io) ([documentation](https://thingsboard.io/docs/))
- [Apache Kafka](https://kafka.apache.org)
- [PostgreSQL](https://www.postgresql.org)

### Implementation Details

**Demo data.** At deploy time you are asked to set `LOAD_DEMO`. Set it to `true` (lowercase) to include a sample tenant, devices, and dashboards for exploring the platform, or `false` for a clean install with only the system administrator. This applies to the first deploy only.

**First run is slow.** On the first deploy, ThingsBoard installs its database schema before it can serve traffic. This takes several minutes and includes one automatic restart: the service shows as deployed, briefly restarts, then stays up. Subsequent boots skip the install and start quickly.

**First-run setup.** Once it is running, open the ThingsBoard service URL and:

1. **Log in as the system administrator:** `sysadmin@thingsboard.org` / `sysadmin`.
2. **Set the Base URL.** Copy the `REF_BASE_URL` variable (ThingsBoard service → Variables) into **System Settings → General → Base URL**, then save. This screen is only visible to the sysadmin account, not tenant accounts.
3. **Change the sysadmin password** (avatar → Profile → Change password) and store it somewhere safe.
4. **If you deployed with `LOAD_DEMO=true`,** also log in as the demo tenant (`tenant@thingsboard.org` / `tenant`) and change that password, or delete the account.

**Connecting and testing devices.** Devices connect over **MQTT** (through the Railway TCP proxy) or **HTTP** (`https://YOUR_THINGSBOARD_DOMAIN/api/v1/YOUR_ACCESS_TOKEN/telemetry`). CoAP and LwM2M are not supported because they require UDP.

To test MQTT with [Mosquitto](https://mosquitto.org): create a device in ThingsBoard, copy its access token, then publish a reading. The host and port are on the ThingsBoard service's Networking tab (TCP proxy):

```
mosquitto_pub -h TCP_PROXY_HOST -p TCP_PROXY_PORT -t v1/devices/me/telemetry -u YOUR_ACCESS_TOKEN -m '{"temperature":22.5}'
```

The value should appear under the device's Latest Telemetry in the ThingsBoard UI.

## Why Deploy ThingsBoard IoT Platform 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 ThingsBoard IoT Platform 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

- [Matomo Analytics + MariaDB](https://railway.com/deploy/matomo-analytics-mariadb) — Privacy-friendly analytics with MariaDB and persistent volumes.
- [Bugsink](https://railway.com/deploy/bugsink) — Self-hosted Error Tracking. Sentry-SDK compatible
- [SubTrackr](https://railway.com/deploy/bscottsubtrackr) — Self-hosted Subscription Tracker

Open this page in a browser: https://railway.com/deploy/thingsboard-iot-platform
