67 lines
1.9 KiB
Markdown
Executable File
67 lines
1.9 KiB
Markdown
Executable File
# Luxtools (Go edition)
|
|
|
|
Luxtools is now implemented entirely in Go. The project serves a retro-styled HTMX interface backed by a lightweight Go HTTP server that mirrors the behaviour of the former Nim version.
|
|
|
|
## Project layout
|
|
|
|
```
|
|
luxtools/
|
|
├── media/ # Runtime media directory served from disk (/media/*)
|
|
├── cmd/luxtools/ # Main program entrypoint
|
|
├── internal/server/ # HTTP server, handlers, helpers, and tests
|
|
├── web/
|
|
│ ├── static/ # Vendored front-end assets (HTMX, TUI.CSS, images)
|
|
│ └── templates/ # HTML templates rendered by the server
|
|
├── deploy/ # Deployment manifests (systemd unit, etc.)
|
|
├── go.mod # Go module definition
|
|
└── README.md # You're here
|
|
```
|
|
|
|
## Prerequisites
|
|
|
|
- Go 1.22 or newer
|
|
|
|
## Run the server
|
|
|
|
```bash
|
|
go run ./cmd/luxtools
|
|
```
|
|
|
|
The server listens on [http://127.0.0.1:5000](http://127.0.0.1:5000) and serves:
|
|
|
|
- `/` — main page rendered from `web/templates/index.html`
|
|
- `/counter` — HTMX-powered counter snippet with server-side state
|
|
- `/time` — current server timestamp
|
|
- `/static/*` — vendored assets from `web/static`
|
|
- `/media/*` — runtime media files served from the configured directory
|
|
|
|
### Configuration
|
|
|
|
The server looks for media files in the following order:
|
|
|
|
1. A directory specified via `--media-dir` on the command line.
|
|
2. The `media_dir` value in an optional JSON config file passed with `--config`.
|
|
3. A `media` directory located alongside the binary or in the current working directory.
|
|
|
|
Sample config file:
|
|
|
|
```json
|
|
{
|
|
"media_dir": "/var/lib/luxtools/media"
|
|
}
|
|
```
|
|
|
|
## Testing
|
|
|
|
```bash
|
|
go test ./...
|
|
```
|
|
|
|
## Building for deployment
|
|
|
|
```bash
|
|
go build -o bin/luxtools ./cmd/luxtools
|
|
```
|
|
|
|
The resulting binary is compatible with the provided systemd unit located in `deploy/luxtools.service`.
|