Hosting Laravel for free in 2022

Heroku as died, long live the free alternatives

Italo Baeza Cabrera
9 min readSep 6, 2022
Photo by Christina @ wocintechchat.com on Unsplash

Heroku these past days was in hot waters for one simple reason: a place to go for hosting small projects for free was moving to paid plans exclusively. Most developers had to look for an alternative home for their small projects.

I was just planning to mount Larawiz, my online Laravel scaffolder, and consider Heroku, but the news came at the same moment. This may put some Laravel projects in jeopardy, but luckily for us, there is always alternatives that are not owned by SalesForce and that can work with some caveats as long you don’t demand too much power.

After this news, I decided to dive into the Interneks for other hosting services with fair free plans. Take “fair” as a place to put your project without the fear of having your credit card slapped by a shady five figure bill.

This is my list, with no order of preference.

Before we begin, you may want to visit Larawiz if you’re planning to create a new Laravel app and you don’t want to waste hours creating models or migrations.

Fly.io

This platform works much like your average VPS, but it uses Docker underneath. That’s good and bad. Fly.io will put your app from your machine or GitHub and build it using a Docker image you can customize. In reality uses AWS Firecracker, which are microVM that boot and die in mere milliseconds. You can build anything (who said S6 overlay with three processes running?). This is excellent.

That’s also the bad part: if you don’t dance the whale song, you’ll be stranded in the sea. Learning Docker is not difficult, but going in without prior knowledge of how it works will bring more headaches than solutions. This will be same for all Docker-based platforms.

Documentation about the flyctl tool, used to interact with Fly.io, is fine. It also supports a wide range of data center locations. It’s also scalability friendly.

The free tier is enough to handle two small apps, or three if you put your credit card. You can always be sure in your dashboard you’re not surpassing the free quota, so if you go ham it’s because you wanted to.

Vercel

Vercel doesn’t support PHP natively, as is a platform that only works with server functions, but Caleb Porzio made an article to run PHP apps on Vercel, hence, Laravel, through a custom Vercel PHP Runner.

The good? Vercel works like Laravel Vapor but at a minor scale, so it’s fine for small projects that doesn’t deal with databases or storage. Vercel uses AWS as backend.

The bad? You will need to complement with services like PlanetScale or Uploadcare, Transloadit, Filestack, among others as your app will be ephemeral. Think like a sleeping small Virtual Machine image that wakes up by the server once a request comes and goes back to the void after a few seconds of inactivity.

The free tier is very tempting, and you will probably never hit the limits if your application doesn’t stall on externals APIs. It’s great for apps with a JS-driven frontend, but once you need databases, storage, caches, and so on, you’re better looking somewhere else.

Render

Render works similarly to Fly.io, as it uses Docker to container-ize your application. The free quota is 720 hours for all running services, so you can run a single app all month without worrying.

The good? Redis come for free with 25MB of RAM, without persistence, so you have access to cache things faster than using the filesystem or the database.

The bad? There are a lot of gotchas and limitations for the free plan, most notoriously:

Render.com may be fine for an occasional prototype or proof of concept. You may use Render.com with another service to complement another, like their free Redis instance.

Railway

Railway works in the same fashion that Fly.io and Render.com, but the catch is their usage: you’re capped to 500 hours of usage maximum total, or USD $5 worth of credits. There are less gotchas than Render.com, but their limits are heavier and will force you to pay at least something before the end of the month.

Adding a credit card removes execution limits, which is great, but since you still have USD$ 5 worth of credits, there is no escape to payments even if your project isn’t visited in the whole month, so you’re bound to pause your app some days or a week to avoid hitting the quota.

Cyclic.sh

Cyclic.sh works like an AWS CloudFormation front to your application. It may be enough to mount ephemeral apps, but it suffers the same problematic than other similar services where you need to pair up a database and storage separately.

The good? It probably the best option to mount ephemeral apps without breaking the bank, as the limits are quite generous on memory and storage.

The bad? Only works with Github, you may need to pair up with other databases from the outside if you’re not happy with DynamoDB (NoSQL), and it doesn’t work with web sockets. Also, no background processes like cron.

Google Cloud

Compared to AWS, The Big G service is, quite frankly, easier to manage than The Church of Bezos service at the same time they offer the similar Free Forever Tiers structure.

While an App Engine running “28 hours a day” may be enough to run a single Laravel application, you will need other products to complement them, like Cloud Storage, a single Compute Engine for an SQL Database, and even just make your app run on the ephemeral Cloud Run.

The good? A lot of flexibility and self-explanatory free tiers, which compared to AWS, is a lot easier to understand.

The bad? It may take time with some tutorials and documentation to deploy Laravel as you want it, mainly because GCP is not widely used for Laravel, but not impossible to deploy to.

Azure

Microsoft offering is on the same vein of Google Cloud and AWS, a mix of 12-months free tier and some always-free products.

From the latter, you have Azure App Service and Azure Functions, which should power your Laravel Web backend and Queue Worker, respectively. You will need to pair this with storage and a database, which are free for 12 months, or go for an external solution.

The good? Some free products here and there that may be interesting depending on your project.

The bad? Less meaningful free offerings for a Laravel app.

Amazon Web Services

The big elephant in the room is AWS. Their main compute offering, AWS EC2, is only free for 750 hours a month the first year. Alternatively, AWS Lambda has enough seconds free to cover a whole month for running multiple ephemeral apps instances and is “always free”. Yes, you can host an ephemeral Laravel app, even using the tutorial provided by AWS.

Their AWS S3 and EFS storage tiers are also 12-months free for 5GB, but if you’re worried about assets then the AWS CloudFront is free for 1 TB. If you want S3-like storage, you may want to complement that with other services.

The good? It’s AWS, so there are plenty of free tiers of whatever and resources to mount Laravel on AWS.

The bad? S3 and RDS may be killer for projects running more than a year, because these are free only for that amount of time.

Koyeb

Koyeb is another service in the same style that Fly.io and Render.com, which uses Docker and promises less time configuring the deployment.

Going straight to the pricing, no credit card is required. The offering is very straightforward: up to 2 apps, 2 services per app, and 512MB of RAM maximum.

The pricing appears to be relatively easy to understand, but considering the free plan offers only USD$ 5 of free credits, you’re bound to pay some cents for a single Micro instance or two Nano instances, unless you want to use only a Nano instance, or pause it manually for a couple of days to ensure you stay inside the quota. You may want to use S6 to put multiple services inside an instance.

The good? The free tier appears to be slightly worse than Fly.io, and slightly better than any other offering from other platforms.

The bad? The pricing is meant to give away some cents, which may be enough for some but deal-breaking for others, specially if you lack a credit card. And there is no automatic scale-to-zero capabilities, so prepare to pause your app if you expect to be out of the free credits at the end of the month. Consider also the very limited data center locations.

What should you use?

At the end of the day, I decided to use Fly.io to host Larawiz for two main reasons: I can host 2 smalls apps using Docker, and I can do it without getting out of the free tier. The first runs PHP with a Queue Worker and an small SQLite database, while the other uses Soketi exclusively.

Personally I would recommend Fly.io as is the most user-friendly and flexible from the bunch. Close second is Koyeb, which offers almost the same and a few cents, and the rest depending on which features for your small project are important to run, or to complement with external services. If your project frontend is Javascript-based and is detached from the backend, you may consider hosting the assets outside the app.

Note that anyone can use a mix of free services and have them interact between each of them plus the latency between datacenters, but that would be stretching the budget real hard for the sake of it. Imagine having the frontend on Render, calling the backend on Vercel, and connecting to the Database in PlanetScale.

Yes, you can go crazy to avoid paying anything for non-commercial projects.

While you’re here, let me interest you in my GitHub Sponsorhip and Larawiz Sponsorship. The support will allow me to keep creating articles, packages, and useful services.

--

--

Italo Baeza Cabrera
Italo Baeza Cabrera

Written by Italo Baeza Cabrera

Graphic Designer graduate. Full Stack Web Developer. Retired Tech & Gaming Editor. https://italobc.com

Responses (3)