Skip to content

sonjek/go-full-stack-example

Repository files navigation

go-full-stack-example

Example of full-stack Go based Web app

GO fiber templ HTMX SQLite GORM tailwindcss daisyui ionicons

Features:

  • Comfortable and flexible component based templates via templ
  • CRUD functionality (Create, Read, Update, and Delete entries)
  • Persistent storage via SQLite + ORM (gorm)
  • User friendly interface with interactive Modals for better UX
  • Error handling on server and user interface side
  • Infinite Scrolling via lazy loading
  • Security configration
  • Native light and dark mode support
  • Preserve static files
  • Swagger API documentation via swaggo

Security

  • CSRF Protection — session-based tokens via Fiber middleware (Synchronizer Token Pattern)
  • SQL Injection Prevention — all database queries use gorm parameterized bindings
  • Content-Security-Policy — restricts resource loading
  • Input Validation — server-side length limits and empty checks with field-level error reporting
  • Secure CookiesHttpOnly, SameSite=Lax, session-scoped for CSRF and session tokens

Quick start

# 1. Clone this repository
git clone https://github.com/sonjek/go-full-stack-example && cd go-full-stack-example

# 2. Run (with hot-reload)
make dev

# Or run (without hot-reload)
make start

# Or build a binary and run
make build && bin/app

The server starts on :3000.

The SQLite database is created automatically and migrations are applied on startup.


Contributors