---
title: "Deploy CTFd"
description: "An open-source platform to run capture-the-flag events."
category: "Other"
url: https://railway.com/deploy/Feq69b
---

# Deploy CTFd

An open-source platform to run capture-the-flag events.

**[Deploy CTFd on Railway](https://railway.com/template/Feq69b)**

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

- **Creator:** alphasec
- **Category:** Other
- **Total deploys:** 210

## Template content

### ctfd

- **Image:** ctfd/ctfd
- **Public domain:** Yes

## Documentation

# Deploy and Host CTFd on Railway

CTFd is an open-source platform for running Capture The Flag (CTF) events. It provides a user-friendly web interface for administrators to create challenges and manage participants, and for players to submit flags and track their standings on a live scoreboard. It has been used to host some of the largest CTF events in the world.

## About Hosting CTFd

This Railway template deploys the official CTFd Docker image as a single service, using SQLite for storage — no external database or cache required. CTFd is configured behind Railway's proxy and is reachable on a Railway-provided HTTPS domain immediately after deployment. The initial setup wizard runs on first launch to configure the event name, mode, and admin credentials. For larger or longer-running events, upgrading to an external MySQL and Redis backend is recommended.

## Common Use Cases

- **CTF event hosting** — run team or individual CTF competitions with challenges spanning web security, cryptography, reverse engineering, forensics, and more
- **Security training** — use CTFd in User Mode for internal security training and assessments, tracking individual progress across a custom challenge set
- **Community events** — host public or private CTF events with built-in registration, scoreboards, and optional MajorLeagueCyber SSO integration

## Dependencies for CTFd Hosting

- [CTFd Docker image](https://hub.docker.com/r/ctfd/ctfd) (`ctfd/ctfd`)
- SQLite — bundled, no external database required for this template

### Deployment Dependencies

- [CTFd GitHub repository](https://github.com/CTFd/CTFd)
- [alphasec guide: Run Capture-The-Flag Events with CTFd](https://alphasec.io/run-capture-the-flag-events-with-ctfd/)

### Implementation Details

**Optional: email notifications** — configure SMTP to enable password resets and registration emails:
 
```env
MAIL_SERVER=smtp.example.com
MAIL_PORT=587
MAIL_USEAUTH=true
MAIL_USERNAME=your-smtp-username
MAIL_PASSWORD=your-smtp-password
MAIL_FROM=ctf@example.com
```
 
**Optional: scale up to MySQL + Redis** — for larger events, add Railway's MySQL and Redis services and set:
 
```env
DATABASE_URL=mysql+pymysql://user:password@host:3306/ctfd
REDIS_URL=redis://host:6379
```

## Why Deploy CTFd 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 CTFd 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

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — Self-hosted virtual tabletop for role-playing games (license required)
- [Double Commander in your browser](https://railway.com/deploy/double-commander-in-your-browser) — The Double Commander file manager in the cloud, from any device

Open this page in a browser: https://railway.com/deploy/Feq69b
