Discover books, shows, and movies at your level. Track your progress by filling your Shelf with what you find, and share with other language learners. *No dusting required.
shlf.space
1# Hacking guide
2
3## Required tools
4- [tailwind-cli](https://tailwindcss.com/docs/installation/tailwind-cli)
5- [templ](https://templ.guide/quick-start/installation)
6- [minify](https://github.com/tdewolff/minify/tree/master/cmd/minify)
7- [goat](https://github.com/bluesky-social/goat)
8
9## Running shlf
10
11To authenticate, you will need OAUTH JWKs to be setup:
12```bash
13export SHLF_OAUTH_CLIENT_KID="$(date +%s)"
14export SHLF_OAUTH_CLIENT_SECRET="$(goat key generate -t P-256 | grep -A1 "Secret Key" | tail -n1 | awk '{print $1}')"
15```
16
17You will need to fetch a series of static assets shlf depends on:
18```bash
19mkdir -p ./static/files/js
20
21# HTMX
22curl -sLo ./static/files/js/htmx.min.js https://cdn.jsdelivr.net/npm/htmx.org@2.0.6/dist/htmx.min.js
23# Lucide (icons)
24curl -sLo ./static/files/js/lucide.min.js https://unpkg.com/lucide@0.525.0/dist/umd/lucide.min.js
25# AlpineJS
26curl -sLo ./static/files/js/alpinejs.min.js https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js
27```
28
29You will need to start a redis instance - using docker can simplify this
30process greatly:
31```bash
32docker run -d --name shlf-redis -p 6379:6379 redis:latest
33```
34
35To run:
36```bash
37SHLF_DEV=true go run cmd/server/main.go
38```
39
40If you modified the views, you will need to regenerate them:
41```bash
42go tool templ generate
43go tool templ fmt ./internal/ui/
44```
45
46If you modified the tailwind styles, you will need to regenerate the css:
47```bash
48tailwindcss -i ./input.css -o ./static/files/style.css
49```
50
51If you modified the js files, you will need to regenerate the minified versions:
52```bash
53find internal static -path 'static/files' -prune -o -name '*.js' -print | while read f; do minify "$f" -o "static/files/js/$(basename "$f")"; done
54```
55