the-cheapest-way-to-host-a-net-saas-app-hosting-the-libresharp-saas-starter-behind-cloudflare.md

The Cheapest Way to Host a .NET SaaS App: Hosting the LibreSharp SaaS Starter Behind Cloudflare

When I announced the LibreSharp SaaS Starter, I left one question open: which cheap host should the deployment guide target first? A VPS with Docker Compose, or a platform like Fly.io, Railway or one of the big clouds? I’ve now looked into it properly. I priced the frontend, backend, database and file storage across the realistic options, and assumed Cloudflare sits in front as the firewall whichever host you choose.

The short answer is that a small VPS behind Cloudflare, with files in Cloudflare R2, costs about $5–7 a month and is hard to beat. If you’d rather not manage a server at all, Railway is the cheapest managed option. AWS, Google Cloud and Azure can all run it, but their managed container services cost several times more once you add a database, and their cheap options turn out to be VPSs anyway. The serverless platforms with generous free tiers look attractive, but they don’t suit this app, because it never really goes idle.

All prices were checked in late November 2026 and exclude tax. Several providers changed their prices this year, some more than once, so check the live pricing pages before you commit.

What We’re Actually Hosting

The hosting options only make sense once you know the app’s shape. A project generated from the starter has:

  • One ASP.NET Core container. It serves the API, the SignalR hub and the built React client. The frontend is a single-page app with public pages pre-rendered to static HTML at build time, so there’s no Node server to run in production.
  • PostgreSQL. This holds the application data, and also Wolverine’s durable queues, the transactional outbox, scheduled messages and the Data Protection keys. There’s no Redis or message broker.
  • File storage. This sits behind an IFileStorage abstraction with three providers: local disk (the default), anything S3-compatible, or Azure Blob Storage. Uploads and downloads go directly between the browser and storage using short-lived signed URLs.
  • An SMTP provider for email. That’s outside the scope of this post, but most transactional email services have a free tier that covers an early-stage product.

The repo’s deploy/ folder already ships a production docker-compose.yml with the app, PostgreSQL and Caddy for automatic HTTPS. It suggests 1 vCPU and 1–2 GB of RAM.

Why scale-to-zero doesn’t fit

This one detail shapes the rest of the post. Wolverine is always doing something in the background. It polls PostgreSQL for queued messages, runs scheduled work such as trial-ending reminders, and retries failed Stripe webhooks. That needs a process running all the time, and a database that stays awake.

That rules out the “free until you get traffic” model that a lot of platforms are built around:

  • Scale-to-zero compute, such as Cloud Run, Azure Container Apps, Render’s free tier or Fly machines that auto-stop. If the container sleeps, scheduled messages don’t fire and queued work waits until the next visitor wakes it up. Keeping one instance always on is possible, but then you’re paying for a server at serverless rates.
  • Scale-to-zero databases, such as Neon. The polling means the database never goes idle, so you get billed as if it’s always on.

So I stopped looking for the most generous free tier and started looking for the cheapest place to run one small container and one small Postgres around the clock.

The Backend and Database

Since the app and the database both need to run all the time, it makes sense to price them together.

Option 1: A VPS with the included Docker Compose

This is what the template is built for. You rent a small Linux server, copy the deploy/ folder across and run docker compose up -d. The app, PostgreSQL and Caddy all run on the one box.

Provider Plan Specs Price per month
Hetzner CX23 2 vCPU, 4 GB, x86 €5.49, or about €5.99 with an IPv4 address
Hetzner CAX11 2 vCPU, 4 GB, Arm €5.99, plus IPv4
OVHcloud VPS-1 4 GB about $4.50 on a 12-month term, about $5.35 monthly
Hostinger KVM 1 1 vCPU, 4 GB $6.49 prepaid for 24 months, renews at $11.99
Netcup VPS 2–4 GB from a few euros a month on a 12-month term
Vultr Regular 1 vCPU, 2 GB about $10
DigitalOcean Basic 1 vCPU, 2 GB about $12
AWS Lightsail 4 GB bundle 2 vCPU, 4 GB $24, or $12 for 2 GB

Hetzner is usually the first name people mention, but it’s had a bad 2026. Prices went up in April and again in June. Its cheap shared plans have also been hard to get since late June, when it posted a “limited availability” notice. Trackers show CX23 stock appearing for a few hours at a time and selling out quickly. If you can get one, it’s still excellent value. If you can’t, OVHcloud’s VPS-1 gives you more RAM for less money, and Netcup is just as cheap if you’re happy to commit to a year.

Hostinger markets an “ASP.NET VPS”, but it’s just its normal KVM VPS with an Ubuntu template that has .NET preinstalled. You get SSH access, so you can install Docker and run the Compose file like on any other box. The $6.49 price only applies if you pay for 24 months up front, and it renews at $11.99. That makes it fine if you want a big brand with support staff, but it isn’t the cheapest option over the long run.

The Arm plans work fine. The .NET runtime images are multi-architecture, so publish with linux-arm64 as the runtime identifier and the same Compose file runs unchanged.

On a 4 GB box, PostgreSQL and the app have plenty of headroom. You’re responsible for OS updates and backups, but the deploy guide already covers pg_dump, and I’ll come back to where those backups should go.

Total: about $5–7 a month, including the database.

Option 2: Railway

Railway is the simplest managed option I found. You deploy the container image and add a PostgreSQL service from the dashboard, and Railway handles the rest. The Hobby plan is $5 a month, and that $5 counts as usage credit. Beyond that, memory costs about $10 per GB per month, CPU about $20 per vCPU per month, volumes $0.15 per GB and egress $0.05 per GB, all billed by the second.

An idle .NET app uses a few hundred megabytes of RAM, and a small Postgres a bit less. Unlike a VPS, Railway bills you for what you actually use, so a quiet app stays cheap.

Total: roughly $5–10 a month for a low-traffic app. It goes up smoothly as you grow, but it climbs faster than a VPS once you’re using a couple of gigabytes of RAM all the time.

Option 3: Render

Render’s Starter web service is $7 a month for 512 MB and half a CPU. That’s tight, but workable for one .NET container. The smallest paid Postgres, Basic-256mb, is about $6 a month plus storage. Realistically you’ll want the 1 GB database at about $19.

Avoid Render’s free web service tier for this app. It spins down when idle, which breaks Wolverine’s scheduled work for the reasons above. The free Postgres also expires after 30 days.

Total: about $13 a month at minimum, and closer to $26 with the 1 GB database.

Option 4: Azure App Service

If you’re a .NET shop, App Service is probably the first managed option you’d think of. You create a Linux App Service plan, point a Web App at the container image, and Azure handles TLS, restarts and OS patching. The Free F1 tier is no good here: it caps CPU at 60 minutes a day and doesn’t support Always On, so the app gets unloaded when idle, the same problem as scale-to-zero. The Basic B1 plan is the realistic starting point at about $13 a month in East US for 1 vCPU and 1.75 GB of RAM. That’s enough for one .NET container, and B1 supports Always On, which you need to turn on so Wolverine keeps running.

The database is the bigger cost. Azure Database for PostgreSQL Flexible Server on the Burstable B1ms tier (1 vCore, 2 GB) is about $12 a month, plus storage at roughly $0.12 per GB. The 32 GB minimum adds about $4. A new Azure free account includes 750 hours a month of B1ms and 32 GB of storage for the first 12 months, which covers the database entirely for the first year.

One thing App Service does better than the others here is access restrictions. You can add Cloudflare’s IP ranges as allow rules, which closes the *.azurewebsites.net back door that Railway, Render and Fly leave open. The starter also already has an Azure Blob Storage provider, so you could keep everything in one Azure bill, but R2 is still cheaper for files.

Total: about $29 a month, or about $13 a month for the first year on a new account’s free database allowance.

Option 5: Fly.io

Fly is excellent at running containers close to users, and a shared-cpu-1x machine with 1 GB is about $6.70 a month in the US after its October RAM price rise. The database is what makes it expensive. Fly’s Managed Postgres Basic plan is $38 a month plus storage, which makes Fly’s own small-app example come to about $44. A cheaper developer database tier has been reported recently, but it pauses after 15 minutes of inactivity, which runs into the same scale-to-zero problem.

You can run your own Postgres on a Fly machine with a volume to save money, but at that point you’re doing all the database work you’d do on a VPS, for more money.

Total: about $45 a month with managed Postgres.

Option 6: Cloud Run or Azure Container Apps with a hosted database

The free grants look generous. Azure Container Apps gives you 180,000 vCPU-seconds, 360,000 GiB-seconds and 2 million requests a month, and Cloud Run’s free tier is similar. But a single always-on container with half a vCPU uses about 1.3 million vCPU-seconds a month. The free grant covers about four days of that, and you pay for the rest. On top of that you need a database, and the hosted Postgres options don’t suit this workload either:

  • Neon free gives each project 100 compute-hours a month. Wolverine’s polling keeps the smallest 0.25 CU compute awake for all 730 hours, which works out to about 182 CU-hours. That exhausts the free plan, and on the paid Launch plan it costs about $19 a month for compute alone.
  • Supabase free gives you 500 MB of database with no backups, and pauses projects with little activity. The polling would keep it awake, but the size limit and lack of backups make it a demo option, not a production one. Pro is $25 a month.

These platforms make sense if your company already runs on Google Cloud, or on Azure and needs Container Apps specifically, and wants everything in one place. If you’re on Azure and just want one always-on container, App Service is simpler and usually cheaper. On price alone, they lose.

Total: typically $20–50 a month, depending on how much CPU you reserve and which database you pick.

Option 7: AWS

AWS has three realistic ways to run this app, and they differ a lot in price.

Lightsail instances are AWS’s VPS product, and the simplest choice. Bundles include an IPv4 address and a generous transfer allowance: $12 a month gets 2 vCPUs and 2 GB, and $24 gets 4 GB. You run the same Docker Compose file as on any other VPS. It costs about four times as much as Hetzner or OVHcloud for the same RAM, but it’s the cheapest way to keep everything inside an AWS account.

Lightsail containers look like the managed option, but they’re small for the price. The Micro power level is $10 a month for a quarter of a shared vCPU and 1 GB, and Small is $15 for half a vCPU. A Lightsail managed PostgreSQL database starts at $15 a month for 1 GB of RAM and 40 GB of storage. That’s about $25–30 a month for a setup that’s tighter than a $6 VPS.

ECS on Fargate is what most AWS teams would reach for. App Runner would have been the easy version, but AWS closed it to new customers on 30 April 2026 and now points people to ECS Express Mode. Express Mode is a simpler way to set up Fargate and has no charge of its own. The costs add up, though:

  • A Fargate task with half a vCPU and 1 GB running all month is about $14 on Arm (Graviton) or about $18 on x86.
  • Express Mode puts an Application Load Balancer in front, which is about $16 a month before traffic charges. It can share one load balancer across up to 25 services, which helps later but not with your first app.
  • AWS charges about $3.65 a month for each public IPv4 address, and the load balancer uses at least two.
  • RDS for PostgreSQL on a db.t4g.micro is about $12 a month plus storage.

That’s around $50 a month. New AWS accounts get $100–200 in credits for their first year, which covers most of that while you’re starting out.

Total: $12–24 a month on a Lightsail instance, $25–30 on Lightsail containers, or about $50 on Fargate with RDS.

Option 8: Google Cloud

Google’s Always Free tier includes one e2-micro VM a month in us-west1, us-central1 or us-east1, with 30 GB of disk. It has 1 GB of RAM and a quarter of a vCPU sustained, which is enough for the .NET app on its own but too tight for the app and PostgreSQL together. Pair it with Cloud SQL for PostgreSQL on the shared-core db-f1-micro tier, at about $8 a month plus storage, and you have a working setup for about $10 a month.

It has limits, though. The free VM only includes 1 GB of internet egress a month, so you rely on Cloudflare’s cache to keep traffic down. The db-f1-micro has 0.6 GB of RAM, and Google excludes shared-core instances from the Cloud SQL SLA. It’s a reasonable place to start if you want to stay in Google Cloud, but you’ll need to move to bigger instances, and bigger bills, fairly soon.

Total: about $10 a month, mostly the database.

Option 9: Oracle Cloud’s Always Free tier

Oracle’s Always Free tier used to be the best free deal in cloud hosting: 4 Arm cores and 24 GB of RAM at no cost. In 2026 Oracle halved it to 2 OCPUs and 12 GB, and began terminating instances above the new limit on 18 August. That’s still plenty for the Compose file, the app and PostgreSQL, running behind a Cloudflare Tunnel.

It’s hard to recommend for production, though. Free Arm capacity is often unavailable in popular regions, so you may get “out of capacity” errors for days. Oracle also reclaims Always Free instances it considers idle, and it has just shown it will change the terms with little notice. It’s great for a staging environment or a side project, but I wouldn’t put paying customers on it.

Total: $0, if you can get capacity and accept the risk.

Option 10: Other managed platforms

A few more platforms in the same space as Railway and Render:

  • DigitalOcean App Platform starts at $5 a month for a container with 512 MB, which is tight for .NET. The $7 “development database” is too limited for production, so you’d want a managed PostgreSQL cluster at $15 a month. That comes to $20 or more.
  • Northflank has an always-on 0.5 vCPU, 1 GB plan for $12 a month and adds PostgreSQL as an add-on, for about $25 in total. Its free Sandbox plan includes two services and a database that stay on all the time, which makes it a good free staging environment.
  • Koyeb only offers serverless Postgres, starting at about $30 a month for always-on use, so it isn’t a cheap fit for this app.

What about cheap ASP.NET shared hosting?

Hosts like SmarterASP.NET and MyASP.NET are cheap. Plans start at about $2.36–2.95 a month (billed quarterly or annually), they support current ASP.NET Core, and they even include PostgreSQL, with 1 GB on the entry plans. For a brochure site or a simple CRUD app, they’re good value.

They’re a poor fit for this template, though:

  • It’s shared Windows hosting on IIS, not a server. There’s no Docker, so the included Compose file doesn’t work. You publish the app into IIS with Web Deploy or FTP instead.
  • IIS app pools sleep and recycle. By default IIS shuts down an app pool after 20 minutes without requests and recycles it periodically. Neither host says whether you can turn that off, and on shared hosting you usually can’t. When the pool stops, Wolverine stops with it, which is the scale-to-zero problem again.
  • Memory is tight. The entry plans give the app pool 256 MB, and SmarterASP.NET’s middle plan 512 MB. Getting 3 GB means the $7.95 Premium or Pro plan, which costs about the same as a 4 GB VPS.

Both also sell VPS plans, but at that point you’re back to Option 1 and can compare them on price like any other VPS.

The Frontend

There isn’t really a separate frontend bill. The React client is built into the container and served by ASP.NET Core, so it’s on the same domain as the API. That keeps authentication simple: the refresh-token cookie, CORS and SignalR all just work.

Cloudflare makes this cheap to serve. Vite gives the JavaScript and CSS files content-hashed names, so Cloudflare can cache them at the edge for a long time. Most frontend traffic never reaches your server.

You could move the frontend to Cloudflare Workers static assets, where static requests are free and unlimited. But then the API is on a different origin, and you’re dealing with cross-site cookies and CORS. Alternatively, a Worker proxies /api back to your server, and every proxied request counts against the free plan’s 100,000 dynamic requests a day. Neither saves real money for an app this size, so I’d keep the frontend in the container.

Total: $0 on top of the backend.

The File Server

On a single VPS, the default local-disk provider works and costs nothing. Files go into a Docker volume next to the database. The drawbacks are that you have to back that volume up yourself, it fills the server’s disk, and it ties the app to one machine.

Moving to object storage is a configuration change, since the starter already speaks S3. These are the cheapest options:

Provider Free allowance After that Egress
Cloudflare R2 10 GB storage, 1M writes, 10M reads a month $0.015 per GB a month Free
Backblaze B2 10 GB storage $6.95 per TB a month Free up to 3× your stored data
Hetzner Object Storage None about €6.49 a month for 1 TB storage and 1 TB egress €1 per TB after the included TB

I’d use Cloudflare R2 for this setup. A young SaaS product will sit inside the free tier for a long time, there are no egress fees ever, and it’s in the same Cloudflare account you’re already using. Configure it like this:

STORAGE_PROVIDER=S3
S3_SERVICE_URL=https://<account-id>.r2.cloudflarestorage.com
S3_REGION=auto
S3_BUCKET=myapp-files
S3_ACCESS_KEY=...
S3_SECRET_KEY=...

Because the browser uploads directly to R2 with a signed URL, you’ll need a CORS policy on the bucket that allows PUT and GET from your domain. Those uploads also go to R2’s endpoint, not through your proxied domain, so Cloudflare’s 100 MB request body limit on the free plan doesn’t apply to them.

Use a second R2 bucket for your nightly pg_dump backups. Backups that live on the same server as the database aren’t really backups. Once files are in R2, the database is the only thing on the server you need to back up.

Total: $0 for a small app.

Cloudflare as the Firewall

Whichever host you choose, Cloudflare’s free plan goes in front of it. Point your domain’s nameservers at Cloudflare and you get DNS, DDoS protection, edge caching, the Free Managed WAF ruleset, Bot Fight Mode and a rate limiting rule. Cloudflare keeps the managed ruleset updated for widely exploited vulnerabilities, and has pushed emergency rules to free plans several times this year. WebSockets work on every plan, so SignalR is fine.

A few things need care to set up properly.

Choose how traffic reaches your server

There are two good options.

Cloudflare Tunnel (my recommendation for a VPS). Add a cloudflared container to the Compose file and create a named tunnel in the Cloudflare dashboard that points at the app. The server makes an outbound connection to Cloudflare, so you close ports 80 and 443 entirely. Nobody can reach the server without going through Cloudflare, you don’t need certificates on the origin, and Caddy becomes optional. Named tunnels are free on every plan. Don’t use the trycloudflare.com quick tunnels for this. Cloudflare says those are only for testing.

A proxied DNS record with Caddy. Keep the included Caddy setup, set the DNS record to proxied (the orange cloud) and set SSL/TLS mode to Full (strict). The simplest certificate setup is a free Cloudflare Origin CA certificate loaded into Caddy, which lasts up to 15 years and doesn’t depend on Let’s Encrypt challenges passing through the proxy. Then use your host’s firewall to allow 80 and 443 only from Cloudflare’s published IP ranges. Otherwise anyone who finds your server’s IP can go straight round the WAF.

On Railway, Render or Fly you don’t control the server’s firewall. (Azure App Service is the exception, since its access restrictions can allow only Cloudflare’s ranges, as covered above.) Add your custom domain on the platform, proxy it through Cloudflare with Full (strict), and accept that the platform’s own *.up.railway.app-style hostname remains a way around Cloudflare. If that matters, check whether your platform lets you turn off its default hostname.

Make sure the app sees real client IPs

Behind Cloudflare, every request appears to come from a Cloudflare IP unless the app is told otherwise. That breaks the starter’s API rate limiting, because all your users end up sharing one bucket, and it puts the wrong addresses in the audit log. Configure ASP.NET Core’s forwarded headers to trust only Cloudflare’s ranges, or Caddy or cloudflared if they sit in between. Read the client address from CF-Connecting-IP or X-Forwarded-For. Test it by signing in and checking the IP the audit log records.

Rules worth adding

  • Don’t cache /api/*. Cloudflare doesn’t cache JSON by default, but make it explicit with a cache rule. Then add a rule that caches /assets/* for a long time.
  • Rate-limit the auth endpoints. Use the free rate limiting rule on sign-in, registration and password reset. That stops credential stuffing at the edge, before it reaches the app’s own limits.
  • Let Stripe through. Add a WAF skip rule for your Stripe webhook path, so Bot Fight Mode or a managed rule never challenges Stripe’s servers. The starter verifies the webhook signature anyway, so this doesn’t weaken anything.
  • Turn on “Always Use HTTPS” and HSTS once everything works end to end.

Putting It Together

Every setup below uses Cloudflare’s free plan in front and R2 for files, so neither adds to the bill. The totals cover the app and the database, at the smallest size I’d actually run.

Setup App runs on Database Who manages the server Monthly total
Oracle Cloud Always Free 2 Arm cores, 12 GB PostgreSQL on the same VM You $0, if you can get capacity
Hetzner, OVHcloud or Netcup VPS + Tunnel 4 GB VPS PostgreSQL on the same VPS You about $5–7
Railway Usage-billed container Railway PostgreSQL Railway about $5–10
Hostinger KVM 1 VPS 1 vCPU, 4 GB VPS PostgreSQL on the same VPS You $6.49 for 24 months prepaid, then $11.99
Google Cloud e2-micro + Cloud SQL Free e2-micro, 1 GB Cloud SQL db-f1-micro Mixed about $10
AWS Lightsail instance 2–4 GB VPS PostgreSQL on the same VPS You $12–24
Render Starter, 512 MB Render PostgreSQL Render about $13–26
DigitalOcean App Platform 512 MB container Managed PostgreSQL DigitalOcean $20+
Northflank 0.5 vCPU, 1 GB PostgreSQL add-on Northflank about $25
AWS Lightsail containers Micro or Small Lightsail PostgreSQL AWS about $25–30
Azure App Service Basic B1, 1.75 GB Flexible Server B1ms Azure about $29, or about $13 in year one
Cloud Run or Azure Container Apps Always-on container Neon or Supabase The platform about $20–50
Fly.io shared-cpu-1x, 1 GB Fly Managed Postgres Fly about $45
AWS ECS Fargate (Express Mode) 0.5 vCPU, 1 GB task + load balancer RDS db.t4g.micro AWS about $50
SmarterASP.NET or MyASP.NET Shared IIS Shared PostgreSQL The host $3–8, but not suitable for this app

My recommendation:

  1. Cheapest: a 4 GB VPS from Hetzner if you can get one, or OVHcloud or Netcup if you can’t. Run the included Docker Compose with a cloudflared tunnel in front and the ports closed, keep files and nightly backups in R2, and the whole thing costs less than $7 a month.
  2. Easiest: Railway, with R2 for files and Cloudflare in front. You’ll pay a few dollars more as you grow, but you never have to SSH into anything. If you’re already on Azure, App Service B1 with a Burstable Postgres costs more but is just as hands-off, and it can lock the origin down to Cloudflare.
  3. If you must use AWS or Google Cloud: on AWS, a Lightsail instance running the Compose file is far cheaper than Fargate with RDS. On Google Cloud, a free e2-micro with a small Cloud SQL database gets you started for about $10.
  4. Avoid scale-to-zero platforms and databases for this template. Wolverine’s background work needs something that stays awake, and those platforms bill accordingly.

That also answers the question I left open last week. The deployment guide will target the VPS first, since that’s what the template’s Compose file is already built for. Next on my list is adding the Cloudflare Tunnel and R2 setup to it. If you’ve deployed the starter somewhere else, or found a cheaper option I’ve missed, let me know in the GitHub issues.

Loading comments from Disqus…