Short answer: yes. 100,000 requests a month averages 0.04 requests per second, so a single $10 VPS has hundreds of times more request capacity than you need. What actually limits you is RAM, backups and security. A plain PHP-FPM + SQLite (WAL) + Caddy stack idles at roughly 120-250 MB, where a full framework with MySQL, Redis and a queue worker needs 700-1,100 MB. This blueprint covers the code for auth, Stripe webhooks and a job queue, the server config, and the failure modes that matter at this size.

The Problem & Architectural Baseline

Do the arithmetic before you pick a stack. 100,000 requests spread over a 30-day month is 100,000 / 2,592,000 seconds, or 0.039 requests per second. Assume traffic bunches up and your busy hour is 20 times the average: that is still under one request per second. A single PHP worker answering in 10 ms can handle 100 requests per second. You are not buying capacity, you are buying a place to run things.

So why do small SaaS products end up on $40 to $100 a month of infrastructure? Because the default stack is sized for a different problem: a framework with a container-friendly directory tree, MySQL or Postgres on its own, Redis for cache and queues, a queue worker, a scheduler, and often a build step with a few hundred megabytes of dependencies. Each piece is reasonable. Together they pull your idle RAM past 1 GB, double the number of processes you have to patch, and push you onto a bigger VPS for headroom you never use.

The lightweight alternative gives up something real, and it is worth naming the trade-offs up front:

Trade-offFull framework stackThis blueprint
Memory vs. featuresLarge footprint, batteries includedSmall footprint, you write the few batteries you need
Security defaults vs. controlCSRF, auth and hashing handled by the frameworkYou own them, so the code below does it explicitly
Database concurrency vs. simplicityServer database, many concurrent writersSQLite, one writer at a time, no server to run
Queue features vs. process countRedis plus workers, dashboards, retriesA jobs table and a cron-driven worker
Team velocity vs. ops surfaceFaster for large teams, more to patchFaster for one to three people, less to patch

Frameworks are not the villain here. For a team of five shipping twenty features a month, the conventions pay for themselves. The argument is narrower: at a hundred thousand requests a month with one or two engineers, you are paying framework-scale costs for framework-scale problems you do not have yet. The sections below show what the minimum looks like when you still take security and recovery seriously.

System Architecture / Request Flow

 Browser
    |  HTTPS
    v
 +-----------+   static assets served with Cache-Control: immutable
 |  Caddy    |--------------------------------> (optional CDN in front)
 +-----+-----+
       | FastCGI over a unix socket
       v
 +-------------+  prepared statements   +--------------------------+
 |  PHP-FPM    |<---------------------->| SQLite in WAL mode       |
 |  ondemand,  |  BEGIN IMMEDIATE for   | /var/lib/app/app.sqlite  |
 |  6 workers  |  write-first work      +------------+-------------+
 +------+------+                                     |
        | INSERT into jobs                           | hourly: sqlite3 .backup
        v                                            v
 +-------------+  cron, every minute      +--------------------------+
 | worker.php  |-----> transactional      | offsite copy on another  |
 | flock guard |       email API (cURL)   | provider (rclone/restic) |
 +-------------+                          +--------------------------+

 Stripe --- webhook ---> /stripe/webhook   (HMAC verified, timestamp checked, idempotent)
  1. Edge. Caddy terminates TLS with automatic certificates and serves static files with long-lived cache headers. A CDN in front is optional at this size, and useful mostly for global latency.
  2. Application. PHP-FPM runs in ondemand mode, so idle time costs almost no memory. A short front controller matches the route table and calls a handler.
  3. Data. SQLite in WAL mode lives in the same process as the request. There is no connection pool, no network hop and no second server to patch.
  4. Background work. Handlers insert a row into jobs. A cron-started worker claims jobs inside a write-locked transaction, calls the mail API, and retries with backoff.
  5. Payments. Stripe posts webhooks to one endpoint. The handler verifies the HMAC signature and timestamp, then records the event ID so retries are harmless.
  6. Recovery. An hourly job takes a consistent SQLite backup, checks its integrity, compresses it and copies it to a second provider.

Empirical Benchmarks & Real Comparison Data

Test profile. Each stack runs on one 2 vCPU / 2 GB NVMe VPS (budget providers such as Hetzner sell this class for roughly $4-5 a month, while DigitalOcean, Vultr and Linode charge about $10-12 for 2 GB, so check current pricing). The test page checks the session and runs two indexed queries. Load comes from wrk at 20 concurrent connections for 60 seconds, with OPcache on. Variant A is a Laravel-class framework with MySQL, Redis and a queue worker. Variant C is a small routing library with MariaDB.

These are representative ranges for stacks of this shape on this class of VPS. They are not a measured result from FortiLabs infrastructure, and your queries, extensions and settings will move them. Reproduce them with the commands below and replace the ranges with your own numbers before you rely on them.

wrk -t2 -c20 -d60s --latency https://app.example.com/api/projects/1
ps -eo rss,comm --sort=-rss | head -15     # resident memory per process, in KB
free -m                                    # total used memory
MetricA: Full framework + MySQL + RedisB: This blueprint (PHP + SQLite)C: Micro-framework + MariaDB
Idle RAM, whole stack (MB)700-1,100120-250350-600
RAM at 20 concurrent requests (MB)900-1,400200-350450-750
Dynamic page throughput per vCPU (req/s)40-90150-40080-200
Latency p50 (ms)25-603-108-25
Latency p99 at 20 concurrent (ms)120-40015-4040-120
Monthly request ceiling at 30% utilization, 1 vCPU31-70M115-310M62-155M
Application and dependencies on disk (MB)80-2501-515-40
Fresh-server deploy time (minutes)20-408-1515-25
Processes to patch and monitor6-834-5
Smallest comfortable VPS2-4 GB1 GB2 GB
Monthly infrastructure cost, one box$10-24$4-10$10-12

How to read it. Every column clears 100,000 requests a month by a wide margin: even the heaviest stack has a ceiling above 30 million. Throughput is not where these designs differ. The difference is memory, which decides the VPS size you need, and process count, which decides how much patching and monitoring you carry. Note the ceiling row is a capacity estimate (requests per second times 30% of the 2.59 million seconds in a month), not a promise.

The wider point is that a smaller stack also leaves room for the things that protect you: swap, a second app in the same box, or simply a margin before the OOM killer picks a victim. Walkthroughs of this kind of build, including cheap-VPS deployments, are on the RevStack YouTube channel.

When to Stay Lightweight and When to Move On

Your situationRecommendationWhy
One to three developers, under about 1M dynamic requests a monthStay lightweightEvery extra moving part is time you spend patching instead of shipping.
Four or more developers, many features, admin panels, mailersAdopt a mainstream frameworkShared conventions and an ecosystem save more than the RAM costs.
Sustained write load above roughly 50-100 transactions per secondMove to MariaDB or PostgresSQLite allows one writer at a time. Reads still scale, writes queue.
Uptime guarantees, multi-region users, zero-downtime deploysTwo or more app nodes and a managed databaseA single VPS is a single point of failure by definition.
Customers ask for SOC 2 or similar attestationsManaged services and documented infrastructureAuditors want evidence, which managed platforms generate for you.

If you are still choosing what to build, the tool-website ideas walkthrough covers products whose traffic profile fits this footprint well.

Production-Ready Code Implementation

Plain PHP 8.1+ with the pdo_sqlite and curl extensions. No Composer packages. Lay the project out as /srv/app/public/index.php (the only web-reachable file), /srv/app/src/, /srv/app/bin/, and the database at /var/lib/app/app.sqlite. Run sqlite3 /var/lib/app/app.sqlite < schema.sql once to create tables. Secrets such as STRIPE_WEBHOOK_SECRET and MAIL_API_KEY go in an environment file readable only by the app user.

1. Schema

CREATE TABLE IF NOT EXISTS users (
  id                 INTEGER PRIMARY KEY,
  email              TEXT NOT NULL UNIQUE COLLATE NOCASE,
  password_hash      TEXT NOT NULL,
  plan               TEXT NOT NULL DEFAULT 'free',
  stripe_customer_id TEXT UNIQUE,
  created_at         INTEGER NOT NULL DEFAULT (CAST(strftime('%s','now') AS INTEGER))
);

CREATE TABLE IF NOT EXISTS projects (
  id      INTEGER PRIMARY KEY,
  user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
  name    TEXT NOT NULL
);

CREATE TABLE IF NOT EXISTS login_attempts (ip_hash TEXT NOT NULL, at INTEGER NOT NULL);
CREATE INDEX IF NOT EXISTS idx_login_attempts ON login_attempts (ip_hash, at);

CREATE TABLE IF NOT EXISTS stripe_events (id TEXT PRIMARY KEY, received_at INTEGER NOT NULL);

CREATE TABLE IF NOT EXISTS jobs (
  id        INTEGER PRIMARY KEY,
  type      TEXT NOT NULL,
  payload   TEXT NOT NULL,
  run_at    INTEGER NOT NULL,
  attempts  INTEGER NOT NULL DEFAULT 0,
  locked_at INTEGER
);
CREATE INDEX IF NOT EXISTS idx_jobs_due ON jobs (run_at) WHERE locked_at IS NULL;

2. Database bootstrap: src/db.php

<?php
declare(strict_types=1);

function db(): PDO
{
    static $pdo = null;
    if ($pdo !== null) { return $pdo; }

    $pdo = new PDO('sqlite:' . (getenv('APP_DB') ?: '/var/lib/app/app.sqlite'), null, null, [
        PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
        PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
        PDO::ATTR_EMULATE_PREPARES   => false,
    ]);
    $pdo->exec('PRAGMA journal_mode = WAL');      // readers never block the writer
    $pdo->exec('PRAGMA synchronous = NORMAL');    // safe in WAL mode, far fewer fsyncs
    $pdo->exec('PRAGMA busy_timeout = 5000');     // wait up to 5 s for the write lock instead of failing
    $pdo->exec('PRAGMA foreign_keys = ON');       // off by default in SQLite
    return $pdo;
}

3. Front controller and router: public/index.php

<?php
declare(strict_types=1);

require __DIR__ . '/../src/db.php';
require __DIR__ . '/../src/auth.php';
require __DIR__ . '/../src/stripe.php';

header('X-Content-Type-Options: nosniff');
header('X-Frame-Options: DENY');
header('Referrer-Policy: strict-origin-when-cross-origin');
header("Content-Security-Policy: default-src 'self'; frame-ancestors 'none'");
header('Strict-Transport-Security: max-age=31536000');

$routes = [
    ['GET',  '#^/$#',                   'page_home'],
    ['POST', '#^/register$#',           'handle_register'],
    ['POST', '#^/login$#',              'handle_login'],
    ['GET',  '#^/api/projects/(\d+)$#', 'api_project'],
    ['POST', '#^/stripe/webhook$#',     'stripe_webhook'],
];

$method = $_SERVER['REQUEST_METHOD'] ?? 'GET';
$path   = rawurldecode((string) parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH));

foreach ($routes as [$m, $pattern, $handler]) {
    if ($m === $method && preg_match($pattern, $path, $args) === 1) {
        array_shift($args);
        try {
            $handler(...$args);
        } catch (Throwable $e) {
            error_log((string) $e);                 // details go to the log, never to the visitor
            http_response_code(500);
            echo 'Server error';
        }
        exit;
    }
}
http_response_code(404);
echo 'Not found';

4. Sessions, CSRF, registration, login and a protected API route: src/auth.php

<?php
declare(strict_types=1);

function session_boot(): void
{
    if (session_status() === PHP_SESSION_ACTIVE) { return; }
    session_name('__Host-sid');                    // __Host- prefix: Secure, Path=/, no Domain
    session_set_cookie_params(['lifetime' => 0, 'path' => '/', 'secure' => true, 'httponly' => true, 'samesite' => 'Lax']);
    session_start();
}

function csrf_token(): string
{
    session_boot();
    return $_SESSION['csrf'] ??= bin2hex(random_bytes(32));
}

function csrf_check(): void
{
    session_boot();
    $sent = (string) ($_POST['csrf'] ?? $_SERVER['HTTP_X_CSRF_TOKEN'] ?? '');
    if (!hash_equals((string) ($_SESSION['csrf'] ?? ''), $sent)) { http_response_code(403); exit('Bad CSRF token'); }
}

function require_user(): int
{
    session_boot();
    $id = $_SESSION['uid'] ?? null;
    if (!is_int($id)) { http_response_code(401); exit; }
    return $id;
}

function too_many_attempts(string $ip): bool
{
    $st = db()->prepare('SELECT COUNT(*) FROM login_attempts WHERE ip_hash = ? AND at > ?');
    $st->execute([hash('sha256', $ip), time() - 900]);
    return (int) $st->fetchColumn() >= 10;         // 10 failures per 15 minutes per IP
}

function page_home(): void
{
    header('Content-Type: text/html; charset=utf-8');
    echo '<!doctype html><title>App</title><form method="post" action="/login">',
         '<input type="hidden" name="csrf" value="', htmlspecialchars(csrf_token(), ENT_QUOTES), '">',
         '<input name="email" type="email" required><input name="password" type="password" required>',
         '<button>Log in</button></form>';
}

function handle_register(): void
{
    csrf_check();
    $email = strtolower(trim((string) ($_POST['email'] ?? '')));
    $pass  = (string) ($_POST['password'] ?? '');
    if (filter_var($email, FILTER_VALIDATE_EMAIL) === false || strlen($pass) < 12 || strlen($pass) > 256) {
        http_response_code(422);
        exit('Enter a valid email and a password of 12 to 256 characters.');
    }
    try {
        db()->prepare('INSERT INTO users (email, password_hash) VALUES (?, ?)')
            ->execute([$email, password_hash($pass, PASSWORD_DEFAULT)]);
    } catch (PDOException $e) {
        if ($e->getCode() !== '23000') { throw $e; }   // duplicate email: answer identically, no account enumeration
    }
    header('Location: /check-your-email', true, 303);  // a queued job sends the verification mail
}

function handle_login(): void
{
    csrf_check();
    $ip = $_SERVER['REMOTE_ADDR'] ?? '';
    if (too_many_attempts($ip)) { http_response_code(429); header('Retry-After: 900'); exit('Too many attempts'); }

    $st = db()->prepare('SELECT id, password_hash FROM users WHERE email = ?');
    $st->execute([strtolower(trim((string) ($_POST['email'] ?? '')))]);
    $u = $st->fetch();

    static $dummy = null;                           // hash a throwaway value for unknown emails so timing matches
    $dummy ??= password_hash(bin2hex(random_bytes(8)), PASSWORD_DEFAULT);
    $ok = password_verify((string) ($_POST['password'] ?? ''), $u['password_hash'] ?? $dummy);

    if ($u === false || !$ok) {
        db()->prepare('INSERT INTO login_attempts (ip_hash, at) VALUES (?, ?)')->execute([hash('sha256', $ip), time()]);
        http_response_code(401);
        exit('Wrong email or password');
    }
    session_boot();
    session_regenerate_id(true);                    // defeats session fixation
    $_SESSION['uid'] = (int) $u['id'];
    header('Location: /', true, 303);
}

function api_project(string $id): void
{
    $uid = require_user();
    $st  = db()->prepare('SELECT id, name FROM projects WHERE id = ? AND user_id = ?');   // ownership lives in the WHERE clause
    $st->execute([(int) $id, $uid]);
    $row = $st->fetch();
    header('Content-Type: application/json');
    if ($row === false) { http_response_code(404); echo '{"error":"not_found"}'; return; }
    echo json_encode($row, JSON_THROW_ON_ERROR);
}

5. Stripe webhook with signature check and idempotency: src/stripe.php

<?php
declare(strict_types=1);

function stripe_webhook(): void
{
    $secret  = (string) getenv('STRIPE_WEBHOOK_SECRET');
    $payload = (string) file_get_contents('php://input');

    // Header looks like: t=1700000000,v1=hexsignature[,v1=...]
    $t = null;
    $sigs = [];
    foreach (explode(',', $_SERVER['HTTP_STRIPE_SIGNATURE'] ?? '') as $part) {
        [$k, $v] = array_pad(explode('=', $part, 2), 2, '');
        if ($k === 't') { $t = (int) $v; } elseif ($k === 'v1') { $sigs[] = $v; }
    }
    if ($secret === '' || $t === null || abs(time() - $t) > 300) { http_response_code(400); return; }   // stale = replay

    $expected = hash_hmac('sha256', $t . '.' . $payload, $secret);
    $valid = false;
    foreach ($sigs as $s) { $valid = hash_equals($expected, $s) || $valid; }
    if (!$valid) { http_response_code(400); return; }

    $event = json_decode($payload, true, 16, JSON_THROW_ON_ERROR);
    $pdo   = db();
    $pdo->beginTransaction();
    try {
        $seen = $pdo->prepare('INSERT OR IGNORE INTO stripe_events (id, received_at) VALUES (?, ?)');
        $seen->execute([(string) $event['id'], time()]);
        if ($seen->rowCount() === 0) { $pdo->commit(); http_response_code(200); return; }   // already handled

        $obj = $event['data']['object'] ?? [];
        if ($event['type'] === 'checkout.session.completed') {
            $pdo->prepare("UPDATE users SET plan = 'pro', stripe_customer_id = ? WHERE id = ?")
                ->execute([$obj['customer'] ?? null, (int) ($obj['client_reference_id'] ?? 0)]);
        } elseif ($event['type'] === 'customer.subscription.deleted') {
            $pdo->prepare("UPDATE users SET plan = 'free' WHERE stripe_customer_id = ?")
                ->execute([$obj['customer'] ?? null]);
        }
        $pdo->commit();
    } catch (Throwable $e) {
        $pdo->rollBack();                           // the event id is not recorded, so Stripe's retry will reprocess it
        throw $e;
    }
    http_response_code(200);
}

6. Queue worker: bin/worker.php

<?php
declare(strict_types=1);
require __DIR__ . '/../src/db.php';

function post_json(string $url, string $key, array $body): void
{
    $ch = curl_init($url);
    curl_setopt_array($ch, [
        CURLOPT_POST           => true,
        CURLOPT_HTTPHEADER     => ['Content-Type: application/json', 'Authorization: Bearer ' . $key],
        CURLOPT_POSTFIELDS     => json_encode($body, JSON_THROW_ON_ERROR),
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CONNECTTIMEOUT => 5,
        CURLOPT_TIMEOUT        => 15,
    ]);
    $res  = curl_exec($ch);
    $code = (int) curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
    if ($res === false || $code >= 300) { throw new RuntimeException("mail API HTTP $code " . curl_error($ch)); }
}

function run_job(string $type, array $payload): void
{
    match ($type) {
        'send_email' => post_json((string) getenv('MAIL_API_URL'), (string) getenv('MAIL_API_KEY'), $payload),
        default      => throw new RuntimeException("unknown job type $type"),
    };
}

$lock = fopen('/run/lock/app-worker.lock', 'c');
if ($lock === false || !flock($lock, LOCK_EX | LOCK_NB)) { exit(0); }   // previous run still going

$pdo      = db();
$deadline = time() + 55;                            // cron starts a new run every minute

// Jobs whose worker died mid-run: release them (the attempt counter still limits retries)
$pdo->prepare('UPDATE jobs SET locked_at = NULL WHERE locked_at < ? AND attempts < 5')->execute([time() - 600]);

while (time() < $deadline) {
    $pdo->exec('BEGIN IMMEDIATE');                  // take the write lock before reading, so two workers cannot claim one job
    $st = $pdo->prepare('SELECT id, type, payload, attempts FROM jobs WHERE locked_at IS NULL AND run_at <= ? ORDER BY run_at LIMIT 1');
    $st->execute([time()]);
    $job = $st->fetch();
    if ($job === false) { $pdo->exec('COMMIT'); sleep(5); continue; }
    $pdo->prepare('UPDATE jobs SET locked_at = ?, attempts = attempts + 1 WHERE id = ?')->execute([time(), $job['id']]);
    $pdo->exec('COMMIT');

    try {
        run_job($job['type'], json_decode($job['payload'], true, 8, JSON_THROW_ON_ERROR));
        $pdo->prepare('DELETE FROM jobs WHERE id = ?')->execute([$job['id']]);
    } catch (Throwable $e) {
        error_log('job ' . $job['id'] . ' failed: ' . $e->getMessage());
        $attempts = (int) $job['attempts'] + 1;
        if ($attempts < 5) {                        // exponential backoff: 60 s, 120 s, 240 s, 480 s
            $pdo->prepare('UPDATE jobs SET locked_at = NULL, run_at = ? WHERE id = ?')
                ->execute([time() + 30 * (2 ** $attempts), $job['id']]);
        }                                           // at 5 attempts it stays locked: a dead letter to inspect by hand
    }
}

7. Server configuration, cron and first-day hardening

# ---- /etc/caddy/Caddyfile (automatic HTTPS and renewals) ----
app.example.com {
    root * /srv/app/public
    encode zstd gzip
    @static path *.css *.js *.woff2 *.png *.webp *.svg
    header @static Cache-Control "public, max-age=31536000, immutable"
    @dotfiles path /.*
    respond @dotfiles 404
    php_fastcgi unix//run/php/php-fpm.sock
    file_server
}

# ---- php-fpm pool ----
pm = ondemand
pm.max_children = 6                 ; 6 x ~30 MB worst case = ~180 MB
pm.process_idle_timeout = 30s
pm.max_requests = 500
php_admin_value[memory_limit] = 64M
php_admin_value[open_basedir] = /srv/app:/var/lib/app:/tmp
env[APP_DB] = /var/lib/app/app.sqlite

# ---- php.ini ----
opcache.enable = 1
opcache.memory_consumption = 64
opcache.validate_timestamps = 0     ; reload php-fpm on deploy
expose_php = Off
display_errors = Off

# ---- /etc/cron.d/app ----
* * * * * app php /srv/app/bin/worker.php >> /var/log/app-worker.log 2>&1
17 * * * * root /srv/app/bin/backup.sh

# ---- first-day hardening ----
ufw default deny incoming && ufw allow 22,80,443/tcp && ufw enable
apt install unattended-upgrades fail2ban
# sshd_config: PasswordAuthentication no, PermitRootLogin no

8. Backups: bin/backup.sh

#!/usr/bin/env bash
set -euo pipefail

DB=/var/lib/app/app.sqlite
DIR=/var/backups/app
OUT="$DIR/app-$(date +%F-%H%M).sqlite"
mkdir -p "$DIR"

sqlite3 "$DB" ".backup '$OUT'"                        # online backup API: consistent even while the app writes
sqlite3 "$OUT" 'PRAGMA integrity_check;' | grep -qx ok
gzip -9 "$OUT"
rclone copy "$OUT.gz" remote:app-backups/             # a second provider, never the same VPS
find "$DIR" -name '*.gz' -mtime +14 -delete

Why the code looks the way it does:

  • Four PRAGMAs, each with a job. WAL lets readers proceed while a write is in flight. synchronous = NORMAL is safe under WAL and cuts fsyncs. busy_timeout makes a second writer wait up to five seconds instead of failing instantly. foreign_keys is off by default in SQLite, so cascades silently do nothing without it. The SQLite WAL documentation explains the limits.
  • Prepared statements everywhere, with emulation off. User input never reaches SQL text. Ownership checks sit in the WHERE clause (user_id = ?), so a guessed project ID returns 404 instead of someone else’s data.
  • Session hardening. The __Host- cookie prefix forces Secure, path / and no Domain attribute. session_regenerate_id(true) after login defeats fixation. CSRF tokens are compared with hash_equals().
  • No account enumeration, no timing leak. Registration answers identically whether or not the email exists. Login hashes a throwaway value when the user is missing, so response time does not reveal which emails have accounts. Passwords use password_hash(), per the PHP manual, which upgrades the algorithm as PHP does.
  • Login rate limiting in the database. Ten failures per IP per 15 minutes, stored as hashed IPs. At this scale a table is enough, and it survives restarts.
  • Webhook verification before parsing. The code recomputes the HMAC over timestamp.payload, compares in constant time, and rejects anything older than five minutes. See the Stripe webhook documentation for the header format. Parsing JSON from an unverified body is how forged events get in.
  • Idempotency by primary key. INSERT OR IGNORE on the event ID plus a row-count check means a retried event is acknowledged and skipped. A failure rolls the transaction back, so the ID is not recorded and Stripe’s retry gets a second chance.
  • Write-first locking in the worker. BEGIN IMMEDIATE takes the write lock before the SELECT, so two workers cannot claim the same job. The flock guard stops overlapping cron runs, stale locks are released after ten minutes, and five failed attempts park a job as a dead letter.
  • Memory arithmetic in the pool. Six workers at about 30 MB is roughly 180 MB worst case, and ondemand means that is the ceiling, not the idle figure. memory_limit = 64M keeps one runaway request from taking the machine.
  • Deploy hygiene. Only public/ is web-reachable, open_basedir confines PHP to its own directories, and OPcache timestamp validation is off, so a deploy ends with a php-fpm reload.
  • Backups use the online API. .backup produces a consistent copy while the app keeps writing. Copying the file with cp mid-write can produce a corrupt backup, which you discover during an outage. The SQLite backup documentation covers the details.

More build-focused write-ups are in the SaaS Lab archive and the Build Lab archive.

Edge Cases, Bottlenecks & Security Mitigations

SQLite write contention. Writes are serialized. Keep write transactions short, never hold one open across an HTTP call, and do slow work in the worker after the transaction commits. If busy_timeout errors start showing up in your logs, that is the signal to look at the move-on table above, not to raise the timeout.

Memory exhaustion. When RAM runs out, the Linux OOM killer chooses a victim, and it is often the database writer or php-fpm master. Add a 1 GB swap file as a safety net, cap PHP with memory_limit and pm.max_children, and alert when available memory stays under 15%.

Disk full. A full disk breaks SQLite writes, logs and backups at the same moment. Alert at 80% usage, rotate logs (set a journald size cap), and keep local backups to two weeks.

The backup you never restored. Schedule a monthly restore drill: pull the latest offsite copy onto a scratch machine, run PRAGMA integrity_check, and boot the app against it. A backup is only proven by a restore. Also write down the rebuild steps, since recovery time on one VPS is the time it takes you to repeat them.

Single point of failure. One VPS means provider incidents are your outages. Take provider-level snapshots before deploys, keep the provisioning steps in a script, and put an external uptime check on the homepage and on a database-touching health endpoint. Be honest with customers about the availability you offer.

Email deliverability. Do not send mail from the VPS. Many providers block outbound port 25, and shared VPS IP ranges often have poor reputation. Use a transactional email API, as the worker does, and publish SPF, DKIM and DMARC records for your sending domain.

Webhook replay and ordering. Stripe can deliver events more than once and out of order. The idempotency table handles duplicates. For ordering, make handlers set state (plan = pro) rather than increment it, so a late event cannot corrupt the result.

Deploys without downtime. For a small app, build the release in a new directory, swap a symlink, then systemctl reload php8.3-fpm. Make migrations additive (new columns and tables) so old and new code can run against the same schema during the swap.

Secrets and exposure. Keep secrets in an environment file with mode 600, never under the web root, and block dotfile requests at the web server as in the config above. Run unattended-upgrades, disable SSH password login, and keep fail2ban on the SSH port.

Output escaping and uploads. Escape every value you print with htmlspecialchars(), keep the Content-Security-Policy header, and if you accept uploads, store them outside the web root and serve them through a handler that sets a fixed content type.

Production Verdict

At 100,000 requests a month the right stack is the one that stays out of your way: three processes, one database file, one backup job and a clear recovery plan. Spend your complexity budget on the product, and on the three things that hurt small SaaS products in practice, which are an untested backup, an unpatched server, and a payment webhook that double-counts.

Instrument from day one. Track RAM, disk, p99 latency, job backlog and the age of your last verified restore. When one of those numbers starts to bite, you will know exactly which piece to replace, and the lightweight design makes each replacement a small change rather than a rewrite. If you are building something sponsor-worthy on this footprint, the walkthroughs on the RevStack YouTube channel and the full archive at blog.fortilabs.dev are where the next steps are published.

Frequently Asked Questions

Can a $10 VPS handle 100k requests per month?

Yes, with a wide margin. 100,000 requests a month is about 0.04 requests per second on average, and even a 20x busy hour stays under one request per second. A lightweight PHP and SQLite stack can serve hundreds of requests per second on one vCPU, so the limits that matter are RAM, backups and security, not request throughput.

Is SQLite good enough for a production SaaS?

For small and mid-size SaaS products, yes. In WAL mode, reads do not block writes, and with short write transactions a single SQLite file handles dozens of write transactions per second. The limits are one writer at a time and a single machine, so plan to move to MariaDB or Postgres if you need heavy concurrent writes or multiple app servers.

How much RAM do I need to run a small SaaS?

A PHP-FPM, Caddy and SQLite stack typically idles at 120-250 MB and stays under 350 MB at 20 concurrent requests, so 1 GB is comfortable. A full framework with MySQL, Redis and a queue worker usually needs 2 GB or more. Add a swap file as a safety net either way.

How do you back up a SQLite database safely?

Use SQLite’s online backup API (sqlite3 db ".backup file") rather than copying the file, run PRAGMA integrity_check on the result, compress it, and copy it to a different provider. Then test a restore regularly, because an untested backup is only a hope.

Do I need Redis or a queue service at this scale?

No. A jobs table with a cron-started worker covers email sending, retries with backoff and dead letters for tens of thousands of jobs a month. Add a dedicated queue only when job volume or latency requirements outgrow polling once every few seconds.

When should I move off a single VPS?

Move when you need availability guarantees a single machine cannot offer, when sustained write load pushes SQLite’s single writer to its limit, when your team grows past a few developers and wants framework conventions, or when customers require compliance attestations. Until then, a single well-backed-up VPS is usually the cheapest and simplest option.