63 lines
1.9 KiB
Markdown
63 lines
1.9 KiB
Markdown
# LLM Skill Marketplace
|
|
|
|
Go + Postgres marketplace where authenticated users can upload LLM skill files, sell them, and buyers can unlock and copy/download purchased skills.
|
|
|
|
## Stack
|
|
- Backend: Go (`go run .`)
|
|
- Frontend: vanilla HTML/CSS/JS
|
|
- Database: Postgres
|
|
- Auth: Authentik forward auth (identity headers)
|
|
- Config: environment variables with `.env` support
|
|
|
|
## Run
|
|
1. Copy `.env.example` to `.env` and set values.
|
|
2. Start Postgres and create the target database.
|
|
3. Install dependencies:
|
|
```bash
|
|
go mod tidy
|
|
```
|
|
4. Start server:
|
|
```bash
|
|
go run .
|
|
```
|
|
5. Open `http://localhost:8080`.
|
|
|
|
## Listener configuration
|
|
- `LISTEN_NETWORK`: `tcp` (default) or `unix`
|
|
- `LISTEN_ADDRESS`:
|
|
- for `tcp`: address like `:8080` or `127.0.0.1:8080`
|
|
- for `unix`: socket path like `/tmp/skills2.sock`
|
|
- `UNIX_SOCKET_PERM`: octal file mode for unix socket path (default `0660`)
|
|
|
|
Examples:
|
|
- TCP (default):
|
|
- `LISTEN_NETWORK=tcp`
|
|
- `LISTEN_ADDRESS=:8080`
|
|
- Unix socket:
|
|
- `LISTEN_NETWORK=unix`
|
|
- `LISTEN_ADDRESS=/tmp/skills2.sock`
|
|
- `UNIX_SOCKET_PERM=0660`
|
|
|
|
## Local dev mode (no auth setup)
|
|
Set `DEV_MODE=true` in `.env`.
|
|
In this mode, protected routes always authenticate as:
|
|
- `sub`: `demo-user-001`
|
|
- `email`: `demo@example.com`
|
|
- `name`: `Demo User`
|
|
|
|
## Forward auth flow (production)
|
|
When `DEV_MODE=false`, deploy this app behind Authentik forward auth.
|
|
The proxy/auth layer must validate authentication and pass identity headers to the app.
|
|
The app reads:
|
|
- `X-Authentik-Uid` (required; fallback `X-Forwarded-User`)
|
|
- `X-Authentik-Email`
|
|
- `X-Authentik-Name` (fallback `X-Forwarded-Preferred-Username`)
|
|
|
|
## Key routes
|
|
- `GET /dashboard`: upload form
|
|
- `GET /skills`: browse listings and buy
|
|
- `GET /my-skills`: purchased skills and copy/download access
|
|
- `POST /api/upload`: upload and list a skill
|
|
- `POST /api/purchase`: buy a skill
|
|
- `GET /api/my-skills`: owned purchased list
|
|
- `GET /uploads/:id`: download unlocked skill file
|