Self-Host CTFd to Run Your Own Capture-the-Flag Events
Self-host CTFd, the open-source capture-the-flag platform, on Railway in one click, then set up your event, challenges and scoreboard.
Capture the Flag (CTF) competitions are one of the most practical ways to build security skills. Players solve challenges in areas such as web security, cryptography, reverse engineering and forensics, and each solved challenge reveals a hidden "flag" they submit for points. To run one, you need a platform that hosts the challenges, checks submissions and keeps a live scoreboard.
To run your own CTF event with CTFd:
- Deploy CTFd on Railway using the one-click template.
- Complete the setup wizard straight away, to claim the admin account.
- Create your challenges, flags and hints.
- Open registration and share the link with players.
What is CTFd?
CTFd is an open-source CTF platform, licensed under Apache 2.0, that has hosted some of the largest CTF events in the world. It gives admins a web interface to create challenges and manage players, and gives players a challenge board and a live scoreboard. Events can run in team mode or user mode, and plugins and themes extend it. CTFd also sells a hosted version, but the self-hosted one is free.

Deploy CTFd on Railway in One Click
My CTFd template on Railway runs the official CTFd Docker image. Its SQLite database and uploaded challenge files are kept on a persistent volume, so your event survives redeploys. It generates the secret key for you, and there are no required variables.
When the deploy finishes, open the service's Railway domain. CTFd shows its setup wizard to whoever opens it first, and that person becomes the admin, so complete it as soon as the URL is live.
SQLite is fine for a practice event or a small team. For a public event, CTFd's docs recommend MySQL and Redis. Add Railway's MySQL and Redis services to the project, then set DATABASE_URL and REDIS_URL on the CTFd service. To send password resets and registration emails, add your SMTP details in the MAIL_* variables.
Set up Your CTF Event
The setup wizard asks for the event name and description, then the mode. In team mode, the whole team gets credit when any member solves a challenge, which suits most competitions. User mode suits internal training and assessments, where you want to track each person.

Next, create the admin account, choose a logo and theme, and optionally set start and end times. You can also connect MajorLeagueCyber, a CTF tracker that adds single sign-on and team tracking across CTFd events. Everything in the wizard can be changed later under Admin Panel > Config.
Create Challenges and Run the Scoreboard
Challenges are the core of CTFd. Each one has a category, a description, a point value and one or more flags, which can be exact strings or regular expressions. You can attach files, add hints that are free or cost points, and use dynamic scoring, where a challenge is worth less the more teams solve it.

The scoreboard updates as flags come in. You can freeze it near the end of an event to keep the final standings a surprise.
If you'd rather not write every challenge yourself, use an intentionally vulnerable app as the target. My OWASP Juice Shop template deploys Juice Shop, and its juice-shop-ctf-cli tool exports the app's challenges and hints in a format CTFd can import. For a secrets-focused event, see OWASP WrongSecrets.
Frequently Asked Questions
Is CTFd free? Yes. CTFd is open source under the Apache 2.0 licence, so self-hosting costs only your hosting. CTFd also sells a managed, hosted version.
How many players can a self-hosted CTFd handle? It depends on the server and the backend. CTFd's docs ask for at least two CPU cores and 1 GB of RAM, and recommend MySQL with Redis for anything beyond a small event.
Can I use CTFd for security training? Yes. User mode tracks each person separately, which suits training sessions and internal assessments.