How to deploy your full-stack application for free?

How to deploy your full-stack application for free?

Jan 7, 2023

Deploying a full-stack application can be a daunting task, especially for those who are new to web development. It often requires setting up servers, configuring databases, and managing DNS records, among other things.

You might have heard of services like AWS, Azure, GCP, DigitalOcean, and Linode but all of them ask for credit card details to activate the free tier. And when the free tier use exceeds, these services charge you from your card without notifying you.

In this article, we will discuss some of the options available for deploying a full-stack application at no cost. Whether you are a beginner looking to get your first application online or an experienced developer seeking a cost-effective solution, this article will provide you with the information you need to successfully deploy your full-stack application for free.

We will divide this process of deploying a full-stack application into three sections: frontend, backend, and database. For each section, we will discuss several options for hosting your application's respective components for free. This will allow you to mix and match the services that best suit your needs and constraints. By the end of this article, you will have a good understanding of the options available for hosting each component of your full-stack application at no cost.

Frontend

If you have coded your frontend using a framework or library like React, Angular, Vue, Svelte, Next, or even vanilla JavaScript, you have a variety of options available for free hosting. For the sake of making this article short and sweet, I will explain my recommended two options here briefly but will list down all of them along with their getting started link. So, here it begins:

  1. Cloudflare Pages

    Cloudflare Pages is a static site hosting service provided by Cloudflare, a well-known content delivery network (CDN) company. It allows you to host your frontend or static websites for free, with the added benefit of leveraging Cloudflare's global CDN, making your site secure with HTTPS proxy.

    Setting up Cloudflare Pages is easy and requires no configuration, simply connect your git repository that includes your frontend code and specify your build command. One of the main advantages of using Cloudflare Pages is that it integrates seamlessly with Cloudflare's other services, such as its DNS, and caching. This makes your site extremely fast to load on your customer browser. I have hosted my website and you can check how quickly it loads. You can get started with Cloudflare pages by visiting here: https://developers.cloudflare.com/pages/getting-started/.

  2. Vercel

    Vercel is another popular and free frontend, web application hosting service. Same as Cloudflare they also support a variety of frameworks and have extremely easy-to-understand documentation for hosting. When you connect your git repository, Vercel will automatically handle the building/deployment process and will provide you with the testing URL. You can also configure your own domain to your application using Vercel. Get started with Vercel for frontend deployment here: https://vercel.com/docs

  3. GitHub Pages: https://pages.github.com/

  4. GitLab Pages: https://docs.gitlab.com/ee/user/project/pages/

  5. Netlify: https://docs.netlify.com/get-started/

  6. Render: https://render.com/docs

  7. Surge: https://surge.sh/

Backend

For hosting your backend, you have several options. You can run a full framework-based REST API, host a Docker image, or create serverless functions to handle requests and interact with databases. No matter which approach you choose, there are free services available to help you get your backend online. Some tools that you can use for backend hosting include:

  1. Railway

    Railway is one of the super-easy and free (for basic usage) hosting services available out there on the internet right now. It supports the hosting of backend services or APIs built in multiple languages. You can create a git repository, include the Dockerfile inside it and connect your git repo to Railway. It will read the Dockerfile and expose an API. Railway also provides support to host serverless databases. Check out their website and start building here: https://railway.app/

  2. Render

    Render offers a generous free tier that allows you to host applications built with NodeJS, Python, Go, or any other language that can be packaged in a Dockerfile. This free tier is a great option for hosting side projects and trying out Render's services. If you are looking for a way to host your application for free, Render may be a good choice to consider. Get started with Render here: https://render.com/docs

  3. Cloudflare Workers

    Cloudflare Workers is a Function as a Service (FaaS) tool similar to AWS Lambda, which allows you to host your functions in the cloud without having to worry about managing servers. Cloudflare Workers provides good scaling support in case of high request loads, and while it is not the same as hosting an API backend framework like Express or Flask, you can use it to create an API-like experience using the itty-router package. Learn more about it and get started here: https://developers.cloudflare.com/workers/get-started/quickstarts/

  4. Vercel

    Same as Cloudflare workers, you can use Vercel functions. Get started here: https://vercel.com/docs/concepts/functions/serverless-functions

Database

Just as there are various options for hosting the frontend and backend of your application, there are also several options available for hosting your database. In the following section, we will discuss some of the recommended options and provide a list of available free options with links to their respective getting started documentation.

  1. PlanetScale

    PlanetScale is a serverless MySQL platform that offers free hosting for your MySQL database, with the option to scale for a fee. This platform is easy to set up, fast and has clear documentation to help you get started. If you have a side project that requires a MySQL database, PlanetScale is a good choice to consider, especially since the basic setup is free. You can begin here: https://planetscale.com/docs

  2. Railway

    As explained above in the backend section about it, the Railway also provides free provisioning of serverless databases such as MySQL, Postgres, MongoDB, and Redis. Get started here: https://railway.app/

  3. MongoDB Atlas

    MongoDB Atlas offers free cluster provisioning for your NoSQL database needs. This can be a useful resource for hobby projects that require a NoSQL database. You can find more information and get started at https://www.mongodb.com/atlas/database.

  4. Firebase: https://firebase.google.com/

  5. Render: https://render.com/docs/databases

Conclusion

In this article, we discussed there are many options available for hosting your full-stack web application. From static site hosting to serverless functions and then to serverless databases, you have a range of choices that can meet your needs. These options can be especially useful for hobby or side projects, as they often come with free tiers or are completely free to use. However, it is important to carefully consider the pros and cons of each option and choose the one that best fits your specific requirements. Whether you are a beginner or an experienced developer, there is a hosting solution out there that can help you get your application online.

I hope this article will help many beginners or experienced developers out there who have been looking to host their full-stack web applications for free. Even if you have not been looking for it, I will appreciate it if you could support me by sharing this with your friend or colleague who might find this useful. Lastly, for any kind of queries or even a discussion related to it, you can always reach out to my Twitter at https://twitter.com/aabiscodes or LinkedIn at https://www.linkedin.com/in/aabis7/.

Thank you for reading.