---
title: "Deploy Open Source POS"
description: "Self-hosted point of sale with inventory, receipts and reports on MySQL."
category: "Other"
url: https://railway.com/deploy/self-hosted-pos-system
---

# Deploy Open Source POS

Self-hosted point of sale with inventory, receipts and reports on MySQL.

**[Deploy Open Source POS on Railway](https://railway.com/template/self-hosted-pos-system)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/self-hosted-pos-system/manifest.json

- **Creator:** blueorange
- **Category:** Other

## Template content

### 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`

### opensourcepos https://cdn.jsdelivr.net/gh/opensourcepos/opensourcepos@master/branding/emblem-white.svg

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

## Documentation

# Deploy and Host Open Source Point of Sale on Railway

![Open Source Point of Sale emblem](https://cdn.jsdelivr.net/gh/opensourcepos/opensourcepos@master/branding/emblem.svg)

Open Source Point of Sale (OSPOS) is a free, web-based POS and inventory system for small shops, with **4,000+ GitHub stars** and over a decade of development. It covers the sales register, barcode scanning, stock, receipts, invoices, customers, suppliers, gift cards and reports. This template runs OSPOS on Railway with a MySQL 9.4 database, HTTPS, a generated admin password and persistent storage for item photos. Square for Retail Plus costs $49 per location per month and Shopify POS Pro $89. Self-hosted OSPOS has no subscription per register or location, and runs for about $10–20/month with your sales data in your own database.

---

## What This Template Deploys

| Service | Purpose |
|---|---|
| **opensourcepos** | The OSPOS web app (PHP and Apache) on port `8080` with a public HTTPS domain. It runs database migrations and secures the admin account on boot. |
| **MySQL** | MySQL 9.4 holding items, sales, customers, settings and sessions, reached over Railway's private network. |
| **Persistent Volume** | Mounted at `/app/public/uploads` on opensourcepos for item pictures. |
| **Persistent Volume** | Mounted at `/var/lib/mysql` on MySQL. Every sale and stock movement survives redeploys. |

There are two services, connected by reference variables. The app container is the official OSPOS image plus a hardening layer, because upstream's own docker-compose file is labelled as a development setup, not for production.

---

## About Hosting Open Source Point of Sale

A cloud POS is easy to start, but costs add up per location, per register and per add-on, and your sales history lives on someone else's platform. OSPOS is the opposite: a self-hosted web app that runs in any browser on a till PC, tablet or laptop, with a USB barcode scanner and receipt printer.

Deploying OSPOS safely isn't trivial, though. A fresh install ships with the published default login `admin` / `pointofsale` and runs its first migration from an unauthenticated page. Behind a proxy it can generate `http://` links, and its session checks break when the client IP changes. This template fixes all of that. Migrations run inside the container, the admin password is replaced with a generated one before the app serves anyone, HTTPS and real client IPs are detected correctly, and a health check confirms the database is readable.

**Your admin password is generated.** Copy `OSPOS_ADMIN_PASSWORD` from the opensourcepos service's Variables tab and sign in as `admin`. The container won't start without a password, so the public default never goes live.

**First boot takes a few minutes.** OSPOS runs about 90 database migrations on the first start, so the health check allows up to 10 minutes. Later deploys start in seconds.

Typical cost: **~$10–20/month** on Railway for the app and MySQL. MySQL is tuned with a 1 GB buffer pool for speed, and you can lower it for a very small shop. Square for Retail Plus is $49 per location per month.

---

## Deploy Open Source Point of Sale in Under 10 Minutes

1. Click **Deploy on Railway**. MySQL starts and OSPOS runs its first-boot migrations (about 3–5 minutes).
2. Copy `OSPOS_ADMIN_PASSWORD` from the opensourcepos service's Variables tab.
3. Open your Railway URL and sign in as `admin` with that password.
4. Under **Configuration**, set your store name, address, currency, tax rates and receipt layout.
5. Add items (or import them from CSV), print barcode labels, and make your first sale in the register.

No LAMP stack. No default passwords left live. No per-location subscription.

---

## Common Use Cases

- **Retail shops.** Ring up sales with a barcode scanner, take cash or card, and print or email receipts.
- **Inventory management.** Track stock levels, item kits, attributes and receivings from suppliers.
- **Quotes and invoices.** Create quotations, turn them into invoices and email them to customers.
- **Cafés and small restaurants.** Use restaurant tables, rewards and gift cards.
- **Multi-user stores.** Give cashiers and managers separate logins with permission controls.
- **Reporting.** Sales, expenses, inventory, taxes and employee reports for accounting.
- **Cash-up at closing.** Reconcile tills at the end of each shift with the cash-up function.
- **Square and Shopify POS alternative.** Keep your data and stop paying per location.

---

## Configuration

| Variable | Required | Description |
|---|---|---|
| `OSPOS_ADMIN_PASSWORD` | 🔐 Auto-generated | Password for the `admin` account. The container refuses to start without one. |
| `OSPOS_ADMIN_USERNAME` | Optional | `admin`. The account whose password is set on boot. |
| `ENCRYPTION_KEY` | 🔐 Auto-generated | Encrypts stored data. Never change it after setup. |
| `MYSQL_HOST_NAME`, `MYSQL_USERNAME`, `MYSQL_PASSWORD`, `MYSQL_DB_NAME` | ✅ Auto-injected | Connection to the MySQL service over the private network. |
| `PHP_TIMEZONE` | Optional | `UTC`. Set your local zone (for example `Europe/London`) so receipts and reports show the right time. |
| `ALLOWED_HOSTNAMES_EXTRA` | Optional | Add your custom domain here, so OSPOS accepts it. |
| `OSPOS_LOG_THRESHOLD` | Optional | `4` (errors). Set `9` to log everything while troubleshooting. |
| `RAILWAY_HEALTHCHECK_TIMEOUT_SEC` | ✅ Set | `600`, allowing time for first-boot migrations. |
| `MYSQL_ROOT_PASSWORD` | 🔐 Auto-generated | MySQL superuser password. |

**Set your timezone first.** Change `PHP_TIMEZONE` before you start selling. Otherwise sale times, daily reports and cash-ups are recorded in UTC.

**Receipt printers and scanners.** OSPOS runs in the browser, so USB barcode scanners work as keyboards with no setup. Receipts print through the browser's print dialog to any receipt printer installed on the till computer.

---

## Open Source POS on Railway vs. Alternatives

| | OSPOS on Railway | Square for Retail | Shopify POS | Lightspeed Retail |
|---|---|---|---|---|
| **Monthly cost** | ~$10–20 usage, any number of tills | Free plan, Plus $49 per location | POS Pro $89 per location, plus a Shopify plan | Paid plans |
| **Self-hosted** | ✅ Yes | ❌ No | ❌ No | ❌ No |
| **Per-location fees** | ✅ None | ❌ Per location | ❌ Per location | ❌ Per location |
| **Use any payment processor** | ✅ Record any tender | ⚠️ Square payments | ⚠️ Shopify Payments preferred | ⚠️ Lightspeed Payments preferred |
| **Inventory and suppliers** | ✅ Yes | ✅ On Plus | ✅ Yes | ✅ Yes |
| **Your data in your own database** | ✅ MySQL | ❌ Hosted | ❌ Hosted | ❌ Hosted |
| **License** | ⚠️ MIT plus required footer | ❌ Proprietary | ❌ Proprietary | ❌ Proprietary |

---

## Dependencies for Open Source POS Hosting

- Railway account. The Hobby plan works for a single shop; Pro suits several busy tills.
- A computer or tablet with a browser at each till, plus optional USB barcode scanners and receipt printers.
- A card terminal from your bank or a payment provider. OSPOS records the payment type; it doesn't process cards.

### Deployment Dependencies

- [Open Source Point of Sale on GitHub](https://github.com/opensourcepos/opensourcepos): source code and releases
- [OSPOS website](https://opensourcepos.org): demo and project information
- [MySQL Documentation](https://dev.mysql.com/doc/): database reference
- [Railway Volumes Documentation](https://docs.railway.com/volumes): persistence

### Implementation Details

The app image wraps `jekkos/opensourcepos` (CodeIgniter 4 on PHP and Apache). Its entrypoint rewrites the app's `.env` from Railway variables on each boot, runs migrations with a retry loop while MySQL starts, sets the admin password, and enables HTTPS awareness and correct client IPs behind Railway's proxy. Apache is limited to 32 workers to fit the container.

The OSPOS licence is MIT with one condition: the footer showing the version and a link to opensourcepos.org must stay visible on every page.

---

## Frequently Asked Questions

**What is Open Source Point of Sale?**
OSPOS is a free, web-based point of sale and inventory system for small businesses: a sales register, stock, customers, suppliers, invoices, gift cards and reports, all in the browser.

**How much does it cost compared to Square or Shopify POS?**
About $10–20/month on Railway for the app and database, with no fee per location or register. Square for Retail Plus is $49 per location per month, and Shopify POS Pro is $89 per location on top of a Shopify plan.

**What is the default login?**
The username is `admin`, and the password is `OSPOS_ADMIN_PASSWORD` from the Variables tab. The public default `pointofsale` password is replaced before the app goes live.

**Do I lose sales data when Railway redeploys?**
No. Sales, items and settings are in MySQL on its volume, and item pictures are on the uploads volume. Redeploys keep everything.

**Can OSPOS take card payments?**
It records payments of any type (cash, card, gift card, check) but doesn't process cards itself. Use a separate card terminal and record the sale in OSPOS.

**Can I remove the OSPOS footer or rebrand it?**
You can change themes and your store details, but the licence requires the version footer and opensourcepos.org link to stay visible on every page.

---

## Why Deploy and Host Open Source Point of Sale on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Open Source Point of Sale on Railway, you get a secure, self-hosted POS and inventory system with your own MySQL database, with no fees per register or location.


## 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/self-hosted-pos-system
