Architecture
7 min read
• Last reviewed: 2026-12-02
• Amirparsa
A Lightweight, Resilient Linux VPS Stack for SSR Websites & AI Agents
Why FastAPI, SQLite WAL, Nginx, and systemd outperform bloated containerized stacks for SMB sites and self-hosted automation services.
Executive Summary (TL;DR)
For service websites, admin dashboards, and SMB AI agents, pairing FastAPI + Jinja2 SSR + SQLite WAL behind Nginx and systemd delivers sub-50ms responses without Docker or Redis overhead, keeps RAM usage tiny, and simplifies backups to a single zipped file.
1. The Problem: Unnecessary Operational Complexity
Many small business sites and internal AI tools get deployed with heavy multi-container stacks, external CDNs, and complex JS build pipelines — burning VPS RAM and failing unpredictably on constrained networks.
2. Minimal Production Architecture
[Client Browser / Crawler]
│ HTTPS (TLS 1.3)
▼
[Nginx Reverse Proxy + Static Cache]
│ 127.0.0.1:8000
▼
[systemd → Uvicorn + FastAPI SSR]
│
▼
[SQLite (WAL Mode) + Local Vendored Assets]
3. Enabling SQLite WAL Safely
import sqlite3
conn = sqlite3.connect("data/app.db", timeout=15.0)
conn.execute("PRAGMA journal_mode=WAL;")
conn.execute("PRAGMA foreign_keys=ON;")
conn.execute("PRAGMA busy_timeout=5000;")
4. VPS Hardening Checklist
- Run Uvicorn under a non-root user via
systemdwithRestart=always. - Vendor all fonts, icons, and UI CSS locally under
/static/(zero external CDN requests). - Run daily safe backups using
sqlite3 data/app.db ".backup backup.db"+ zip compression. - Monitor
/healthfrom Nginx or an uptime check.
5. Honest Limitations
This design targets single-node simplicity. If your workload grows to multi-region active-active writes, migrating to PostgreSQL and a dedicated job queue is the clean next step.
See full deliverables on High-Speed SSR Web Engineering.
References & Official Docs
Article FAQ
Is SQLite WAL reliable for production websites?
Yes. WAL mode allows concurrent reads alongside writes and comfortably serves content sites, lead portals, and bot backends at thousands of requests per day.
When should you migrate from SQLite to PostgreSQL?
When you need multi-node horizontal write scaling or hundreds of concurrent write transactions per second.