---
title: "Deploy OpenCart"
description: "Open-source shopping cart for running an online store"
category: "Other"
url: https://railway.com/deploy/opencart-shop
---

# Deploy OpenCart

Open-source shopping cart for running an online store

**[Deploy OpenCart on Railway](https://railway.com/template/opencart-shop)**

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

- **Creator:** A3A
- **Category:** Other
- **Total deploys:** 1

## Template content

### Redis https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/redis.svg

- **Image:** redis:8.2
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### MySQL https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/mysql.svg

- **Image:** mysql:9.4
- **Start command:** `docker-entrypoint.sh mysqld --innodb-use-native-aio=0 --disable-log-bin --performance_schema=0 --innodb-buffer-pool-size=1G`

### mailpit https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/mailpit.svg

- **Image:** axllent/mailpit:latest
- **Health check:** /livez
- **Public domain:** Yes

### opencart https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/opencart.png

- **Source:** https://github.com/gridalpha/opencart-railway
- **Health check:** /healthz
- **Public domain:** Yes

### opencart-cron https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/opencart.png

- **Source:** https://github.com/gridalpha/opencart-railway

## Documentation

# Deploy and Host OpenCart on Railway

OpenCart is an open-source shopping cart written in PHP that has powered independent online stores since 2009. It gives you a storefront, a catalogue with options and downloadable goods, customer accounts, a multi-currency checkout, and an admin panel for orders and reports. It is deliberately lightweight — one PHP application over MySQL, no build step and no framework to learn — which is why small merchants and agencies pick it over Magento. Self-host OpenCart and your catalogue, customers and order history stay in a database you control.

This template runs OpenCart 4.1.0.4 across five Railway services. `opencart` is the PHP and Apache container serving the storefront and `/admin`, with a volume holding product images, downloads, customer uploads and backups. `MySQL` holds every catalogue, order, customer and session row, and `Redis` is wired up as the cache engine. `opencart-cron` is a second container from the same image running OpenCart's scheduled tasks on an interval instead of a crontab. `mailpit` is a capture-only mailbox on the private network, so order and account mail is visible immediately; swap it for a real relay when you go live. The store installs itself on first boot from the variables you fill in before deploying.

![Diagram of the OpenCart, cron, MySQL, Redis and Mailpit services](https://res.cloudinary.com/rroe4rtk/image/upload/f_auto,q_auto/v1789234980/opencart-architecture.webp)

## Getting Started with OpenCart on Railway

Set `OPENCART_ADMIN_PASSWORD` to 5–20 characters before deploying — OpenCart's installer enforces that range — and optionally change `OPENCART_ADMIN_USERNAME`, `OPENCART_ADMIN_EMAIL` and `OPENCART_STORE_NAME`. When the deploy finishes, open the public URL: you land on a working storefront pre-loaded with OpenCart's demo catalogue. Sign in at `/admin/` with the credentials you supplied. Your first job is Extensions → Extensions → Payments and Shipping, where you enable at least one of each — a fresh install ships with none on, so checkout cannot complete until you do. Then clear the demo products under Catalog → Products and add your own. System → Settings carries the store name, address, currency and tax rules. To confirm everything works, register a customer, request a password reset, and open the Mailpit URL: the message should be waiting in the inbox.

![OpenCart storefront home page with featured products and category menu](https://res.cloudinary.com/rroe4rtk/image/upload/f_auto,q_auto/v1789234983/opencart-storefront-home.webp)

![OpenCart shopping cart holding two products with tax and totals](https://res.cloudinary.com/rroe4rtk/image/upload/f_auto,q_auto/v1789234984/opencart-shopping-cart.webp)

![OpenCart guest checkout form for personal details and shipping address](https://res.cloudinary.com/rroe4rtk/image/upload/f_auto,q_auto/v1789234985/opencart-checkout-guest.webp)

![OpenCart admin dashboard with sales analytics and customer totals](https://res.cloudinary.com/rroe4rtk/image/upload/f_auto,q_auto/v1789234987/opencart-admin-dashboard.webp)

![OpenCart admin product catalogue listing the demo inventory](https://res.cloudinary.com/rroe4rtk/image/upload/f_auto,q_auto/v1789234988/opencart-admin-catalog.webp)

![Mailpit inbox holding the password reset mail OpenCart sent over SMTP](https://res.cloudinary.com/rroe4rtk/image/upload/f_auto,q_auto/v1789234989/opencart-mailpit-inbox.webp)

## About Hosting OpenCart

OpenCart is a classic LAMP application: PHP renders every page, MySQL stores everything, and there is no Node build, no queue broker and no search cluster to operate. That makes it one of the cheapest serious carts to run, and popular with agencies managing many small stores.

Key features:

- Unlimited products, categories, manufacturers and downloadable goods
- Multi-store: several storefronts, each with its own domain and theme
- Multi-currency, multi-language, and tax rules by geo zone
- Customer groups, discounts, coupons, reward points and affiliate tracking

`opencart` is the only service on the public internet and holds the volume; OpenCart's storage directory sits outside the web root on it, so uploads and logs are never directly reachable. `MySQL` carries sessions as well as data, so a redeploy never signs anyone out. `opencart-cron` has no volume and waits for the schema before its first run.

## Why Deploy OpenCart on Railway

Railway removes the server administration a PHP cart usually brings.

- MySQL and Redis are provisioned, backed up and private by default
- The volume keeps product images and downloads across every redeploy
- A public HTTPS domain with an automatic certificate, plus custom domains
- Scaling without touching Apache or PHP config
- The cron tier runs as a real service, not a fragile crontab

## Common Use Cases

- A retail store that wants to own its catalogue, customers and order history outright
- An agency running several client storefronts from one admin with multi-store
- A B2B shop needing customer groups, per-group pricing and regional tax rules
- A staging store for testing themes, gateways and extensions before production

## Dependencies for OpenCart

- **OpenCart 4.1.0.4** on `php:8.3-apache`, built from [gridalpha/opencart-railway](https://github.com/gridalpha/opencart-railway); upstream is [opencart/opencart](https://github.com/opencart/opencart)
- **MySQL 9** — catalogue, orders, customers, settings and sessions
- **Redis 8** — cache engine for settings, categories and product listings
- **Mailpit** (`axllent/mailpit`) — capture-only inbox for order and account mail

### Deployment Dependencies

- Source repository: 
- Upstream project: 
- Documentation: 

## Hardware Requirements for Self-Hosting OpenCart

| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 1 vCPU | 2 vCPU |
| RAM | 512 MB | 2 GB |
| Storage | 2 GB volume | 10 GB or more for product images |
| Runtime | PHP 8.1+, MySQL 8+ | PHP 8.3, MySQL 9, Redis 8 |

Storage is the value to watch: product photography grows far faster than the database.

## Self-Hosting OpenCart

OpenCart ships as a release archive, not a container image, so a manual install is a download, an unzip and a command-line installer. Copy the archive's `upload/` directory into your web root and create the two config files the installer writes into:

```
curl -L -o opencart.zip \
  https://github.com/opencart/opencart/releases/download/4.1.0.4/opencart-4.1.0.4.zip
unzip -q opencart.zip -d /tmp/opencart
cp -a /tmp/opencart/upload/. /var/www/html/
touch /var/www/html/config.php /var/www/html/admin/config.php
chmod 666 /var/www/html/config.php /var/www/html/admin/config.php
```

The installer is a PHP script that creates the schema, loads the demo catalogue and writes both config files in one pass. Delete `install/` afterwards, or the admin keeps warning you:

```
php /var/www/html/install/cli_install.php install \
  --username admin --password changeme --email you@example.com \
  --http_server https://shop.example.com/ \
  --db_driver mysqli --db_hostname 127.0.0.1 --db_port 3306 \
  --db_username opencart --db_password secret \
  --db_database opencart --db_prefix oc_
rm -rf /var/www/html/install
```

You also need PHP's `mysqli`, `gd`, `curl`, `zip`, `zlib` and `openssl` extensions.

## How Much Does OpenCart Cost to Self-Host?

OpenCart is free and open source under the GPLv3, with no licence fee, no per-order commission and no transaction limits — unlike hosted carts, which take a percentage of every sale. The only cost is infrastructure: on Railway, compute for the store and cron containers, the managed MySQL and Redis instances, and the volume holding your images.

## FAQ

**What is OpenCart?**

A free, open-source ecommerce platform written in PHP and backed by MySQL. It provides a storefront, a catalogue, a checkout and an admin panel for orders and customers, and has been maintained since 2009.

**Why does the template include Redis and a separate cron service?**

Redis makes OpenCart's settings, category and product-listing lookups faster than the default file cache while keeping the container stateless. The cron service exists because OpenCart's currency, GDPR and subscription jobs are normally driven by a crontab, which a container has none of.

**How do I take payments in self-hosted OpenCart?**

A fresh install enables no payment methods. Go to Extensions → Extensions → Payments and install one; Cash On Delivery and Bank Transfer ship with OpenCart, and Stripe, PayPal and Square are on the marketplace. Do the same for Shipping.

**Where are uploaded product images stored, and do they survive a redeploy?**

On the volume mounted at `/data`, along with downloadable goods, customer uploads and backups. It persists across redeploys and restarts; only the application code is replaced.

**Can I use a custom domain with OpenCart on Railway?**

Yes. Add the domain to the `opencart` service, point DNS at it, then set `OPENCART_PUBLIC_URL` to `https://your-domain.com` so the store writes the right base URL on the next deploy.

**How do I upgrade OpenCart later?**

The version is pinned deliberately: OpenCart owns its database schema and has no automatic migrator. Read upstream's `UPGRADE.md`, back up the database first, and raise the version only when you are ready.


## 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) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/opencart-shop
