Architecture
Database
We are using the Golang standard libraries database/sql to manage our db connections.
This allows us to use any database driver that implements the interface.
For now we are using modernc.org/sqlite for SQLite3.
Logging
We are using golang.org/x/slog
for logging.
A reusable logger is created in internal/log
.
This should be used in all packages.
It will log to stderr and to a .json file ~/.bunkr/log/bunkr.log.json
.
This global logger will also take care of log file rotation.
A new log file will be created on every startup.
The old log file will be renamed to bunkr.log.json.1
.
A maximum of 5 log files will be kept.
Old log files will be deleted on startup.
Frontend
We are using Go's html/template
for server-side rendering of HTML. This allows us to dynamically generate HTML pages on the server-side based on the data we have. For client-side interactivity, we are using htmx and hyperscript. htmx allows us to access AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML, enabling us to keep our frontend code simple and declarative. Hyperscript complements this by providing a mechanism to handle complex client-side logic in a simple and maintainable way. This combination allows us to create a rich, interactive user experience with minimal complexity.