README.md (view raw)
1# weimar
2
3A single-binary media repository for your home server. Share memes,
4screenshots, and short videos with your group without uploading to someone
5else's cloud. Self-host on any Linux machine: all you need is the binary and a
6place to store files.
7
8weimar is inspired by [Chevereto](https://github.com/chevereto/chevereto) but
9stripped down to the essentials: upload media, tag it, browse a gallery, and
10share a direct link.
11
12## What it looks like
13
14The web interface is a modern single-page app with a full-screen image viewer,
15keyboard navigation, and tag-based discovery. Upload from your phone's browser,
16browse on your laptop, download originals from anywhere. The design is clean
17and bold — Swiss typography with red accents.
18
19## What you get
20
21The core loop is dead simple. Register an account (or have an admin make one
22for you), upload files through the web form with whatever tags make sense, and
23they appear in the gallery. Click any thumbnail to open the full image in an
24overlay viewer: arrow keys to browse, `Esc` to close, click outside to dismiss.
25The URL updates to a shareable link (`/browse?image=<id>`) that you can send to
26anyone — even people without an account, because browsing is public by default.
27
28Tags are how you find things later. Type a few words when uploading and the
29autocomplete will suggest tags other people have used. Filter the gallery by
30clicking tags or adding `?tag=funny` to the URL. If you're the uploader, you
31can edit tags after the fact: a text field with the same autocomplete and ADD
32and REMOVE buttons appears below the tag display in the viewer.
33
34## Where data lives on disk
35
36Everything lives in two directories you control: one for the SQLite database
37(user accounts, sessions, metadata) and one for the image files. Files are
38stored in a hash-partitioned folder structure (three levels of two-character
39subdirectories) so no single folder ever gets crowded. The config file points
40to these locations and you can put them anywhere.
41
42## How to install
43
44The simplest path is to download a pre-built binary from the releases page.
45There are builds for Linux and macOS, both amd64 and arm64. Put the binary
46somewhere in your PATH like `/usr/local/bin/weimar`, make it executable with
47`chmod +x`, and you're done.
48
49If you want to build from source, you'll need Go and Bun. Run `make build` and
50the binary lands in `bin/weimar`.
51
52## How to configure
53
54Create a file called `weimar.toml` in the same directory you run the server
55from. This is the only required step. Everything has sensible defaults.
56
57```toml
58[server]
59host = "0.0.0.0"
60port = 8080
61
62[database]
63path = "./data/weimar.db"
64
65[storage]
66path = "./data/images"
67
68[upload]
69max_size_mb = 50
70
71[auth]
72allow_registration = true
73```
74
75If you're putting weimar behind a TLS-terminating reverse proxy like Caddy or
76nginx (which you should if facing the Internet), add this:
77
78```toml
79[server]
80behind_proxy = true
81```
82
83This enables the `Secure` flag on session cookies so your browser doesn't refuse
84to send them over the HTTPS connection to the proxy. The security headers
85(`X-Content-Type-Options: nosniff`, `X-Frame-Options: DENY`,
86`Referrer-Policy: same-origin`) are always set regardless.
87
88You can also require authentication to browse the gallery:
89
90```toml
91[auth]
92require_auth_for_browse = true
93```
94
95If you don't want to bother with a config file at all, you can set every option
96through environment variables prefixed with `WEIMAR_`. For example,
97`WEIMAR_SERVER_PORT=9090 weimar serve` overrides the default port.
98
99## How to run
100
101The first time you start the server, create an admin account with
102`--admin-email` and `--admin-password`:
103
104```bash
105weimar serve --config weimar.toml --admin-email you@example.com --admin-password s3cur3
106```
107
108This flags only work on the very first run when no users exist yet. After that,
109admin accounts can be managed through the CLI or by other admins.
110
111Once the server is running, open `http://your-server-ip:8080` in a browser.
112
113### Running as a systemd service
114
115For a proper home-server setup you'll want weimar to start on boot and stay
116running.
117
118```
119[Unit]
120Description=weimar media repository
121After=network.target
122
123[Service]
124Type=simple
125User=weimar
126Group=weimar
127WorkingDirectory=/home/weimar
128ExecStart=/usr/local/bin/weimar serve
129Restart=on-failure
130RestartSec=5
131
132[Install]
133WantedBy=multi-user.target
134```
135
136Create a dedicated `weimar` system user, place the config and data directories
137under its home folder, enable the service with `systemctl enable weimar`, and
138start it with `systemctl start weimar`.
139
140## Admin commands
141
142User management happens on the command line, not through the web interface.
143
144```bash
145weimar users list
146weimar users create newuser password123
147weimar users create adminuser str0ngp4ss --admin
148weimar users delete bob
149weimar users password-reset alice
150weimar image delete 42
151```
152
153Every command accepts `--config` or `WEIMAR_CONFIG` to point at your config
154file.
155
156## What about video?
157
158weimar handles short videos just fine. It stores them, streams them, and
159generates thumbnails. Thumbnails require `ffmpeg` on the server's PATH. If
160`ffmpeg` isn't available, videos still play in the browser; they just show a
161placeholder instead of a thumbnail in the gallery.
162
163## Things weimar doesn't do
164
165This is intentionally a simple tool. There's no full-text search beyond tags,
166no albums or collections, no user profiles, no comment threads, no federation
167with other servers, no Redis or caching layer, and no Docker image. The
168database is a single SQLite file with one writer at a time: fine for a small
169group, probably not ideal for hundreds of concurrent users.