Railway

Deploy Label Studio — Open Source Data Labeling [Postgres]

Self-host Label Studio — label images, text, audio, video

Deploy Label Studio — Open Source Data Labeling [Postgres]

/var/lib/postgresql/data

Just deployed

/label-studio/data

Deploy and Host Label Studio on Railway

Label Studio is the leading open-source data labeling platform — a self-hosted alternative to Scale AI and Labelbox for annotating images, text, audio, video, and time-series data. Build training datasets for computer vision, NLP, speech, and LLM fine-tuning, all on infrastructure you own with no per-annotation fees. This template deploys Label Studio with a managed PostgreSQL database and the Railway-specific configuration that trips most self-hosted deployments already handled.


What This Template Deploys

ServicePurpose
Label StudioThe labeling UI, project management, and API on port 8080
PostgreSQLProjects, tasks, annotations, users, and configuration

Both services run on Railway's private network. A persistent volume at /label-studio/data holds uploaded task files and media, and the database connection is wired through Label Studio's discrete POSTGRE_* variables.


About Hosting Label Studio

Label Studio is a Django application, and two things about hosting it on Railway cause most failed deployments — both handled here.

It does not use DATABASE_URL. Label Studio connects to PostgreSQL through six separate variables — DJANGO_DB, POSTGRE_NAME, POSTGRE_USER, POSTGRE_PASSWORD, POSTGRE_HOST, POSTGRE_PORT — not a single connection string. Templates built around DATABASE_URL silently fall back to SQLite, which loses data on redeploy. This template maps Railway's Postgres reference variables to the correct POSTGRE_* names.

Do not use the --init -db postgresql start command. Label Studio's own docs suggest it, but on a fresh remote database it throws a Django migration error (NodeNotFoundError). The fix is to run the bare label-studio command and let the entrypoint's migration script apply the schema on first boot. This template uses the correct startup, so migrations run cleanly.

The third requirement is CSRF. As a Django app behind Railway's proxy, Label Studio needs LABEL_STUDIO_HOST and CSRF_TRUSTED_ORIGINS set to your Railway domain, or login and form submissions fail with a CSRF error even though the page loads.

First boot runs migrations and can briefly spike RAM. Budget more than the 512 MB Starter tier if you'll import large image or audio datasets.

Typical cost: ~$5–10/month on Railway for Label Studio and Postgres. Scale AI and Labelbox charge per labeled item or per seat; the Community Edition is Apache-2.0 with neither.


How It Compares

Label Studio (self-hosted)Scale AILabelboxCVAT
Cost modelFlat ~$5–10/mo infraPer labeled itemPer seat + usageSelf-hosted
Data typesImage, text, audio, video, time-seriesBroadBroadMostly vision
Data ownershipFull — your infraVendorVendorFull
ML-assisted labelingYes (ML backend)YesYesYes
Text / NLP / audioStrongYesYesLimited
Self-hostableYesNoNoYes

Scale AI and Labelbox are managed services with large workforces attached, priced accordingly. CVAT is strong for computer vision but weaker beyond it. Label Studio wins on breadth across data types and on keeping your training data on your own infrastructure — especially for NLP, speech, and LLM pipelines alongside vision work.


Deploy in Under 5 Minutes

  1. Click Deploy on Railway — Label Studio and PostgreSQL build automatically (first boot runs migrations, ~3 minutes)
  2. Set LABEL_STUDIO_HOST and CSRF_TRUSTED_ORIGINS to your Railway public domain
  3. Confirm the POSTGRE_* variables and the volume at /label-studio/data are set
  4. Open your Railway domain and sign up — the first account becomes admin
  5. Create a project, choose a labeling template, import data, and start annotating

No SQLite fallback, no migration errors, no CSRF debugging.


Common Use Cases

  • Computer vision datasets — bounding boxes, polygons, keypoints, and segmentation masks for object detection and image models
  • NLP and text annotation — named entity recognition, classification, and relation labeling for language models
  • LLM fine-tuning data — build instruction, preference, and RLHF datasets with custom labeling interfaces
  • Audio and speech labeling — transcription, speaker diarization, and audio classification for speech models
  • Video annotation — frame-by-frame object tracking and temporal labeling for video understanding
  • ML-assisted labeling — connect an ML backend to pre-label data and accelerate annotation with model predictions

Configuration

VariableRequiredDescription
DJANGO_DBPre-setdefault — selects the PostgreSQL database config
POSTGRE_NAMEAuto-injectedDatabase name via Railway reference variable
POSTGRE_USERAuto-injectedDatabase user
POSTGRE_PASSWORDAuto-injectedDatabase password
POSTGRE_HOSTAuto-injectedPostgreSQL private host via Railway reference variable
POSTGRE_PORTAuto-injectedPostgreSQL port (5432)
LABEL_STUDIO_HOSTRequiredYour Railway public domain — used for links and CSRF
CSRF_TRUSTED_ORIGINSRequiredYour Railway public domain — login POSTs fail without it
SECRET_KEYRequiredDjango secret key — set a long random value, keep stable
LABEL_STUDIO_PORTPre-set8080

Label Studio uses POSTGRE_* variables, not DATABASE_URL. All six must be set individually or Label Studio falls back to SQLite and loses data on redeploy. This template maps them from Railway's Postgres reference variables.

Set LABEL_STUDIO_HOST and CSRF_TRUSTED_ORIGINS to your domain. As a Django app behind Railway's proxy, Label Studio rejects login and form POSTs with a CSRF error if these don't match your public URL.


Dependencies for Label Studio Hosting

  • Railway account — expect ~$5–10/month for Label Studio and Postgres
  • A persistent Railway volume at /label-studio/data for uploaded media (included)
  • More than 512 MB RAM if importing large image or audio datasets
  • Optional: S3, GCS, or Azure Blob for cloud storage of large task data

Deployment Dependencies

Implementation Details

The template runs the official heartexlabs/label-studio image on port 8080 against a managed Railway PostgreSQL service. Rather than a DATABASE_URL string, Label Studio's six discrete POSTGRE_* variables are mapped from Railway reference variables with DJANGO_DB=default, which is the connection method Label Studio actually reads — the most common reason other templates silently end up on SQLite.

The container starts with the bare label-studio command rather than the --init -db postgresql form the docs suggest, because that form triggers a Django NodeNotFoundError on a fresh remote database. The entrypoint's migration script applies the schema on first boot instead. LABEL_STUDIO_HOST and CSRF_TRUSTED_ORIGINS are set to the public domain so Django's CSRF protection accepts requests through Railway's proxy.

Uploaded tasks and media persist on the Railway volume at /label-studio/data; all project, task, and annotation data lives in PostgreSQL. For large datasets, connect S3-compatible cloud storage rather than growing the volume.


Frequently Asked Questions

Why does it use POSTGRE_* instead of DATABASE_URL? Label Studio reads six separate PostgreSQL variables, not a connection string. Templates built around DATABASE_URL silently fall back to SQLite and lose data on redeploy. This template maps the correct variables.

Why did other deployments fail with a migration error? Using the documented label-studio start --init -db postgresql command triggers a Django NodeNotFoundError on a fresh database. Running the bare label-studio command and letting the entrypoint migrate avoids it, which is what this template does.

Login fails with a CSRF error — why? LABEL_STUDIO_HOST and CSRF_TRUSTED_ORIGINS aren't set to your Railway domain. Django rejects form POSTs from untrusted origins, so both must match your public URL.

What data types can I label? Images, text, audio, video, and time-series — bounding boxes, segmentation, NER, classification, transcription, and more, with customizable labeling interfaces for each.

Do my annotations survive a redeploy? Yes. Projects, tasks, and annotations live in PostgreSQL, and uploaded media on the mounted volume. Both persist across redeploys.

Is it really free? Label Studio Community Edition is Apache-2.0 with no per-item or per-seat fees. The Enterprise edition adds SSO, advanced RBAC, and analytics under a license; the community version covers most labeling needs.

Can I use ML-assisted labeling? Yes. Connect an ML backend and Label Studio pre-labels tasks with model predictions, which annotators then correct — a large speedup on big datasets.


Why Deploy Label Studio 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 Label Studio on Railway you get an open-source data labeling platform with its Django-on-a-proxy pitfalls already solved — correct POSTGRE_* wiring, clean migrations, CSRF configured, a managed PostgreSQL backend, and a persistent volume for media. Build training data across every data type, with no per-annotation fees and your datasets on infrastructure you own.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
113
View Template
stella
Self-host stella with web, API, Postgres, Redis, and object storage.

Jan Kubica
1
View Template
Hermes Agent | OpenClaw Alternative with Dashboard
Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

codestorm
51