How afarmo/forum works
Literary Lions Forum is a Go web forum for book-club discussions, with categories organizing posts. The main workflow is an HTTP request routed through middleware to a handler, then through a domain service to SQLite-backed repositories; results are returned as JSON or rendered templates. The graph includes authentication, posts/search, categories, comments, profiles, and the persistence layer. Some domain capabilities are documented by route registrations or the README but their implementation details were not sampled, so those internal links are limited to supported wiring.
Main entry points: main.go HTTP server · router.go Route dispatch · middleware/auth.go Request middleware · service/auth.go Authentication
Components 28
HTTP and UI
- HTTP server
cmd/main.go - Route dispatch
internal/router/router.go - Request middleware
internal/middleware/auth.go - Web templates
internal/web/templates - Static assets
internal/web/static
Forum capabilities
- Auth handlers
internal/handlers/auth.go - Authentication
internal/service/auth.go - Password hashing
internal/auth/password.go - Post handlers
internal/handlers/post.go - Post and search
internal/service/post.go - Category handlers
internal/handlers/categories.go - Categories
internal/service/category.go - Comment handlers
internal/handlers/comment.go - Comments
internal/service/comment.go - Profile handlers
internal/handlers/user.go - User profiles
internal/service/user.go - Home feed
internal/handlers/home.go - Reactions
internal/service/reaction.go
Persistence and models
- SQLite database
internal/database/db.go - Forum schema
internal/database/schema.sql - Initial data
internal/database/seed.go - Post repository
internal/repository/post.go - Category repository
internal/repository/category.go - Comment repository
internal/repository/comment.go - Session repository
internal/repository/session.go - User repository
internal/repository/user.go - Forum data models
internal/models
Other components
- Forum member
Connections 41
- Forum member → HTTP server: sends requests
cmd/main.go - HTTP server → SQLite database: opens database
cmd/main.go - HTTP server → Forum schema: initializes schema
cmd/main.go - HTTP server → Route dispatch: serves routes
cmd/main.go - HTTP server → Request middleware: wraps requests
cmd/main.go - HTTP server → Post repository: constructs repository
cmd/main.go - HTTP server → Category repository: constructs repository
cmd/main.go - HTTP server → Comment repository: constructs repository
cmd/main.go - HTTP server → Session repository: constructs repository
cmd/main.go - HTTP server → User repository: constructs repository
cmd/main.go - HTTP server → Web templates: parses templates
cmd/main.go - Route dispatch → Auth handlers: routes auth
internal/router/router.go - Route dispatch → Post handlers: routes posts
internal/router/router.go - Route dispatch → Category handlers: routes categories
internal/router/router.go - Route dispatch → Comment handlers: routes comments
internal/router/router.go - Route dispatch → Profile handlers: routes profiles
internal/router/router.go - Route dispatch → Home feed: routes home
internal/router/router.go - Route dispatch → Static assets: serves assets
internal/router/router.go - Request middleware → Route dispatch: dispatches requests
- Auth handlers → Authentication: invokes auth
internal/handlers/auth.go - Authentication → Password hashing: hashes passwords
internal/service/auth.go - Authentication → User repository: looks up users
internal/service/auth.go - Authentication → Session repository: creates sessions
internal/service/auth.go - Request middleware → Session repository: checks sessions
internal/middleware/auth.go - Request middleware → User repository: loads user
internal/middleware/auth.go - Post handlers → Post and search: invokes post actions
internal/handlers/post.go - Post and search → Post repository: queries and writes
internal/service/post.go - Post repository → SQLite database: reads and writes
internal/repository/post.go - Category handlers → Categories: invokes categories
internal/handlers/categories.go - Categories → Category repository: queries categories
internal/service/category.go - Comment handlers → Comments: invokes comments
internal/handlers/comment.go - Comments → Comment repository: queries and writes
internal/service/comment.go - Profile handlers → User profiles: updates profile
internal/handlers/user.go - Profile handlers → Categories: loads categories
internal/handlers/user.go - Profile handlers → Post and search: loads user posts
internal/handlers/user.go - Home feed → Categories: loads categories
internal/handlers/home.go - Home feed → Post and search: loads feed
internal/handlers/home.go - User profiles → User repository: accesses user data
internal/service/user.go - Web templates → Forum member: renders pages
- Reactions → Post repository: reaction storage
- Forum data models → SQLite database: represents stored data