Deploy Go + Fiber

Go + Fiber web server with Zap logging, .env config, and health route

Deploy Go + Fiber

go-fiber

railtools/go-fiber

Just deployed

Deploy and Host Go + Fiber on Railway

Go + Fiber is a fast, minimalist web framework built on top of Go’s fasthttp package. It’s designed to be expressive like Express.js while leveraging Go’s performance and concurrency. Ideal for building high-speed APIs and microservices with minimal overhead.

About Hosting Go + Fiber

Railway deploys Go + Fiber apps using Nixpacks. Just include a go.mod file and expose your Fiber server on os.Getenv("PORT"). Railway automatically detects and builds your project without needing a Dockerfile. You can define custom build steps with nixpacks.toml, and Railway handles port binding, logs, and environment variables out of the box.

Common Use Cases

  • Building REST APIs and microservices
  • Rapid prototyping with Go performance
  • Lightweight web apps or backends

Dependencies for Go + Fiber Hosting

Deployment Dependencies

Implementation Details

package main

import (
	"github.com/gofiber/fiber/v2"
	"go.uber.org/zap"
	"main/logger"
	"main/shared"
	"time"
)

func main() {
	logger.Info("Starting application", zap.String("version", "1.0.0"))
	shared.InitialiseAppSettings(".")
	logger.Info("Application initialized successfully")

	app := fiber.New()

	app.Get(
		"/", func(c *fiber.Ctx) error {
			return c.JSON(
				fiber.Map{
					"status": "ok",
					"slogan": "Wow, so this is what it's like to be on the internet!",
					"date":   time.Now().Format("2006-01-02 15:04:05"),
				},
			)
		},
	)

	app.Get(
		"/health", func(c *fiber.Ctx) error {
			logger.Info("/health called")
			return c.JSON(
				fiber.Map{
					"status": "ok",
					"slogan": "All aboard the railway express!",
					"date":   time.Now().Format("2006-01-02 15:04:05"),
				},
			)
		},
	)

	logger.Info("Starting server on port 8080")
	logger.Fatal("Server failed to start", zap.Error(app.Listen(":8080")))
}

Why Deploy Go + Fiber on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Go + Fiber on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

View Template
caring-vibrancy
Deploy and Host caring-vibrancy with Railway

View Template
mellow-vue
A full-stack Vue app with The Boring JavaScript Stack.

View Template
Sveltekit NestJS
Full-stack with SvelteKit + NestJS + Prisma + Postgresql with utils