Deploy Full-Stack Apps on a VPS with AI – No Extra Costs Beyond Your VPS and Claude
Host all your full-stack apps on one VPS with free HTTPS, unlimited subdomains and free CI/CD, and let AI do the heavy lifting. The only costs: VPS rent and your AI subscription.
Most "deploy your app" tutorials quietly push you onto a stack of paid services: a platform for the frontend, another for the backend, a managed database, a paid tier for SSL or custom domains, and a CI service on top. Each one is cheap on its own. Together they add up fast, and the bill grows every time you start a new side project.
There is a simpler way. One VPS can host all of your full-stack apps, each on its own subdomain with free HTTPS, and an AI coding assistant like Claude can do most of the heavy lifting: writing the code, the Dockerfiles, the deployment config and even running the deploy for you.
In this post I'll walk through the exact setup I use. The only money involved is the VPS rent and an AI subscription you probably already have.
What it actually costs
| Item | Cost |
|---|---|
| VPS (2 vCPU, 8 GB RAM, 100 GB disk) | Monthly rent – mine works out to about ₹1,200/month on a 2-year plan |
| AI assistant (Claude Pro / Max with Claude Code) | Your existing subscription |
| Docker, Traefik, Postgres, Node, Python… | Free and open source |
| HTTPS certificates (Let's Encrypt) | Free |
| Unlimited subdomains | Free – they are just DNS records |
| Git hosting + CI (GitHub free tier) | Free |
A custom domain is optional. Many VPS providers give you a free hostname (something like srv12345.provider.cloud), and some plans include a free domain for the first year. If you do buy one, it is a single yearly fee no matter how many apps you run on it.
The architecture in one picture
*.yourdomain.com ──► VPS public IP
│
┌──────┴──────┐
│ Traefik │ ← HTTPS + routing
└──────┬──────┘
┌─────────────────┬───────────┴───────┬─────────────────┐
blog.yourdomain.com app.yourdomain.com api.yourdomain.com ...
(Ghost) (React frontend) (Node / FastAPI)
│
(Postgres)- Docker runs every app in its own isolated container, so apps never conflict over versions or ports.
- Traefik is a reverse proxy that sits in front of everything. It reads labels on your containers, sends each subdomain to the right app and fetches a free Let's Encrypt certificate automatically.
- A wildcard DNS record sends every subdomain to your server, so launching a new app never requires touching DNS again.
Step 1: Point your domain at the VPS
In your domain's DNS settings, add these records (replace the IP with your VPS's IP):
| Type | Name | Value |
|---|---|---|
| A | @ | 203.0.113.10 |
| A | * | 203.0.113.10 |
The * record is the magic one: anything.yourdomain.com now reaches your server.
Step 2: Run Traefik once
Many providers offer an "Ubuntu + Docker + Traefik" image, which gives you this out of the box. If yours doesn't, this is the whole thing:
# /docker/traefik/docker-compose.yml
services:
traefik:
image: traefik:latest
restart: unless-stopped
network_mode: host
command:
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --entrypoints.web.http.redirections.entrypoint.to=websecure
- --certificatesresolvers.letsencrypt.acme.httpchallenge=true
- --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web
- --certificatesresolvers.letsencrypt.acme.email=you@example.com
- --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json
volumes:
- traefik-letsencrypt:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock:ro
volumes:
traefik-letsencrypt:Start it with docker compose up -d and you never have to think about SSL again.
Step 3: Let AI build the app
This is where an AI assistant changes the game. With Claude Code running in your project folder, you can describe the whole app in plain English. A prompt like this gets you surprisingly far:
Build a full-stack to-do app: React + Vite frontend, Node/Express API under/api, Postgres database. Add a Dockerfile for the frontend and the API, and adocker-compose.ymlthat runs all three. Routetodo.mydomain.comto the frontend andtodo.mydomain.com/apito the API using Traefik labels with theletsencryptcert resolver. Keep the database private and read secrets from a.envfile.
Claude will scaffold the code, write the Dockerfiles, and produce a compose file along these lines:
services:
web:
build: ./frontend
restart: unless-stopped
labels:
- traefik.enable=true
- traefik.http.routers.todo-web.rule=Host(`todo.mydomain.com`)
- traefik.http.routers.todo-web.entrypoints=websecure
- traefik.http.routers.todo-web.tls.certresolver=letsencrypt
- traefik.http.services.todo-web.loadbalancer.server.port=80
api:
build: ./api
restart: unless-stopped
environment:
DATABASE_URL: postgres://app:${DB_PASSWORD}@db:5432/app
depends_on: [db]
labels:
- traefik.enable=true
- traefik.http.routers.todo-api.rule=Host(`todo.mydomain.com`) && PathPrefix(`/api`)
- traefik.http.routers.todo-api.entrypoints=websecure
- traefik.http.routers.todo-api.tls.certresolver=letsencrypt
- traefik.http.services.todo-api.loadbalancer.server.port=3000
db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_USER: app
POSTGRES_DB: app
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- db_data:/var/lib/postgresql/data
volumes:
db_data:Notice what is not here: no published ports. Only Traefik faces the internet; the API and database talk to each other on a private Docker network. Traefik automatically gives the longer /api rule priority, so API calls go to the backend and everything else goes to the frontend.
Before deploying, ask Claude to run it locally with docker compose up and fix anything that breaks. Letting the AI run the app, read the errors and iterate is far faster than copy-pasting stack traces into a chat window.
Step 4: Deploy it
You have a few free options, from simplest to most automated.
Option A: git pull on the server
ssh root@your-vps
git clone https://github.com/you/todo-app.git /docker/todo
cd /docker/todo
cp .env.example .env # fill in real secrets
docker compose up -d --buildUpdates are just git pull && docker compose up -d --build. Claude Code can run these commands over SSH for you – just ask it to "deploy the latest version to my VPS".
Option B: let the AI talk to your hosting provider
Some providers expose an API (and increasingly, an AI connector) for managing their servers. Connected to Claude, you can literally say "point my domain at the VPS", "deploy this compose file as a new project" or "show me the logs for the blog" and it does it. That's how I set up this very blog, DNS records and all, from a chat.
Option C: free CI/CD with GitHub Actions
For hands-off deploys on every push, ask Claude to write a GitHub Actions workflow that SSHes into the server and redeploys:
# .github/workflows/deploy.yml
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.VPS_HOST }}
username: root
key: ${{ secrets.VPS_SSH_KEY }}
script: |
cd /docker/todo
git pull
docker compose up -d --buildGitHub's free tier includes Actions minutes every month, which is plenty for a handful of side projects.
Step 5: The "paid services" you don't need
Everything below is something people often pay for, and all of it can run on the same VPS for free:
- Database: Postgres, MySQL or Redis in a container instead of a managed database.
- Uptime monitoring: Uptime Kuma gives you a status page and alerts.
- Analytics: Umami or Plausible (self-hosted), privacy-friendly and cookie-free.
- Automation: n8n for workflows and webhooks.
- Blog / CMS: Ghost or WordPress – like the blog you're reading now.
Each one is another compose file with Traefik labels and its own subdomain. Ask Claude for "a compose file for Uptime Kuma at status.mydomain.com using my Traefik setup" and you're done in minutes.
The one thing that's genuinely hard to self-host well is outgoing email – mail from a fresh VPS IP often lands in spam. If your app needs to send email, the free tier of a transactional email service is the practical choice.
Step 6: Basic security (don't skip this)
- Use SSH keys and disable password login for SSH.
- Firewall: allow only ports 22, 80 and 443. Note that Docker's published ports can bypass
ufw, which is another reason to never publish your database port – let Traefik be the only door. - Keep secrets out of Git: put them in
.envand add it to.gitignore. Commit a.env.exampleinstead. - Back up your data: a nightly
pg_dumpvia cron, plus your provider's VPS snapshots or backups. - Update regularly:
apt upgradefor the OS anddocker compose pull && docker compose up -dfor your apps. - Review what the AI does: read the compose files and commands before they run on your server. AI is fast, but you're still the one in charge of production.
Prompts that work well
- "Containerise this project with a production Dockerfile and a compose file that works behind my Traefik setup at
app.mydomain.com." - "Run the app locally in Docker, test the main flows and fix whatever breaks."
- "Write a GitHub Actions workflow that deploys to my VPS over SSH on every push to main."
- "Add a nightly Postgres backup that keeps the last 7 days."
- "My site at
app.mydomain.comreturns a 502 – check the container logs and Traefik config and fix it."
Wrapping up
A single VPS plus an AI assistant replaces a surprising amount of paid infrastructure. You get unlimited apps on unlimited subdomains, free HTTPS, your own databases and free CI/CD, and the AI takes care of the tedious parts – the Dockerfiles, the YAML, the debugging – so you can focus on building.
Start with one app, get it deployed end to end, and every project after that becomes a single compose file and a single prompt.