How muhafiq/go-web-ssr works
This is a learning-oriented Go server-rendered web app: browsers request pages, static assets, and login/logout actions; the server applies middleware, renders templates, and checks login credentials against Turso. The documented scope includes net/http, templates, static files, middleware, sessions, and Turso. Post and user CRUD handlers exist but are empty, so they are not represented as working workflows. The graph follows the sampled routes and source; it does not infer unsampled behavior.
Main entry points: main.go HTTP server and routes · auth_controller.go Login and logout · helper.go Method dispatch · session.go Cookie sessions
Components 14
HTTP and middleware
- HTTP server and routes
main.go - Request logger
internal/middleware/logging.go - Cookie sessions
internal/middleware/session.go - Method dispatch
internal/controllers/helper.go
Server-rendered UI
- Static file serving
main.go - Home page
internal/controllers/public_controller.go - Template rendering
internal/controllers/helper.go - HTML templates
views - CSS and JavaScript
public
Authentication
- Login and logout
internal/controllers/auth_controller.go
Persistence
- User lookup
internal/models/user.go - Database connection
internal/config/database.go
Other components
- Browser
- Turso database
Connections 17
- Browser → HTTP server and routes: sends requests
- HTTP server and routes → Request logger: wraps routes
- Request logger → Cookie sessions: passes requests
- Cookie sessions → Method dispatch: passes requests
- HTTP server and routes → Method dispatch: registers routes
- Method dispatch → Home page: dispatches GET
- Method dispatch → Login and logout: dispatches methods
- HTTP server and routes → Static file serving: serves assets
- Browser → Static file serving: requests files
- Home page → Template rendering: renders page
- Login and logout → Template rendering: renders login
- Template rendering → HTML templates: parses templates
- Login and logout → Cookie sessions: reads and saves session
- Login and logout → User lookup: looks up email
- User lookup → Database connection: queries database
- HTTP server and routes → Database connection: connects database
- Database connection → Turso database: opens connection