How to host your Back-end without spending a single penny
A guide to deploy a serverless backend for free
How to deploy your Backend without spending a single penny

When it comes to that stage everyone staring at their wallets, known as deployment can be a daunting task if you are just getting started in your journey or if you are not familiar with the services and processes around deployment. Since the process often involves money, you have be cautious and smart with the choices you make.
The problem
The deployment process completely shifts when it comes to a back-end rather a simple (or a sophisticated) front-end and also most of you are familiar with the usual Vercel, Netlify, GitHub Pages deployments which often comes with generous free tiers which is suitable for projects serve low to medium users.
But what are the chances of you deploying a back-end with 0$? Well there is a few.
- Render — An all in one platform, from simple web services to Databases, KV stores even you can deploy your static sites in one place.
- Railway — A platform lets you allow managing from web services, caches, database to your own containers. Not entirely free but credits are provided.
- Fly.io — More of a platform where you can pick your poison; managed databases and virtual private servers. Comes with a bunch of free credits.
An honorable mention
Heroku — A platform by Salesforce that everyone used to love since they used to provide free compute along with their large plugins directory where we can choose from loggers to databases for free all compacted into a single platform. Due to the abuse of the resources offered sadly they don’t offer a free tier.
Although…
When talking about free tiers you have some great options, especially if you are enrolled in an institution since a lot vendors like GCP, AWS, Linode, DigitalOcean and so on provide free credits for few months where you can deploy whatever you desire until your credits end or until those expire on their infrastructure if you are not heavy on resources.
As you can figure out by now, those few platforms I’ve mentioned don’t seem like solid options if you are going free since those platforms comes with limitations tied to those free services they provide. From bandwidth limits to pausing on idle those platforms will start to worry more than the code you wrote.
The solution (A solution to be exact)
Server-less functions; Well, you might think of AWS Lambda when it comes to server-less functions and yes it is a solid choice but since we are looking for scalable but free solution, Cloudflare workers would be optimal since cloudflare provides a generous free tier allowing upto 100,000 requests per day. Also Cloudflare workers behave differently than the other solutions in the market eliminating issues with serverless compute such as cold starts and you’ll get the benefit of the Cloudflare Edge serving your backend from the nearest server to you.
If you are curious about how Cloudflare workers work, check the following.
How to get started?
export default {
async fetch(request, env) {
const stmt = env.DB.prepare("SELECT * FROM comments LIMIT 3");
const { results } = await stmt.all();
return new Response(JSON.stringify(results, null, 2), {
headers: {
"content-type": "application/json",
},
});
},
} satisfies ExportedHandler<Env>;
Above is what a simple Cloudflare worker which invokes a db call looks like. Although it seems fine but right now you definitely questioning does my Express.js app has to go through the above to get it working on prod.
The answer is yes and no; if you want to write a cloudflare worker you have to use the JavaScript Request and Response APIs and since workers means a server-less environment you cannot use frameworks like express.js to write your workers. That’s where a new framework; a better express.js, Hono.js comes in.

Hono.js is built for this exact use case; running in a server-less environment, especially Cloudflare workers (also the support is included for variety of environments from Netlify functions to AWS Lambda). From super clean handlers, first party middlewares, helpers to fast routers and clean, fully typed APIs Hono is known as a batteries included framework with a great documentation.
Setup process
First bootstrap your project using a Hono template by running the following command.
npm create hono@latest
substitute npm with your preferred package manager. More on here https://hono.dev/docs/#quick-start
In this demo I’ll be using bun

Hono project bootstrapping
Here I’ve chosen clouflare-workers as the template which will bootstrap a cloudflare worker for you so you don’t have to use something like C3.
The following files and directories will be created in the destination directory you chose in the previous step. So it would be something like this for me.
hono-demo ├── bun.lock ├── package.json ├── README.md ├── src │ └── index.ts ├── tsconfig.json └── wrangler.jsonc
Here, src/index.ts act as the entrypoint to your API where you’ll define the global handlers, middlewares and such. Here’s a simple example.
import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => {
return c.json({
success: true,
message: 'Hello Hono!'
})
})
export default app
As you can see the API pattern is pretty much similar to Express.js and you’ll be familiar with it in no time. You can start exploring the ins and outs of Hono here.
https://hono.dev/docs/getting-started/basic
If we check the installed dependencies, we can see hono and a something called wrangler is installed.
bun list
/home/personal/temp/hono-demo node_modules (90)
├── hono@4.12.15
└── wrangler@4.86.0
Basically wrangler is the official CLI for Cloudflare Workers which you’ll be using to test your worker, setting environment variables, Cloudflare Bindings (external sources like DBs, KVs) and also for deploying your worker to Cloudflare itself.
To run your worker locally, use the dev script in the package.json
"scripts": {
"dev": "wrangler dev",
"deploy": "wrangler deploy --minify",
"cf-typegen": "wrangler types --env-interface CloudflareBindings"
}
Deployment process
Once you have a working worker you have tested on your local environment like I have here which I created for my IoT module.
Feel free to go through the above repository since it involves route grouping, websocket endpoints and Cloudflare Durable Objects, ORMs and so on.
You can start deploying the worker to Cloudflare. Since I have created a GitHub repository I can directly link it to Cloudflare which will provides automatic deployments.
If you don’t want automatic deployments or you don’t want to keep track of a remote repository simply do a wrangler deploy to deploy your worker.
Otherwise navigate to your Cloudflare dashboard and head over to workers & pages under compute. Here you can see my existing workers and pages.

Cloudflare wokers & pages dashboard
Simply just click on Create application -> continue with GitHub or GitLab then authorize Cloudflare to access your repository and hit deploy

worker configuration
Additionally you can set your environment variables and all in the dashboard as well as through the command line with wrangler which I would recommend.
First you can do a npx wrangler login (substitute npx with your equivalent execution binary such as npx, yarn dlx) to authenticate with Cloudflare and then you can use the following commands to set your environment variables
wrangler secret put <key>
If you have more than few variables you can use this command instead, you can pass your .env file to it and it will parse the keys and values and set them in your worker accordingly.
wrangler secret bulk [file]
Once your worker is successfully deployed you’ll receive your worker URL.

Congratulations! 🥳 Now you have a serverless API which can serve thousands of users and most importantly you haven’t spent a single penny in the process.
메타데이터
- post_id
- 5d387d35e24b
- slug
- how-to-host-your-back-end-without-spending-a-single-penny-5d387d35e24b
- url
- https://blog.fossnsbm.org/how-to-host-your-back-end-without-spending-a-single-penny-5d387d35e24b
- canonical_url
- https://blog.fossnsbm.org/how-to-host-your-back-end-without-spending-a-single-penny-5d387d35e24b
- author_url
- https://medium.com/@libresoul
- status
- ok
- fetched_at
- 2026-07-10 22:52:34