Frontends get the attention; backends carry the load. A well-structured backend lets you scale the part that is struggling without rebuilding everything, isolate failures, and keep data safe. This guide lays out a practical backend on virtual private servers, with the decisions that matter at each stage and the mistakes that cause trouble later.
The Backend Tiers
| Tier | Typical software | Scales by | Stateful? |
|---|---|---|---|
| Edge | Nginx, Caddy, HAProxy | Rarely needs to | No (certificates only) |
| API | Node.js, Python, Go, Java, PHP services | More processes or servers | No (keep it stateless) |
| Database | PostgreSQL, MySQL/MariaDB | Bigger server, replicas | Yes |
| Cache | Redis, Memcached | More memory | Mostly no |
| Queue and workers | Redis, RabbitMQ; Celery, BullMQ, Sidekiq | More workers or servers | Queue yes, workers no |
| Object storage | S3-compatible storage | Provider-managed | Yes |
Keeping the API and workers stateless is what makes scaling easy: any copy can handle any request or job.
Stage 1: Everything on One Server
EPYC VPS 4 vCores / 16 GB
Nginx :443 ─▶ API (127.0.0.1:8000, 4 processes)
├─▶ PostgreSQL (localhost)
├─▶ Redis (localhost: cache + queue)
└─ workers (2 processes)
This is efficient and simple, and suits most products for a long time. Use Docker Compose or systemd services, bind internal services to localhost, and keep the setup in code so it can be rebuilt (see our Ansible guide).
Stage 2: Separate the Database
The database is usually the first component to need dedicated resources. Move it to its own server with more memory, keep the API and workers on the first. Connect over a private network if available; otherwise use the public network with TLS (or a WireGuard tunnel) and a firewall that only allows the app server's IP to reach the database port.
Stage 3: Separate Workers
When background jobs compete with API requests, move workers to their own server. They connect to the same Redis or RabbitMQ and database. Heavy processing (media, reports, imports) no longer slows the API (see our workers guide).
Stage 4: Multiple API Servers
Put two or more API servers behind a load balancer for capacity and to deploy without downtime (see our load balancing guide). Requirements: sessions in Redis or tokens, uploads in object storage, and scheduled jobs on one designated node.
Internal Networking and Security
- Expose only the edge: ports 80/443 on the load balancer or web server; everything else closed to the internet.
- Allow-list internal traffic: database and Redis ports open only to the specific servers that need them.
- Encrypt between servers when traffic crosses networks you do not control: TLS for database and Redis connections, or a WireGuard mesh.
- Authenticate internal services: Redis with a password or ACLs, databases with per-service users and least privilege.
- Separate secrets per environment and per service.
Service Discovery Without Over-Engineering
With a handful of servers, you do not need a service mesh. Use stable private IPs or DNS names (for example, records like db.internal.example.com in your DNS, or /etc/hosts managed by Ansible) and keep the list in your configuration repository. Introduce dedicated discovery tools only when the number of services and servers genuinely requires it.
Configuration as Code
Every server should be rebuildable from your repository: packages, configuration files, systemd units, firewall rules and deploy scripts. Secrets live in an encrypted store (Ansible Vault or a secrets manager), not in plain files in Git. This turns a failed server into a routine rebuild rather than an emergency.
Observability for Every Tier
| Tier | Watch |
|---|---|
| Edge | Request rate, status codes, latency percentiles |
| API | Error rate, latency per endpoint, worker saturation |
| Database | Connections, slow queries, replication lag, disk |
| Cache | Memory, evictions, hit ratio |
| Queue | Queue length, oldest job age, failures |
| Hosts | CPU, memory, disk, network |
Use a request ID passed from the edge through the API to workers, so one user's problem can be traced across tiers in the logs (see our monitoring guide).
Data Protection
The database and object storage hold everything that matters. Automate backups with point-in-time recovery where possible (WAL archiving for PostgreSQL, binlogs for MySQL), keep copies off-site, and rehearse restores. A replica in another location shortens recovery after a server or datacenter problem.
Example Layout and Cost
| Role | EPYC plan | Price / month |
|---|---|---|
| API + edge | VPS 2 — 4 vCores / 16 GB | ₹1,299 |
| Database | VPS 3 — 8 vCores / 32 GB | ₹2,499 |
| Workers + Redis | VPS 1 — 2 vCores / 8 GB | ₹649 |
| Total | ₹4,447 |
All plans include an unmetered 1 Gbps port, so traffic between tiers and to users does not add per-GB charges.
Common Mistakes
- Splitting into many microservices before the team or load needs it.
- Exposing databases or Redis to the internet "temporarily".
- State on API servers (local sessions, uploads) that blocks scaling.
- No backups for the queue or object storage contents that matter.
- No way to trace a request across services.
Deploying a Multi-Tier Backend
With several servers, deploy order matters. Apply backward-compatible database migrations first, then roll out API servers one at a time behind the load balancer, then restart workers so they pick up the new code. Because old and new versions run side by side briefly, keep API responses and job payloads compatible across one release. A single deploy script or CI pipeline that knows this order removes most multi-server deploy mistakes (see our GitHub Actions guide).
Designing for Failure
Decide in advance what happens when each tier fails: if Redis restarts, does the API still serve requests without the cache? If the queue backs up, do users see delays rather than errors? Timeouts on every internal call, retries with backoff and graceful degradation keep one struggling component from taking down the rest.
SkyRainCloud Plans for This Workload
Typical backend splits: API servers on 4 vCores / 16 GB, a database on 8 vCores / 32 GB or larger, and workers or caches on 2–4 vCores. Start everything on one server and split by role as load grows.
AMD EPYC 7C13 VPS
Dedicated KVM vCores on AMD EPYC 7C13 (up to 3.70 GHz) with DDR4 ECC memory, NVMe SSD and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — AMD | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Websites, small APIs, bots, staging and VPN servers | Order |
| VPS 2 — AMD | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,299/month | WooCommerce, Node.js/Python backends, Docker Compose stacks, CI runners | Order |
| VPS 3 — AMD | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,499/month | Production databases, high-traffic sites, multi-container apps | Order |
| VPS 4 — AMD | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,899/month | Large production workloads, SaaS platforms, analytics, in-memory caches | Order |
Prices are monthly in INR as listed on the SkyRainCloud store (verified 2026-11-14). Stock and final pricing are shown on the product page at checkout.