Golang hosting is a service that compiles your Go code into a single static binary and runs it in production, with HTTPS, a database, and scaling handled for you. For most Go web apps, the best choice is a platform-as-a-service that builds from GitHub and provisions managed PostgreSQL next to the app. Out Plane does this without servers or YAML, with no cold starts, EU data residency in Germany, and a 14-day free trial on Starter and Pro.
This guide covers what to look for in Golang hosting, how modern Go deploys actually work, how to package a Go binary in a minimal image, and how to run a Go service in production with a database, scaling, and EU data residency in Germany.
What Is Golang Hosting?
Golang hosting is the infrastructure that builds, runs, and serves a compiled Go application in production, including its network routing, TLS, managed database, and scaling. Because Go ships as a single static binary, the platform's build and operations model matters more than raw CPU.
That static binary is Go's defining hosting advantage. A Go program compiled with CGO_ENABLED=0 links everything it needs into one executable with no runtime interpreter, no virtual machine, and no external shared libraries to install on the host. The result starts in milliseconds and holds a small memory footprint, which is exactly the profile a container platform metered by the minute rewards. Where a dynamic-language service pays a warm-up cost, a Go binary is ready to serve the moment the process starts. The official Go documentation at go.dev/doc describes the toolchain and standard library that make this single-artifact model possible.
What to Look for in Golang Hosting
Go apps are lightweight and fast, so the platform around them matters more than raw compute. Four things separate hosting you can grow on from hosting you migrate off in six months.
- Git-push deploys. You connect a repository, push, and the platform builds the binary and ships the new version. No
scp, no systemd unit, no reverse-proxy config. - Instances that never sleep. A Go binary that stays resident answers the first request immediately. A host that parks idle apps makes your users wait through a cold start.
- A managed database next to your app. Most Go services need Postgres. Provisioning one from the same platform, with backups handled for you, removes an entire class of work.
- Predictable pricing. Usage metered by the minute, with no surprise minimums, keeps the cost proportional to what your service actually does.
If a host is missing any of these, you will feel it the first time your Go app has real users.
How Go Deploys Work on a Modern Host
A modern Go host builds your app from source and runs it as a container. The flow is the same whether you use the standard library, Gin, Echo, Chi, or Fiber.
- Connect your repository. The platform reads your
go.mod, detects Go, and compiles a production binary. - Bind to the right host and port. Your server must listen on
0.0.0.0and the port the platform provides through thePORTenvironment variable. In Go, readingos.Getenv("PORT")and listening on":" + portbinds every interface. This one detail is the most common reason a first deploy builds fine but receives no traffic. - Push to deploy. Each push to your connected branch triggers a new build and a zero-downtime release.
On Out Plane, both Cloud Native Buildpacks and a custom Dockerfile are supported. A plain Go app deploys with zero configuration because buildpacks detect go.mod automatically, and a more involved build deploys exactly the way you define it.
Binding to 0.0.0.0 and PORT in Go
The single most important line in a production Go server is where it binds. During local development, listening on localhost or a fixed port works because you are the only client. On a hosted platform, the router lives on a different interface, so a server bound to localhost is unreachable no matter how cleanly it built. The fix is to read the injected PORT and listen on every interface.
package main
import (
"fmt"
"log"
"net/http"
"os"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello from Go")
})
// The platform injects PORT. Fall back to 8080 for local runs.
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
// Listening on ":" + port binds 0.0.0.0, every interface,
// so the platform router can reach the process.
log.Printf("listening on :%s", port)
log.Fatal(http.ListenAndServe(":"+port, nil))
}Passing ":"+port rather than "localhost:"+port is what makes the difference. The Go standard library treats an empty host in the listen address as "all interfaces," which is documented for net/http and the underlying net.Listen. Get this right and every host, buildpack or Dockerfile, can route traffic to your service.
Building Go with a multi-stage Dockerfile
Buildpacks cover most Go apps with no configuration. When you want full control of the base image, the toolchain version, or build flags, a multi-stage Dockerfile gives you a tiny, reproducible runtime. This is where Go's static binary pays off: you compile in a build stage that has the full toolchain, then copy only the finished binary into an image with almost nothing else in it.
# Build stage: full Go toolchain, produces a static binary
FROM golang:1.23-alpine AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -o /bin/server ./cmd/server
# Runtime stage: nothing but the binary and TLS roots
FROM scratch
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build /bin/server /server
EXPOSE 8080
ENTRYPOINT ["/server"]A few details make this work in production. CGO_ENABLED=0 produces a fully static binary with no libc dependency, which is what lets the scratch runtime image, an image that contains nothing, actually run it. Copying ca-certificates.crt gives the binary the TLS root certificates it needs to make outbound HTTPS calls to APIs and managed databases. Splitting the build and runtime stages keeps the toolchain out of the shipped image, so the final artifact is often just a few megabytes. If you prefer an image with a shell for debugging, swap scratch for alpine and the rest stays the same.
Deploy a Go Web App on Out Plane
The steps below take a Go web server from your machine to a public HTTPS URL. You need Go 1.23 or later, a GitHub account, and your code in a GitHub repository with go.mod at the root.
Step 1: Add a health route and a clean shutdown
Start from the server above and add two things a production service needs. A /health route gives uptime monitors a cheap URL that does no real work. A shutdown handler lets in-flight requests finish when the process is stopped, instead of cutting them off.
package main
import (
"context"
"log"
"net/http"
"os"
"os/signal"
"syscall"
"time"
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello from Go\n"))
})
mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Write([]byte("ok\n"))
})
// ":" + port binds every interface, never localhost.
srv := &http.Server{Addr: ":" + port, Handler: mux}
go func() {
log.Printf("listening on :%s", port)
if err := srv.ListenAndServe(); err != http.ErrServerClosed {
log.Fatal(err)
}
}()
// Containers are stopped with SIGTERM. Give open requests 30 seconds.
stop := make(chan os.Signal, 1)
signal.Notify(stop, syscall.SIGINT, syscall.SIGTERM)
<-stop
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
if err := srv.Shutdown(ctx); err != nil {
log.Printf("shutdown: %v", err)
}
}Run it with go run . and open http://localhost:8080/health to check it answers.
Step 2: Commit your modules and pick a build method
Run go mod tidy and commit both go.mod and go.sum. The build resolves dependencies from them, and a missing go.sum entry fails the build.
go mod tidy
git add go.mod go.sum
git commit -m "Prepare for deploy"
git push origin mainThen decide how Out Plane builds the app. With no Dockerfile, choose Buildpacks and the platform compiles the binary from go.mod. To control the image, commit the multi-stage Dockerfile above and choose Dockerfile. If main.go sits at the repository root rather than in cmd/server, change its build line to RUN CGO_ENABLED=0 go build -o /bin/server ..
Private modules fail to download during the build, because the builder has no credentials for them. Vendor them with go mod vendor and commit the vendor folder. With the Dockerfile above, also remove the go mod download line.
Step 3: Create the app in the console
- Open console.outplane.com and sign in with GitHub.
- Select your Go repository and the branch to deploy, such as
main. - Choose the build method from step 2: Buildpacks or Dockerfile.
- Set the port to
8080, the port the server listens on. - Add any environment variables with Add variable, or paste several at once with Edit as .env.
- Click Deploy app.
Step 4: Watch the deploy
The status moves through Queued, Building, Deploying, and Ready. Once it reads Ready, the app URL appears at the top of the deployment page, already on HTTPS. Logs, HTTP request logs, and CPU and memory metrics are in the app's sidebar.
If the build passes but the status stays on Deploying, the server is almost always bound to localhost. Check that it listens on ":" + port, then push again.
Step 5: Add a PostgreSQL database
- Open Create → Database in the console.
- Pick a PostgreSQL version from 14 to 18.
- Keep Frankfurt, the default region, so the database sits close to your app in Germany.
- Copy the connection URL and add it to the app as the
DATABASE_URLenvironment variable.
Add the driver, then open a pool as shown in Hosting a Go App with a Database.
go get github.com/jackc/pgx/v5
go mod tidyCall pool.Ping(ctx) at startup. A wrong URL then shows up in the logs right away, not on the first request.
Step 6: Map a custom domain
Open Domains, click Add domain, and enter a hostname such as api.example.com. Add the DNS records it shows at your registrar. The certificate is issued once DNS resolves.
Deploy from your terminal or a coding agent
The same deploy runs from a terminal with the Out Plane CLI. outplane login opens the console in your browser, where you click Approve. outplane repos lists the GitHub repositories you have connected, and app create creates the app and starts the first deploy. The CLI builds from the Dockerfile in your repository by default, so commit the one from step 2. On Windows, install with npm i -g outplane instead of the script.
curl -fsSL https://outplane.com/install.sh | sh
outplane login
outplane repos
outplane app create mygoapp --repo yourusername/my-go-app --branch main --port 8080:http:public
outplane app get mygoapp --json --fields status,url
outplane logs mygoapp --followIf you created a database in step 5, set its URL on the app and redeploy in one line:
outplane env set DATABASE_URL="$(outplane db url mydb)" --app mygoapp --deployTo hand this to Claude Code or another coding agent, install the Out Plane skill with outplane skills install. The install script already does this for you. Restart the tool and ask it to deploy this project to Out Plane. You only click Approve in the browser.
Best Golang Hosting Options in 2026
The realistic choices for hosting a Go app fall into three groups: platform-as-a-service, raw virtual servers, and serverless functions.
| Option | Deploy model | Free tier | Managed database | Best for |
|---|---|---|---|---|
| Out Plane (PaaS) | Git push + Dockerfile | 14-day free trial, then from $9/month | PostgreSQL (Redis as a one-click template) | Long-running Go services that need a database |
| Traditional PaaS | Git push | Trial only, on most | Add-on, billed separately | Simple apps within trial limits |
| Virtual server (VPS) | Manual / SSH | None | Self-managed | Teams that want full OS control |
| Serverless functions | Zip or container | Generous, but cold starts | External | Short, bursty request handlers |
For a long-running Go server that holds connections, runs background workers, or talks to a database, a platform-as-a-service is usually the best fit. It gives you git-push builds, a managed database, HTTPS, and scaling from one place, and it treats a persistent process as the normal case rather than the exception.
A VPS gives you the most control but hands you the operating system, security patching, process supervision with systemd, a reverse proxy, TLS renewal, and log rotation. That is real work that has nothing to do with your Go code, and it recurs for the life of the service. Many teams start on a VPS for the control and later move to a PaaS once the maintenance stops being interesting.
Serverless functions suit short request handlers and event-driven glue. As of 2026 they typically add cold-start latency on the first request after idle, cap execution time, and make persistent Go patterns awkward, including long-lived database connection pools, in-process caches, and background goroutines. A Go binary that starts instantly and stays warm on a PaaS sidesteps all of that. Pricing for any competing option changes over time, so check each provider's own pricing page for current rates before you compare.
Free Go Hosting
Free Go hosting is mostly trial hosting, and the details matter. Very few platforms let a production service run indefinitely at no cost, so the useful question is what the service costs once the trial ends.
Out Plane does not run a permanent free tier. Starter and Pro both open with a 14-day free trial, and each plan folds an amount of usage into its monthly base fee. Because Go binaries are small and start instantly, a low-traffic API, a webhook receiver, or a personal service runs continuously inside that allowance. There are no cold starts, so the first request after a quiet night is answered immediately. Usage past the allowance is metered by the minute, so a quiet service stays cheap. For current numbers see the pricing page.
Hosting a Go App with a Database
A Go service almost always needs somewhere to store data. Rather than running your own database server, you provision a managed one from the same platform, which means backups, patching, and failover are handled for you instead of becoming your on-call problem.
Out Plane provides managed PostgreSQL with automated backups, point-in-time recovery, read replicas, and connection pooling. Redis for caching, sessions, and queues deploys as a one-click template you run yourself. Your app reads the connection string from an environment variable and opens a pool at startup. With the common pgx driver that looks like this:
import (
"context"
"os"
"github.com/jackc/pgx/v5/pgxpool"
)
// DATABASE_URL is set as an environment variable on the app.
func newPool(ctx context.Context) (*pgxpool.Pool, error) {
return pgxpool.New(ctx, os.Getenv("DATABASE_URL"))
}A pool, rather than a single connection, matters under load: Go serves each request on its own goroutine, so a pool lets concurrent requests share a bounded set of connections instead of opening one per request. When the database also offers server-side connection pooling, the two layers together keep a busy Go service from exhausting connection limits. Compute is metered by the minute and the managed database carries a flat monthly charge, so a quiet service stays cheap.
Scaling and Regions
When one instance is no longer enough, you add more. Out Plane runs Go apps across multiple instances behind automatic load balancing, so horizontal scaling is a matter of raising the instance count rather than rebuilding your architecture. Go's concurrency model already lets a single instance handle high throughput, and horizontal scaling extends that past the limits of one machine. Because a Go binary starts in milliseconds, a new instance joins the pool almost immediately, so scaling out is fast rather than a slow warm-up.
Two habits keep a Go service scale-ready. Keep the process stateless, holding session and shared state in Redis or managed PostgreSQL rather than in memory, so any instance can serve any request. Route background work through a queue, so long tasks do not block request-serving goroutines and can be scaled independently.
Every app runs in Out Plane's German region, so your data stays in the EU by default. EU data residency is the standard here, not an upgrade you have to ask for. Persistent volumes, TCP services, custom domains with automatic HTTPS, environment variables, API tokens, and a browser terminal are all part of the platform, so a Go app that outgrows a single stateless process still has room to run. If you are still choosing a provider, our guide to backend hosting in Europe compares nine options on European regions, database placement and price.
Migrating an Existing Go App
Moving an existing Go service onto a modern host is usually a short, mechanical change rather than a rewrite. The steps below take a working local app to a hosted deploy.
- Read
PORTand bind0.0.0.0. Replace any hardcoded address orlocalhostbind withos.Getenv("PORT")and listen on":" + port, as shown above. This is the change most local apps need. - Move config into environment variables. Database URLs, API keys, and feature flags should come from
os.Getenv, not from a committed config file. Set them as environment variables in the platform. - Provision the database. Create a managed PostgreSQL instance, or deploy Redis from a one-click template, and connect through the injected connection string instead of a local host.
- Choose your build. Push as-is to let buildpacks detect
go.mod, or add the multi-stageDockerfileabove for a minimal, pinned image. - Connect the repository and push. The first push builds and releases. Every push after that ships a new zero-downtime version automatically.
- Add a custom domain. Point your domain at the app and HTTPS is issued and renewed for you.
Because Go has no runtime to install and no framework-specific server to configure, most migrations come down to those first two steps.
How to Choose
If you are hosting a personal project or an early-stage API, start on Starter with its 14-day free trial and keep the option to grow. If you are running a full-stack Go app with a database, choose a platform that provisions both from one place. If you package your service as an image, a host with first-class Docker hosting lets you ship the exact runtime you build. And if your stack spans languages, a platform that also handles Node.js hosting keeps every service on one bill.
Ready to deploy? Host your Go app on Out Plane with a 14-day free trial. See the full breakdown on the pricing page.
Frequently Asked Questions
What is the best hosting for a Go app?
The best Golang hosting for most developers is a platform-as-a-service that builds from GitHub, provides a managed database, and bills for usage. It removes server management while keeping full control of your code. Out Plane offers this with a 14-day free trial, managed PostgreSQL, Redis as a one-click template you run yourself, and compute metered by the minute.
Is there free hosting for Go?
Not permanently. Out Plane has no free tier, but Starter and Pro both begin with a 14-day free trial, and every plan includes an amount of usage in its monthly base fee. Because Go binaries start instantly and instances never sleep, a low-traffic Go service usually stays inside that allowance and answers every request without a cold start.
How do I deploy a Go app?
Connect your GitHub repository, make sure your server reads the PORT environment variable and listens on 0.0.0.0, and push. The platform compiles your binary with buildpacks or your Dockerfile and releases it with zero downtime. Every later push deploys the new version automatically.
Why does my Go app build but receive no traffic?
The most common cause is listening on localhost or a hardcoded port. A hosted Go server must read the PORT environment variable and bind 0.0.0.0, which in Go means listening on ":" + port. Fix that one line and the platform can route requests to your service.
Do I need a Dockerfile to host a Go app?
No. Buildpacks detect your go.mod and compile a production binary with zero configuration. A custom Dockerfile is optional and useful when you want a specific base image or a minimal multi-stage runtime. Out Plane supports both, so you can start simple and add a Dockerfile later.
How do I build a small Go container image?
Use a multi-stage Dockerfile. Compile with CGO_ENABLED=0 in a golang build stage to produce a static binary, then copy just that binary and ca-certificates.crt into a scratch or alpine runtime image. The final image is often only a few megabytes because it carries no toolchain.
Can I host a Go app with a database?
Yes. On Out Plane you provision managed PostgreSQL alongside your app, or deploy Redis from a one-click template you run yourself, and read the connection string from an environment variable. Backups, point-in-time recovery, read replicas, and connection pooling are handled for you, while compute is metered by the minute.
How do I scale a Go app?
Raise the instance count and the platform load-balances across instances automatically. Keep the process stateless by storing shared state in Redis or managed PostgreSQL, and route long tasks through a queue. Because a Go binary starts in milliseconds, new instances join the pool almost immediately.



