Deploy Flarum
Forum software for running a community discussion board
MySQL
Just deployed
/var/lib/mysql
mailpit
Just deployed
/data
flarum
Just deployed
/data
Deploy and Host Flarum on Railway
Flarum is open-source forum software for communities that want a discussion board people enjoy using. It renders as a single-page app, so threads open instantly and it works on a phone without a separate mobile theme. Product teams run it as a support community, open-source projects use it for user Q&A, and hobby groups use it because a forum keeps knowledge searchable in a way chat never does. It is MIT-licensed PHP, and its extension system means most of what a bigger platform bundles can be added — or left out — a package at a time.
Deploy Flarum on Railway and the whole stack is wired together on the first click. The forum service runs nginx and PHP-FPM behind a public HTTPS domain, keeps avatars, uploads and installed extensions on a persistent volume, and runs Flarum's scheduler in the same container. A managed MySQL service stores discussions, posts and accounts, reached over the private network through a database-scoped account rather than the superuser. A Mailpit service catches everything the forum sends — sign-up confirmations, password resets, notifications — so registration works the moment the deployment is live.

Getting Started with Flarum on Railway
Open the forum's public URL and you land on an empty discussion list. Sign in with FLARUM_ADMIN_USERNAME and the generated FLARUM_ADMIN_PASSWORD — both in the service's Variables tab, since the account is created at first boot rather than by a setup wizard. Change the password from the user menu straight away, and put a real address in FLARUM_ADMIN_EMAIL so resets reach you.
Go to /admin next. Under Basics, set the forum title and description; under Tags, create the two or three categories your community needs, since Flarum asks for a tag on every new discussion. Then start a discussion from the front page to confirm posting, formatting and tagging work end to end.
To check mail, open the Mailpit service's public URL — protected by MP_UI_AUTH — then register a second account in a private window. The activation message arrives in seconds and its link confirms the account. For real email, point SMTP_HOST and SMTP_PORT at your provider.



About Hosting Flarum
Flarum replaces the heavyweight forum software most communities inherited — phpBB, vBulletin, an abandoned Discourse instance — with something one person can look after. The server side is plain PHP against MySQL: no background job runner, no search cluster, no Rails upgrade cycle. The operational surface is a web server and a database.
Features that ship in the bundled extension set:
- Markdown and BBCode formatting, with mentions that notify people directly
- Tags for categorising discussions, including nested and restricted tags
- Likes, flags, sticky and locked threads, post approval and suspensions
- A permission matrix mapping groups to every action on the forum
- An extension manager that installs from Packagist without shell access
The deployment splits into three services: the forum, which holds the volume; MySQL, which holds every discussion, post, user and setting; and Mailpit, which terminates SMTP privately.
Why Deploy Flarum on Railway
Railway handles the parts of running a forum that have nothing to do with your community:
- HTTPS, certificates and a public domain, provisioned for you
- Managed MySQL with backups, so you never tune a database
- A persistent volume for uploads, avatars and extensions
- Private networking between the forum, database and mail services
- Deploys from a public GitHub repo, with logs and metrics built in
Common Use Cases
- Product support communities where answers stay searchable instead of scrolling away in chat
- Open-source project forums for release notes, roadmap discussion and user Q&A
- Internal knowledge boards, with registration limited to one email domain
- Hobby communities wanting threaded discussion and a modern reader
Dependencies for Flarum
- Forum — gridalpha/flarum-railway built on
crazymax/flarum: nginx, PHP-FPM 8.4 and the scheduler under one supervisor. Port 8000, volume at/data - MySQL —
mysql:9.4, managed and private. Holds every discussion, post, account and setting; the forum gets its own scoped role, created on each boot - Mailpit —
axllent/mailpit, SMTP on private port 1025, inbox on 8025 behind basic auth
Environment Variables Reference
| Variable | Service | Purpose |
|---|---|---|
FLARUM_BASE_URL | Forum | Public URL Flarum builds every link from |
FLARUM_ADMIN_USERNAME | Forum | First administrator, created at install |
FLARUM_ADMIN_PASSWORD | Forum | Password for that account |
DB_HOST / DB_NAME / DB_USER | Forum | Private MySQL address and scoped account |
SMTP_HOST / SMTP_PORT | Forum | Mail server seeded into Flarum's settings |
CRON_SCHEDULE | Forum | How often the Flarum scheduler runs |
MP_UI_AUTH | Mailpit | Username and password for the web inbox |
Deployment Dependencies
- Source repository: github.com/gridalpha/flarum-railway
- Flarum core: github.com/flarum/framework
- Docs: docs.flarum.org · Extensions: extiverse.com
Hardware Requirements for Self-Hosting Flarum
| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 1 vCPU | 2 vCPU |
| RAM | 512 MB | 2 GB |
| Storage | 1 GB volume | 5 GB volume |
| Runtime | PHP 8.1+, MySQL 5.7+ | PHP 8.4, MySQL 8+ |
A few hundred members sits comfortably at the minimum. Raise memory before CPU — PHP-FPM workers and the extension installer are what consume it.
Self-Hosting Flarum
The quickest way to self-host Flarum elsewhere is the image this template builds on, run against an existing MySQL server:
docker run -d --name flarum -p 8000:8000 \
-v flarum-data:/data \
-e FLARUM_BASE_URL=https://forum.example.com \
-e DB_HOST=mysql -e DB_NAME=flarum \
-e DB_USER=flarum -e DB_PASSWORD=change-me \
crazymax/flarum:latest
To install from source, Flarum uses Composer and needs a web server pointed at public/:
composer create-project flarum/flarum forum
cd forum
chmod -R 775 storage public/assets
php flarum install
php flarum migrate
Both need the same PHP extensions — pdo_mysql, mbstring, gd, dom, curl, zip, tokenizer, json, openssl — and a rewrite sending everything to index.php. Run php flarum schedule:run from cron every minute.
Is Flarum Free?
Flarum is free and open source under the MIT license — no paid tier, seat limits or hosted-only features, with development funded by sponsorship. Some third-party extensions on Extiverse are commercial, usually a one-off fee. Self-hosting on Railway costs only the infrastructure the three services use, and that bill grows with traffic and uploads rather than member count.
Flarum vs Discourse vs NodeBB
| Flarum | Discourse | NodeBB | |
|---|---|---|---|
| Stack | PHP + MySQL | Rails + Postgres + Redis | Node.js + MongoDB |
| Services | 2 | 4+ | 2–3 |
| Extensions | Growing, some paid | Very large | Moderate |
| Real-time | Polling plus push | Live updates | WebSockets throughout |
| Best for | Low upkeep | Heavily moderated communities | Real-time communities |
Discourse has the deepest moderation tooling and the biggest plugin ecosystem, and asks for the most operational attention in return. NodeBB fits when live presence is central. Flarum is what you pick when one person keeps the forum running.
FAQ
What is Flarum? Flarum is open-source forum software written in PHP, providing threaded discussions, tags, mentions, likes, moderation tools and a permission system as a fast single-page app.
What does this Railway template deploy? Three services: the forum on a public HTTPS domain with a persistent volume, a managed MySQL database on the private network, and a Mailpit inbox for the forum's outgoing email.
Why does the template include a MySQL database? Flarum stores everything except uploaded files in a relational database — discussions, posts, users, groups, permissions and settings. MySQL or MariaDB is the only supported engine on the 1.x line, so it is required.
Why is a mail service included, and can I use my own? Flarum sends an activation link on every sign-up and cannot finish registration without a working mailer, so Mailpit makes that path work immediately. To use a real provider, change the host, port and credentials under Email.
How do I install Flarum extensions on Railway? Use the Extension Manager in the admin panel — it installs packages from Packagist without shell access. Extensions are recorded on the volume and reinstalled on the next boot, so they survive a redeploy.
Does the forum keep its data when I redeploy?
Yes. Posts and accounts live in MySQL; uploads, avatars and extensions live on the volume at /data. Both persist across deploys and restarts.
Template Content
