As a hobby developer, especially a web developer, there is often a need to be able to run a server on the internet for low-cost (i.e. "free"). Let's compare some options we have in the year 2023.
Option 1: Cloud Platforms
The first approach is to leverage the various cloud platforms out there. The big names here are:
AWS - Amazon Web Service
Azure - Microsoft Cloud Service
GCP - Google Cloud Platform
Simply put, this is a do-it-yourself approach - where you would use these cloud services to configure and launch the appropriate resources to get your server up and running on the internet.
"Free"
All 3 cloud platforms mentioned above, give you options for a free tier. This usually means you get some credits to use their services for no cost, but once those credits expire (typically 1 year), you will have to start paying for the services you use.
After the free tier, the cost of running a server on a cloud platform will largely vary depending on the services you use and how you optimize the cost, which would require knowledge as to how the pricing works for each service.
Why would you try
As a hobby developer, here are some reasons you would try this approach:
Ability- to utilize various cloud services in my project
Ability - to fully control what cloud service is used to launch my server
Learn - terminologies and skills to run a cloud service
Learn - how to architect a cloud service
Cloud services are a popular choice among companies, and having knowledge and know-how about the cloud may be a good asset for you.
Why would you avoid
As a hobby developer here are some reasons you would not choose this approach:
Cost - only free for a limited period
Overhead - lots of things to learn about cloud architecture
Overhead - forced to set up payment to use these services
Risk - creating an infrastructure that is not secure
Risk - mistake = unexpected cost and bill
Some of these concerns can be addressed, but it's still nonetheless a concern one can have when thinking about using a cloud platform. If you would rather concentrate on app development than cloud architecture, then you may want to find other options.
Some tools could simplify your life on the cloud, like:
The serverless framework - to quickly get your server running on AWS Lambda
Tools like Terraform - help you automate and construct Cloud resources via code/configuration
Option 2: Running a server at home
Another approach would be to run a server physically at home and then expose it to the internet.
This usually involves having to:
run a computer as a server 24/7 (varies depending on your uptime requirements for your service)
connect a service that can expose your home server to the internet - something like Cloudflare Tunnel
This is another form of the do-it-yourself approach, with various engineering knowledge involved to get a server connected to the internet.
"Free"
Since there aren't too many middlemen involved in this setup, it is mostly free of charge. However, you are not free of cost, as you will have to spend some money on:
A web domain - an address to point to your server
A dedicated server computer
Cost of electricity - having to run your server all day long
Why would you try
As a hobby developer, here are some reasons you would try this approach:
Simplicity - take whatever you are running on your computer and serve it through the Internet
Ability - to fully control everything (OS, Software, Hardware, etc)
Reusability - get to reuse that laptop or computer sitting in the corner of my house
Learn - about networks and how to physically maintain servers
With a little bit of setup, you get to run your computer and use it as a public server. If you need to run your experimental projects on the Internet without worrying about production-level reliability, this may be a good approach to start.
Why would you avoid
As a hobby developer here are some reasons you would not choose this approach:
Overhead - having to set up your network for public access
Risk - exposing your house network to the internet may come with security risks you are unaware of
Burden - server running all day long, taking up space, creating noise, etc
Scalability - in the event of a need to scale up, this would not be feasible
Running a physical server yourself comes with all the manual maintenance that you would need to do to keep a computer secure and healthy. As the scope of your project scales up or the number of things you need to maintain goes up, this would not be a feasible solution in the long run.
Option 3: PaaS solutions
The next approach would be to use software solutions built on top of the cloud platforms which allows you to deploy applications without the need for manual setup of cloud resources.
Looking at free options in 2023 here are some options:
Vercel - Frontend-focused solution
PlanetScale - DB-focused solution
Render - unified cloud solution
Firebase - integrate with Google Cloud services
There are so many more alike, and these platforms vary widely in what they focus on and how they're designed and what features they provide. Depending on what your development environment is you may want to try out different platforms.
"Free"
For the most part, all these solutions give you a no-charge / no-risk kind of deal, but as expected, they come with strings attached.
First off, you cannot expect unlimited usage - bandwidth, storage, etc will come with limits (most of which are reasonably generous for hobby developers).
Second, you are really at the mercy of the company/organization's policy changes. For example, Heroku is a cloud platform service (now part of Salesforce) that used to provide a free-tier option for hobby developers, but no longer supports these. The official reason for this removal is "to manage fraud and abuse", which I can assume is something any service that hands out free server resources has to deal with (free compute resources used for malicious purposes). So it is fair to assume "free forever" is not going to be a realistic expectation.
Why would you try
As a hobby developer, you can use these solutions for these main reasons:
Focus - since these solutions take care of the plumbing work for you, you can focus on making your application
Low commitment - most services do not require a payment to be set up, so you are free to try it out without much commitment
Free of Charge - for real
Limitations aside, a lot of platforms provide very reasonable resources to use for free. As long as they continue to do so, using their solutions to run your application is a very good option for your hobby project.
Why would you avoid
As a hobby developer, you may want to think about:
Lack of control - you are not going to be able to control everything
Limitations - as long as you are on the free tier, there will be limitations to your application
Overhead - there will always be a bit of learning to do regarding using the platform effectively
For the most part, these negatives may not be too applicable at the hobby level, but still, something to consider.
Option 3.5: Don't run it yourself
An alternative to using a service to run your server is to - not run a server at all. Just piggyback on someone else's!
This would include things like:
Blog platforms - wordpress, medium, hashnode, etc
Static site hosting - github.io, etc
Of course, you will bump into limitations as to what you can build on these platforms alone, but you can also combine this with the solutions mentioned above to extend your capability!
Conclusion
Overall we should be very happy that we have all these great resources to use for free. Knowing how to take advantage of all these options is probably the best idea for your future hobby project.