Deploy EspoCRM | CRM Application on Railway
Self Host EspoCRM. Sales automation, contacts, leads, deals, and workflows
EspoCRM
Just deployed
/var/www/html
Just deployed
/var/lib/postgresql/data

Deploy and Host EspoCRM on Railway
Deploy EspoCRM on Railway to get a fully functional, self-hosted CRM with sales automation, customer support, and email marketing — no per-user fees. Self-host EspoCRM with one click and run EspoCRM on Railway with PostgreSQL for persistent data storage and a background daemon for scheduled workflows and email processing.
This Railway template pre-configures the EspoCRM application server (espocrm/espocrm) with Railway-managed PostgreSQL, a persistent volume for application files, and a built-in background job processor for cron tasks and automated workflows.
Getting Started with EspoCRM on Railway
After deployment completes, open your Railway-provided URL to access the EspoCRM login page. Sign in with the admin credentials configured during deployment (admin username and the generated password from the ESPOCRM_ADMIN_PASSWORD environment variable).
Your first step should be navigating to Administration → Settings to configure your company name, timezone, and default currency. Next, set up your email integration under Administration → Email Accounts by adding your IMAP/SMTP credentials — this enables EspoCRM's email tracking and mass email features. Create your first Contact or Lead to start building your CRM pipeline.

About Hosting EspoCRM
EspoCRM is an open-source Customer Relationship Management platform built in PHP. It provides a modern, responsive web interface for managing contacts, leads, opportunities, and customer support cases — replacing expensive SaaS CRM tools like HubSpot or Salesforce with a self-hosted solution you fully control.
- Sales automation — customizable pipeline stages, deal tracking, lead scoring, and forecasting
- Email integration — IMAP/SMTP sync, mass email campaigns, email templates, and tracking
- Customer support — case management, SLA tracking, knowledge base, and customer portal
- Business process automation — visual BPM designer, workflow rules, and scheduled jobs
- REST API — full API access for custom integrations with n8n, Zapier, or any webhook-based tool
- Customizable entities — create custom fields, relationships, layouts, and modules without code
Why Deploy EspoCRM on Railway
- No per-user licensing fees — unlimited users on the self-hosted AGPL edition
- PostgreSQL-backed for reliable, scalable data storage
- Background daemon handles scheduled workflows, email fetching, and notifications automatically
- One-click deploy with pre-configured environment variables and persistent storage
- Full data ownership — your CRM data stays on your infrastructure
Common Use Cases for Self-Hosted EspoCRM
- Sales pipeline management — track deals from lead capture through close with customizable stages and probability forecasting
- Customer support ticketing — manage support cases with SLA rules, assignment workflows, and customer portal access
- Email marketing campaigns — send mass emails with templates, target lists, opt-out tracking, and delivery analytics
- Business process automation — design visual workflows that auto-assign leads, send notifications, and update records on schedule
Dependencies for EspoCRM on Railway
- EspoCRM —
espocrm/espocrm:latest(PHP 8.4 + Apache, includes CRM application and background daemon) - PostgreSQL — Railway-managed database for persistent CRM data storage
Environment Variables Reference for EspoCRM
| Variable | Description |
|---|---|
ESPOCRM_DATABASE_PLATFORM | Database driver — set to Postgresql for Railway |
ESPOCRM_DATABASE_HOST | PostgreSQL hostname (Railway private domain) |
ESPOCRM_ADMIN_USERNAME | Admin account username (bootstrap-only) |
ESPOCRM_ADMIN_PASSWORD | Admin account password (bootstrap-only, must be static) |
ESPOCRM_SITE_URL | Full public URL with https:// prefix |
PORT | Container listening port for Railway routing |
Deployment Dependencies
- Runtime: PHP 8.4 with Apache (included in Docker image)
- Docker Hub: espocrm/espocrm
- GitHub: espocrm/espocrm
- Docs: docs.espocrm.com
Hardware Requirements for Self-Hosting EspoCRM
| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 1 vCPU | 2 vCPUs |
| RAM | 512 MB | 2 GB |
| Storage | 1 GB | 5 GB |
| Runtime | PHP 8.1+ | PHP 8.4 |
Self-Hosting EspoCRM with Docker
Run EspoCRM locally using Docker Compose with PostgreSQL:
services:
espocrm:
image: espocrm/espocrm:latest
ports:
- "8080:80"
environment:
ESPOCRM_DATABASE_PLATFORM: Postgresql
ESPOCRM_DATABASE_HOST: postgres
ESPOCRM_DATABASE_PORT: "5432"
ESPOCRM_DATABASE_NAME: espocrm
ESPOCRM_DATABASE_USER: espocrm
ESPOCRM_DATABASE_PASSWORD: changeme
ESPOCRM_ADMIN_USERNAME: admin
ESPOCRM_ADMIN_PASSWORD: admin123
ESPOCRM_SITE_URL: "http://localhost:8080"
volumes:
- espocrm-data:/var/www/html
postgres:
image: postgres:16
environment:
POSTGRES_DB: espocrm
POSTGRES_USER: espocrm
POSTGRES_PASSWORD: changeme
volumes:
- pg-data:/var/lib/postgresql/data
volumes:
espocrm-data:
pg-data:
Start EspoCRM with a single command:
docker compose up -d
Access the CRM at http://localhost:8080 and log in with admin / admin123.
How Much Does EspoCRM Cost to Self-Host?
EspoCRM is free and open-source under the AGPL-3.0 license with no user limits. Self-hosting on Railway costs only your infrastructure usage — typically $5–15/month for small teams. Paid cloud hosting starts at $15/user/month. Optional paid extensions (Advanced Pack, Sales Pack, VoIP Integration) add features like visual BPM and advanced reporting.
EspoCRM vs SuiteCRM — Which Self-Hosted CRM to Choose?
| Feature | EspoCRM | SuiteCRM |
|---|---|---|
| UI/UX | Modern, responsive SPA | Legacy UI (v7), improving in v8 |
| Ease of setup | Quick Docker deploy | More complex setup |
| G2 ease-of-setup score | 9.0/10 | 8.3/10 |
| License | AGPL-3.0 | AGPL-3.0 |
| BPM/Workflows | Visual designer (paid extension) | Built-in workflows |
| Best for | Small-to-mid teams wanting clean UX | Teams needing SugarCRM compatibility |
EspoCRM is the better choice for teams that value a modern interface and fast deployment. SuiteCRM offers broader built-in features but with a steeper learning curve and older UI.
FAQ
What is EspoCRM and why self-host it? EspoCRM is an open-source CRM application for managing contacts, leads, sales opportunities, and customer support. Self-hosting gives you full data ownership, no per-user fees, and the ability to customize without vendor lock-in.
What does this Railway template deploy for EspoCRM? This template deploys the EspoCRM application server with Apache, a Railway-managed PostgreSQL database, a persistent volume for application files, and a background daemon for scheduled jobs — all pre-configured and ready to use.
Why does EspoCRM on Railway need PostgreSQL?
EspoCRM stores all CRM data (contacts, leads, deals, emails, workflows) in a relational database. PostgreSQL provides reliable, ACID-compliant storage. While EspoCRM traditionally uses MySQL/MariaDB, it fully supports PostgreSQL via the ESPOCRM_DATABASE_PLATFORM=Postgresql setting.
How do I enable email integration in self-hosted EspoCRM? Navigate to Administration → Email Accounts and add your IMAP server credentials for incoming email sync. For outgoing email, configure SMTP under Administration → Outbound Emails. EspoCRM supports Gmail, Outlook, and any standard IMAP/SMTP server.
Can I use EspoCRM's REST API for custom integrations on Railway?
Yes. EspoCRM exposes a full REST API at /api/v1/ with authentication via API keys or username/password. You can integrate with n8n, Zapier, or any webhook-based tool. Generate an API key under Administration → API Users.
How do I run background jobs and scheduled workflows in EspoCRM on Railway? The Railway template includes the EspoCRM daemon as a background process in the same container. It handles cron jobs, scheduled workflows, email fetching, and notification delivery automatically — no separate worker service needed.
Template Content
EspoCRM
espocrm/espocrm:latestESPOCRM_ADMIN_PASSWORD
Admin password (bootstrap-only)
ESPOCRM_ADMIN_USERNAME
Admin account username