Deploy Invoice Ninja | Open Source FreshBooks Alternative
Self Host Invoice Ninja. Create invoices, accept payments, track expenses
MySQL
Just deployed
/var/lib/mysql
Redis
Just deployed
/data
invoice-ninja
Just deployed
/var/www/html/storage

Deploy and Host Invoice Ninja on Railway
Invoice Ninja is the leading open-source platform for invoicing, quoting, expense tracking, time billing, and accepting online payments — built for freelancers and small businesses who don't want to hand a percentage of every invoice to a SaaS vendor. Self-host Invoice Ninja on Railway and you keep full control of client data, branded PDFs, and the 50+ supported payment gateways without paying a per-user subscription.
This Railway template deploys the official invoiceninja/invoiceninja-debian:5 image extended with bundled nginx (single-container) so php-fpm, the queue worker, the scheduler, and the web server all run on a single Railway service. It pairs the app with Railway-managed MySQL for transactional data and Railway-managed Redis for cache, queues, and sessions, and ships a Laravel-aware nginx config that talks correctly to Railway's TLS-terminating edge proxy.
Getting Started with Invoice Ninja on Railway
After the deploy goes green, open the public URL Railway generated for the invoice-ninja service. The first request lands on the Invoice Ninja React UI — sign in with the IN_USER_EMAIL and IN_PASSWORD you set on the service (the seed admin is created automatically on first boot via php artisan ninja:create-account). From the dashboard, walk through Settings → Company Details to upload your logo and set defaults, then Settings → Online Payments to wire Stripe, PayPal, GoCardless, or any of the 40+ gateways — credentials live in Invoice Ninja's UI, not in Railway env vars. The queue worker is already running, so emailed invoices, recurring billing, and PDF rendering work without further setup. To migrate from another tool, Settings → Account Management → Import / Export accepts CSV, FreshBooks, or QuickBooks data.

About Hosting Invoice Ninja on Railway
Invoice Ninja v5 is a full-stack billing platform built on Laravel + a React front-end. It replaces the bookkeeping side of FreshBooks, Wave, Bill.com, or Zoho Invoice for businesses that prefer to own their data and avoid per-user pricing.
- Unlimited clients, invoices, quotes, expenses, projects, and tasks
- 50+ payment gateways (Stripe, PayPal, GoCardless, Square, Authorize.net, Mollie, …)
- Automatic recurring invoices and subscription billing
- Branded client portal with online checkout
- Time tracking and project billing built in
- PDF invoice generation via bundled headless Chrome (snappdf)
- REST + GraphQL APIs and webhook delivery for every business event
- Multi-currency, multi-language, EU/UK e-invoicing (PEPPOL, ZUGFeRD, FacturaE)
The container runs a Laravel application with three background loops (queue worker × 2, scheduler) on supervisord, fronted by an nginx that proxies to local php-fpm and serves static assets from /var/www/html/public.
Why Deploy Invoice Ninja on Railway
Railway gives Invoice Ninja the right shape with one click:
- One-service deploy — nginx, php-fpm, scheduler, and queue worker live in a single container with supervisord
- Managed MySQL and Redis attached automatically — no manual
docker runor compose file - Persistent volume at
/var/www/html/storagekeeps uploaded logos, generated PDFs, and Laravel state across redeploys - 4 GB plan handles the bundled headless Chrome used for PDF rendering
- Public URL with TLS in front of Railway's edge —
fastcgi_param HTTPS on;already wired into the nginx config
Common Use Cases
- Freelancers and consultancies billing clients across multiple currencies and time zones
- Agencies tracking billable hours per project and converting timesheets directly into invoices
- Small e-commerce or service businesses replacing FreshBooks / QuickBooks Online
- Anyone needing self-hosted, audit-ready invoicing for EU/UK e-invoicing compliance (PEPPOL, ZUGFeRD)
Dependencies for Self-Hosting Invoice Ninja
- Invoice Ninja —
invoiceninja/invoiceninja-debian:5extended viapraveen-ks-2001/invoice-ninja-railway - MySQL — Railway-managed
mysql:8 - Redis — Railway-managed
redis:7
Environment Variables Reference
| Variable | Purpose |
|---|---|
APP_URL | Public-facing URL (must be https://) |
APP_KEY | Laravel encryption key — static base64:…, not ${{secret()}} |
IN_USER_EMAIL / IN_PASSWORD | First-boot admin credentials (static, read once) |
TRUSTED_PROXIES | * so Laravel honours Railway's edge headers |
REQUIRE_HTTPS | true to redirect insecure requests |
DB_* | Connection details — reference Railway-managed MySQL |
REDIS_* | Cache + queue + session backend — reference Railway-managed Redis |
MAIL_* | SMTP creds for invoice / reminder email delivery |
PDF_GENERATOR | snappdf (bundled Chrome) for PDF invoices |
Deployment Dependencies for Invoice Ninja on Railway
- Source: github.com/invoiceninja/invoiceninja
- Self-host docs: invoiceninja.github.io/docs/self-host
- Docker reference: github.com/invoiceninja/dockerfiles
- Custom Railway Dockerfile: github.com/praveen-ks-2001/invoice-ninja-railway
Hardware Requirements for Self-Hosting Invoice Ninja
| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 1 vCPU | 2 vCPU |
| RAM | 2 GB | 4 GB (Chrome PDF generation) |
| Storage | 2 GB | 10 GB (PDFs + uploads grow over time) |
| Runtime | PHP 8.4, MySQL 8, Redis 7 | PHP 8.4, MySQL 8, Redis 7 |
The bundled google-chrome-stable binary used for PDF generation is the dominant memory cost — a 1 GB plan will OOM on the first PDF render.
Self-Hosting Invoice Ninja with Docker
The minimal local-development equivalent of this Railway template is the upstream docker-compose:
git clone https://github.com/invoiceninja/dockerfiles
cd dockerfiles/debian
cp .env.example .env
docker compose up -d
For a single-container production-like image (the shape this Railway template uses), build from the public Strategy D repo:
git clone https://github.com/praveen-ks-2001/invoice-ninja-railway
cd invoice-ninja-railway
docker build -t invoice-ninja-single .
docker run -p 8080:8080 \
-e APP_KEY="base64:$(openssl rand -base64 32)" \
-e APP_URL="http://localhost:8080" \
-e DB_HOST=... -e DB_USERNAME=... -e DB_PASSWORD=... \
-e REDIS_HOST=... -e REDIS_PASSWORD=... \
-e [email protected] -e IN_PASSWORD=changeme \
-v invoice-ninja-storage:/var/www/html/storage \
invoice-ninja-single
How Much Does Invoice Ninja Cost to Self-Host?
Invoice Ninja v5 is open-source under the Elastic License — the core platform is free for any self-hosted use, including by businesses, with no per-user, per-invoice, or per-client fees. Invoice Ninja sells a $30/year white-label module that removes the "created with Invoice Ninja" footer and a hosted SaaS plan (free for up to 20 clients, then $11–$16/user/month) — both are entirely optional. Self-hosting on Railway costs only what you pay Railway for the app container, MySQL, and Redis (typically a few dollars per month for low-volume usage).
FAQ
What is Invoice Ninja? Invoice Ninja is an open-source Laravel + React platform for invoicing, quoting, expense tracking, time billing, and accepting online payments — a self-hosted alternative to FreshBooks, QuickBooks Online, Bill.com, and Zoho Invoice.
What does this Railway template deploy? A single-container Invoice Ninja v5 image (nginx + php-fpm + queue worker + scheduler under supervisord), Railway-managed MySQL, and Railway-managed Redis — all wired up with HTTPS, the persistent volume, and a 4 GB memory plan.
Why are MySQL and Redis included as separate services? Invoice Ninja persists invoice / client / payment data in MySQL and uses Redis for cache, queues, and sessions. Running them as managed Railway services keeps them on the project's private network, lets the platform handle backups, and avoids stuffing two more daemons into the app container.
How do I generate the APP_KEY for self-hosted Invoice Ninja?
Run echo "base64:$(openssl rand -base64 32)" once locally and paste the result into the APP_KEY Railway variable. Never use ${{secret(N)}} for APP_KEY — it re-evaluates on every read and would corrupt every encrypted value in the database on the first redeploy.
How do I send real invoice emails from self-hosted Invoice Ninja?
Set MAIL_MAILER=smtp and fill in MAIL_HOST, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD, and MAIL_ENCRYPTION for your provider (Postmark, SendGrid, Amazon SES, Mailgun, Brevo). The default MAIL_MAILER=log writes emails to railway logs instead of sending them — useful for testing, useless in production.
How do I add Stripe or PayPal to self-hosted Invoice Ninja on Railway?
Payment gateway credentials are configured inside the Invoice Ninja UI under Settings → Online Payments → Payment Gateways, not as Railway environment variables. Add the gateway you want and paste the API keys / OAuth tokens — they're stored encrypted in MySQL using APP_KEY.
Can I run Invoice Ninja on Railway without Redis?
Technically yes — set CACHE_DRIVER=file, QUEUE_CONNECTION=database, SESSION_DRIVER=file and you can drop the Redis service. Don't. The queue worker, scheduled jobs, and session storage all benefit substantially from Redis, and Railway's managed Redis costs almost nothing at this scale.
Template Content
MySQL
mysql:9.4Redis
redis:8.2.1invoice-ninja
praveen-ks-2001/invoice-ninja-railwayIN_PASSWORD
First-boot admin password (static)
IN_USER_EMAIL
First-boot admin email