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- [templ](https://templ.guide/quick-start/installation)
5- [minify](https://github.com/tdewolff/minify)
6- [goat](https://github.com/bluesky-social/goat)
7
8## Running shlf
9
10To authenticate, you will need OAUTH JWKs to be setup:
11```bash
12export SHLF_OAUTH_CLIENT_KID="$(date +%s)"
13export SHLF_OAUTH_CLIENT_SECRET="$(goat key generate -t P-256 | grep -A1 "Secret Key" | tail -n1 | awk '{print $1}')"
14```
15
16You will need to fetch a series of static assets shlf depends on:
17```bash
18mkdir -p ./static/files
19
20# HTMX
21curl -sLo ./static/files/htmx.min.js https://cdn.jsdelivr.net/npm/htmx.org@2.0.6/dist/htmx.min.js
22# Lucide (icons)
23curl -sLo ./static/files/lucide.min.js https://unpkg.com/lucide@0.525.0/dist/umd/lucide.min.js
24# AlpineJS
25curl -sLo ./static/files/alpinejs.min.js https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js
26```
27
28You will need to start a redis instance - using docker can simplify this
29process greatly:
30```bash
31docker run -d --name shlf-redis -p 6379:6379 redis:latest
32```
33
34To run:
35```bash
36SHLF_DEV=true go run cmd/server/main.go
37```
38
39If you modified the views, you will need to regenerate them:
40```bash
41go tool templ generate
42go tool templ fmt ./internal/views/
43```
44
45If you modified the tailwind styles, you will need to regenerate the css:
46```bash
47tailwindcss -i ./input.css -o ./static/files/style.css
48```
49
50If you modified the js files, you will need to regenerate the minified versions:
51```bash
52minify static/*.js -o static/files/
53```
54