Decision: Tech stack — Go framework and frontend approach #9

Closed
opened 2026-08-20 14:35:02 +02:00 by gaetan · 1 comment
Owner

Part of #1

Question

Which Go framework and frontend approach should we use?

The content model and user model are settled, so we can now choose the tech stack.

Backend framework options:

  • net/http (stdlib) — Zero dependencies. Go 1.22+ ServeMux handles path params and wildcards. Pair with encoding/json/v2 for JSON. Simplest possible. Best for a small project.
  • Chi — Minimal router (~1000 LOC). 100% net/http compatible. Route groups, middleware composition. No built-in JSON binding or rendering — you bring your own.
  • Gin — Most popular Go web framework. Rich built-in features (JSON binding, validation, middleware, error handling). Custom gin.Context (not net/http compatible). Heavier.

Frontend approach:

  • Server-rendered HTML (Go templates) — No build step, no JS framework. Simple, fast, works everywhere. Go templates are built into the stdlib. Best for a small personal app.
  • Go templates + Alpine.js — Server-rendered HTML with lightweight JS for interactivity (flashcard flip, rating buttons). Alpine.js is ~10KB, no build step.
  • Go backend + SPA (React/Vue/Svelte) — Full SPA. More complex (build step, API layer, state management). Overkill for a single-user study tool.
  • Go backend + HTMX — Server-rendered HTML with HTMX for interactivity (AJAX, animations). No JS framework, no build step. Growing ecosystem.

Recommended combinations:

  1. net/http + Go templates — Zero dependencies, zero build step. Simplest path.
  2. Chi + Go templates + Alpine.js — Slightly more structure, lightweight interactivity.
  3. Chi + Go templates + HTMX — Server-rendered with AJAX interactivity.

This decision shapes everything: how we serve pages, how we handle API calls, how the review screen works.

Dependencies

  • Depends on: #2 (content model — shapes API design), #6 (user model — no auth simplifies everything)
Part of #1 ## Question Which Go framework and frontend approach should we use? The content model and user model are settled, so we can now choose the tech stack. Backend framework options: - **net/http (stdlib)** — Zero dependencies. Go 1.22+ ServeMux handles path params and wildcards. Pair with `encoding/json/v2` for JSON. Simplest possible. Best for a small project. - **Chi** — Minimal router (~1000 LOC). 100% net/http compatible. Route groups, middleware composition. No built-in JSON binding or rendering — you bring your own. - **Gin** — Most popular Go web framework. Rich built-in features (JSON binding, validation, middleware, error handling). Custom gin.Context (not net/http compatible). Heavier. Frontend approach: - **Server-rendered HTML (Go templates)** — No build step, no JS framework. Simple, fast, works everywhere. Go templates are built into the stdlib. Best for a small personal app. - **Go templates + Alpine.js** — Server-rendered HTML with lightweight JS for interactivity (flashcard flip, rating buttons). Alpine.js is ~10KB, no build step. - **Go backend + SPA (React/Vue/Svelte)** — Full SPA. More complex (build step, API layer, state management). Overkill for a single-user study tool. - **Go backend + HTMX** — Server-rendered HTML with HTMX for interactivity (AJAX, animations). No JS framework, no build step. Growing ecosystem. Recommended combinations: 1. **net/http + Go templates** — Zero dependencies, zero build step. Simplest path. 2. **Chi + Go templates + Alpine.js** — Slightly more structure, lightweight interactivity. 3. **Chi + Go templates + HTMX** — Server-rendered with AJAX interactivity. This decision shapes everything: how we serve pages, how we handle API calls, how the review screen works. ## Dependencies - Depends on: #2 (content model — shapes API design), #6 (user model — no auth simplifies everything)
Author
Owner

Resolution

Tech stack decided:

Backend: net/http (stdlib). Go 1.22+ ServeMux for routing (path params, wildcards). No framework dependency. Add chi/middleware only for recovery and logger if desired.

Frontend: Go templates + Alpine.js. Server-rendered HTML base with Alpine.js for interactivity (flashcard flip, rating buttons without page reload, keyboard shortcuts). No build step, no JS framework.

Why not HTMX: Alpine is simpler for this use case — we're manipulating a few DOM elements (flip card, show rating, update progress bar), not doing complex AJAX flows.

Why not SPA: Overkill. Build step, state management, API layer. Single-user study tool.

Why not Gin: Custom gin.Context locks you in. Overkill for a personal app.

File structure:

cmd/knowledgify/
  main.go          # entry point, server setup
internal/
  config/          # config (db path from env)
  content/         # JSON loading, card parsing
  database/        # SQLite setup, migrations
  review/          # review logic, SRS scheduling
  web/
    handlers/      # HTTP handlers
    templates/     # Go HTML templates
    static/        # Alpine.js (pulled from CDN), CSS
pkg/               # public API (if any)
content/           # JSON card files (source of truth)
knowledgify.db     # SQLite database (generated)
## Resolution Tech stack decided: **Backend**: net/http (stdlib). Go 1.22+ ServeMux for routing (path params, wildcards). No framework dependency. Add chi/middleware only for recovery and logger if desired. **Frontend**: Go templates + Alpine.js. Server-rendered HTML base with Alpine.js for interactivity (flashcard flip, rating buttons without page reload, keyboard shortcuts). No build step, no JS framework. **Why not HTMX**: Alpine is simpler for this use case — we're manipulating a few DOM elements (flip card, show rating, update progress bar), not doing complex AJAX flows. **Why not SPA**: Overkill. Build step, state management, API layer. Single-user study tool. **Why not Gin**: Custom gin.Context locks you in. Overkill for a personal app. **File structure**: ``` cmd/knowledgify/ main.go # entry point, server setup internal/ config/ # config (db path from env) content/ # JSON loading, card parsing database/ # SQLite setup, migrations review/ # review logic, SRS scheduling web/ handlers/ # HTTP handlers templates/ # Go HTML templates static/ # Alpine.js (pulled from CDN), CSS pkg/ # public API (if any) content/ # JSON card files (source of truth) knowledgify.db # SQLite database (generated) ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
gaetan/knowledgify#9
No description provided.