Get Free VPS hosting Using GitHub CodeSpaces

Sh Raj - Apr 30 - - Dev Community

Disclaimer :- GitHub Codespaces also have some limitations. Checkout there docs.

GitHub Codespaces

  • Create new Codespace of your GitHub Repo and Install Homebrew there.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Enter fullscreen mode Exit fullscreen mode
  • For Example you are using NextJS. Then Build and Start your Server. i.e. http://localhost:3000.

Use Tunnelling

Now, Open your URL of GitHub Codespaces where your server is running now we need to forward the port or create a tunnel to expose our localhost to the internet.

You can use other services like ngrok, I'm using Cloudflare Tunnel.

cloudflare-tunnel :- https://developers.cloudflare.com/pages/how-to/preview-with-cloudflare-tunnel


# Install Cloudflare
brew install cloudflared

# Start Tunnel
cloudflared tunnel --url http://localhost:3000

Enter fullscreen mode Exit fullscreen mode

You will get a custom domain by cloudflare temporarily but you can also add your own custom domain name for free.

See This Video.

Tip : Use Uptimerobot to keep your codespace awake.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .