Skip to content

Frontend React 19 & Single Static Binary Packaging ​

1. Single Static Binary Mechanics ​

Intelektika Portal compiles into a single self-contained binary with zero external runtime dependencies on Node.js or web servers in production.

Embedded Asset Declaration (embedded.go) ​

go
package portal

import (
    "embed"
    "io/fs"
    "net/http"
)

//go:embed all:web/dist
var embeddedFiles embed.FS

// GetFileSystem returns embedded filesystem for HTTP file server
func GetFileSystem() http.FileSystem {
    fsys, err := fs.Sub(embeddedFiles, "web/dist")
    if err != nil {
        panic(err)
    }
    return http.FS(fsys)
}

2. React 19 SPA Architecture ​

  • UI Framework: React 19 bundled with Vite.
  • CSS Styling: Tailwind CSS v3.4 with Lucide React iconography.
  • Routing: React Router DOM v6 for client-side navigation.
  • HTTP Client: Axios instance configured with request interceptors for JWT token injection.

3. Production Compilation Workflow ​

bash
# 1. Compile frontend React assets
cd web
npm run build
cd ..

# 2. Compile Golang application with embedded static assets
go build -ldflags="-s -w" -o bin/portal cmd/server/main.go