chore: added docs
deefacbc
3 file(s) · +196 −0
| 1 | + | # Bookmarks |
|
| 2 | + | ||
| 3 | + | Personal link saver organized by category. |
|
| 4 | + | ||
| 5 | + | ## Quickstart |
|
| 6 | + | ||
| 7 | + | 1. Make sure [Rust](https://www.rust-lang.org/tools/install) is installed |
|
| 8 | + | ||
| 9 | + | ```bash |
|
| 10 | + | rustc --version |
|
| 11 | + | ``` |
|
| 12 | + | ||
| 13 | + | 2. Clone and build |
|
| 14 | + | ||
| 15 | + | ```bash |
|
| 16 | + | git clone https://github.com/stevedylandev/andromeda |
|
| 17 | + | cd andromeda |
|
| 18 | + | cargo build -p bookmarks |
|
| 19 | + | ``` |
|
| 20 | + | ||
| 21 | + | 3. Run the dev server |
|
| 22 | + | ||
| 23 | + | ```bash |
|
| 24 | + | cargo run -p bookmarks |
|
| 25 | + | # Server running on http://localhost:3000 |
|
| 26 | + | ``` |
|
| 27 | + | ||
| 28 | + | ### Environment Variables |
|
| 29 | + | ||
| 30 | + | | Variable | Description | Default | |
|
| 31 | + | |---|---|---| |
|
| 32 | + | | `BOOKMARKS_PASSWORD` | Password for the admin panel | — | |
|
| 33 | + | | `BOOKMARKS_API_KEY` | API key for `POST /api/links` (omit to disable write API) | — | |
|
| 34 | + | | `BOOKMARKS_DB_PATH` | SQLite database path | `bookmarks.sqlite` | |
|
| 35 | + | | `HOST` | Bind address | `127.0.0.1` | |
|
| 36 | + | | `PORT` | Bind port | `3000` | |
|
| 37 | + | | `COOKIE_SECURE` | Enable HTTPS-only cookies | `false` | |
|
| 38 | + | ||
| 39 | + | ## Overview |
|
| 40 | + | ||
| 41 | + | Bookmarks is a single-user link saver. Add links via the admin panel or JSON API, organize them into categories, and view them on a public index page grouped by category. A few highlights: |
|
| 42 | + | ||
| 43 | + | - Single Rust binary with embedded assets |
|
| 44 | + | - Local SQLite storage |
|
| 45 | + | - Password-protected admin panel for managing categories and links |
|
| 46 | + | - JSON read API (open) and write API (key-guarded) |
|
| 47 | + | - Dark themed UI with Commit Mono font |
|
| 48 | + | ||
| 49 | + | ## Usage |
|
| 50 | + | ||
| 51 | + | ### Admin Panel |
|
| 52 | + | ||
| 53 | + | Set `BOOKMARKS_PASSWORD` and visit `/login`. From the admin panel you can: |
|
| 54 | + | ||
| 55 | + | - Create and remove categories |
|
| 56 | + | - Add links with title, URL, and category |
|
| 57 | + | - Remove links |
|
| 58 | + | ||
| 59 | + | ### JSON API |
|
| 60 | + | ||
| 61 | + | Read endpoints are open. Write endpoints require `x-api-key: <BOOKMARKS_API_KEY>`. |
|
| 62 | + | ||
| 63 | + | | Method | Path | Auth | Purpose | |
|
| 64 | + | |---|---|---|---| |
|
| 65 | + | | `GET` | `/api/categories` | open | List categories | |
|
| 66 | + | | `GET` | `/api/links` | open | List links grouped by category. Query: `category` to filter by name | |
|
| 67 | + | | `POST` | `/api/links` | api key | Create link. Body: `{category, title, url}` | |
|
| 68 | + | ||
| 69 | + | Example: |
|
| 70 | + | ||
| 71 | + | ```bash |
|
| 72 | + | curl -X POST http://localhost:3000/api/links \ |
|
| 73 | + | -H "x-api-key: $BOOKMARKS_API_KEY" \ |
|
| 74 | + | -H "content-type: application/json" \ |
|
| 75 | + | -d '{"category":"Reading","title":"Example","url":"https://example.com"}' |
|
| 76 | + | ``` |
|
| 77 | + | ||
| 78 | + | ## Structure |
|
| 79 | + | ||
| 80 | + | ``` |
|
| 81 | + | bookmarks/ |
|
| 82 | + | ├── src/ |
|
| 83 | + | │ ├── main.rs # Axum server, admin routes, JSON API, static serving |
|
| 84 | + | │ ├── db.rs # Schema and SQLite queries |
|
| 85 | + | │ └── auth.rs # Session + API-key guards |
|
| 86 | + | ├── templates/ # Askama HTML templates (index, login, admin) |
|
| 87 | + | ├── static/ # Static assets embedded at compile time via rust-embed |
|
| 88 | + | ├── Dockerfile |
|
| 89 | + | └── docker-compose.yml |
|
| 90 | + | ``` |
|
| 91 | + | ||
| 92 | + | ## Deployment |
|
| 93 | + | ||
| 94 | + | Since Bookmarks compiles to a single binary, deployment is straightforward on any platform. |
|
| 95 | + | ||
| 96 | + | ### Docker (recommended) |
|
| 97 | + | ||
| 98 | + | ```bash |
|
| 99 | + | git clone https://github.com/stevedylandev/andromeda |
|
| 100 | + | cd andromeda/apps/bookmarks |
|
| 101 | + | cp .env.example .env |
|
| 102 | + | # Edit .env with your credentials |
|
| 103 | + | docker compose up -d |
|
| 104 | + | ``` |
|
| 105 | + | ||
| 106 | + | Mount a volume at `BOOKMARKS_DB_PATH` to persist the SQLite database. |
|
| 107 | + | ||
| 108 | + | ### Binary |
|
| 109 | + | ||
| 110 | + | ```bash |
|
| 111 | + | cargo build --release -p bookmarks |
|
| 112 | + | ``` |
|
| 113 | + | ||
| 114 | + | The resulting binary at `./target/release/bookmarks` is self-contained with all assets embedded. Copy it to your server with a configured `.env` file and run it directly. |
|
| 115 | + | ||
| 116 | + | ## License |
|
| 117 | + | ||
| 118 | + | [MIT](../../LICENSE) |
| 1 | + | # Bookmarks |
|
| 2 | + | ||
| 3 | + | Bookmarks is a single-user link saver. Add links via the admin panel or JSON API, organize them into categories, and view them on a public index page grouped by category. |
|
| 4 | + | ||
| 5 | + | - Single Rust binary with embedded assets |
|
| 6 | + | - Local SQLite storage |
|
| 7 | + | - Password-protected admin panel for managing categories and links |
|
| 8 | + | - JSON read API (open) and write API (key-guarded) |
|
| 9 | + | - Dark themed UI with Commit Mono font |
|
| 10 | + | ||
| 11 | + | ## Configure |
|
| 12 | + | ||
| 13 | + | ### Environment Variables |
|
| 14 | + | ||
| 15 | + | | Variable | Description | Default | |
|
| 16 | + | |---|---|---| |
|
| 17 | + | | `BOOKMARKS_PASSWORD` | Password for the admin panel | -- | |
|
| 18 | + | | `BOOKMARKS_API_KEY` | API key for `POST /api/links` (omit to disable write API) | -- | |
|
| 19 | + | | `BOOKMARKS_DB_PATH` | SQLite database path | `bookmarks.sqlite` | |
|
| 20 | + | | `HOST` | Bind address | `127.0.0.1` | |
|
| 21 | + | | `PORT` | Bind port | `3000` | |
|
| 22 | + | | `COOKIE_SECURE` | Enable HTTPS-only cookies | `false` | |
|
| 23 | + | ||
| 24 | + | `BOOKMARKS_PASSWORD` is required to access the admin panel. `BOOKMARKS_API_KEY` is only needed if you want to create links from outside the browser. |
|
| 25 | + | ||
| 26 | + | ## Deploy |
|
| 27 | + | ||
| 28 | + | ### Docker |
|
| 29 | + | ||
| 30 | + | ```bash |
|
| 31 | + | cd apps/bookmarks |
|
| 32 | + | cp .env.example .env |
|
| 33 | + | # Edit .env with your credentials |
|
| 34 | + | docker compose up -d |
|
| 35 | + | ``` |
|
| 36 | + | ||
| 37 | + | ### Binary |
|
| 38 | + | ||
| 39 | + | ```bash |
|
| 40 | + | cargo build --release -p bookmarks |
|
| 41 | + | ``` |
|
| 42 | + | ||
| 43 | + | The resulting binary is self-contained with all assets embedded. Copy it to your server with a configured `.env` file and run it directly. |
|
| 44 | + | ||
| 45 | + | ## Use |
|
| 46 | + | ||
| 47 | + | ### Admin Panel |
|
| 48 | + | ||
| 49 | + | Set `BOOKMARKS_PASSWORD` and visit `/login`. From the admin panel you can: |
|
| 50 | + | ||
| 51 | + | - Create and remove categories |
|
| 52 | + | - Add links with title, URL, and category |
|
| 53 | + | - Remove links |
|
| 54 | + | ||
| 55 | + | The public index at `/` shows all links grouped by category. |
|
| 56 | + | ||
| 57 | + | ### JSON API |
|
| 58 | + | ||
| 59 | + | Read endpoints are open. Write endpoints require `x-api-key: <BOOKMARKS_API_KEY>`. |
|
| 60 | + | ||
| 61 | + | | Method | Path | Auth | Purpose | |
|
| 62 | + | |---|---|---|---| |
|
| 63 | + | | `GET` | `/api/categories` | open | List categories | |
|
| 64 | + | | `GET` | `/api/links` | open | List links grouped by category. Query: `category` to filter by name | |
|
| 65 | + | | `POST` | `/api/links` | api key | Create link. Body: `{category, title, url}` | |
|
| 66 | + | ||
| 67 | + | Example: |
|
| 68 | + | ||
| 69 | + | ```bash |
|
| 70 | + | curl -X POST http://localhost:3000/api/links \ |
|
| 71 | + | -H "x-api-key: $BOOKMARKS_API_KEY" \ |
|
| 72 | + | -H "content-type: application/json" \ |
|
| 73 | + | -d '{"category":"Reading","title":"Example","url":"https://example.com"}' |
|
| 74 | + | ``` |
| 41 | 41 | text: 'Apps', |
|
| 42 | 42 | items: [ |
|
| 43 | 43 | { |
|
| 44 | + | text: 'Bookmarks', |
|
| 45 | + | link: '/apps/bookmarks', |
|
| 46 | + | }, |
|
| 47 | + | { |
|
| 44 | 48 | text: 'Cellar', |
|
| 45 | 49 | link: '/apps/cellar', |
|
| 46 | 50 | }, |