README.md 6.3 K raw
1
# Sipp
2
3
Minimal code sharing
4
5
>[!NOTE]
6
>Sipp is now part of [Andromeda](https://github.com/stevedylandev/andromeda)
7
8
https://github.com/user-attachments/assets/cadafb70-f796-456d-bfd9-e88704e7132c
9
10
## Features
11
12
- Single binary for web server and TUI
13
- Create snippets and share on the web
14
- Raw output for CLI tools — `curl`, `wget`, and `httpie` get plain text automatically
15
- Interactive TUI with authenticated access for snippet management
16
- Minimal, fast, and low memory consumption
17
18
## Quickstart
19
20
**1. Install**
21
22
Install via the [releases](https://github.com/stevedylandev/sipp/releases) page, or directly with `cargo`
23
24
```bash
25
cargo install sipp-so
26
```
27
28
To confirm it was installed correctly run the following
29
30
```bash
31
sipp --help
32
```
33
34
**2. Start Server**
35
36
For demo purposes you can run this locally, but ideally this would be run in a deployment server with a proper ENV setup with your admin key.
37
38
```bash
39
sipp server --port 3000
40
```
41
42
**3. Create a Snippet**
43
44
You can either open up `http://localhost:3000` and create a snippet in a web browser, or use the TUI. In the same directory, open a new terminal window and use 
45
46
```bash
47
# Path to file
48
sipp path/to/file.rs
49
50
# Or use the interactive tui 
51
sipp
52
```
53
54
## Demo Instance
55
56
A small instance running at [sipp.so](https://sipp.so) that can be used for testing and demo purposes.
57
58
```bash
59
sipp -r https://sipp.so
60
```
61
62
>[!WARNING]
63
>All snippets created here are public and might be deleted at any time; host your own instance with your own API key for personal use!
64
65
## Install
66
67
Sipp can be installed several ways
68
69
### Releases
70
71
Visit the [releases](https://github.com/stevedylandev/sipp/releases) page and install through cURL script and other methods.
72
73
### Homebrew
74
75
```
76
brew install stevedylandev/tap/sipp-so
77
```
78
79
### Cargo
80
81
```bash
82
cargo install sipp-so
83
```
84
85
## Usage
86
87
### CLI
88
89
```
90
sipp [OPTIONS] [FILE] [COMMAND]
91
```
92
93
#### Commands
94
95
| Command | Description |
96
|---|---|
97
| `server` | Start the web server |
98
| `tui` | Launch the interactive TUI |
99
| `auth` | Save remote URL and API key to config file |
100
101
#### Arguments
102
103
| Argument | Description |
104
|---|---|
105
| `[FILE]` | File path to create a snippet from |
106
107
#### Options
108
109
| Option | Description |
110
|---|---|
111
| `-r, --remote <URL>` | Remote server URL (e.g. `http://localhost:3000`) (env: `SIPP_REMOTE_URL`) |
112
| `-k, --api-key <KEY>` | API key for authenticated operations (env: `SIPP_API_KEY`) |
113
114
### Server
115
116
Sipp includes a built-in web server powered by Axum. Start it with:
117
118
```bash
119
sipp server --port 3000 --host localhost
120
```
121
122
#### Environment Variables
123
124
| Variable | Description |
125
|---|---|
126
| `SIPP_API_KEY` | API key for protecting endpoints |
127
| `SIPP_AUTH_ENDPOINTS` | Comma-separated list of endpoints requiring auth: `api_list`, `api_create`, `api_get`, `api_delete`, `all`, or `none` (defaults to `api_delete,api_list`) |
128
| `SIPP_MAX_CONTENT_SIZE` | Maximum snippet content size in bytes (defaults to `512000` / 500 KB) |
129
| `SIPP_DB_PATH` | Custom path for the SQLite database file (defaults to `sipp.sqlite` in the working directory) |
130
131
The server stores snippets in a local `sipp.sqlite` SQLite database.
132
133
#### API Endpoints
134
135
| Method | Endpoint | Description |
136
|---|---|---|
137
| `GET` | `/api/snippets` | List all snippets |
138
| `POST` | `/api/snippets` | Create a snippet (`{"name": "...", "content": "..."}`) |
139
| `GET` | `/api/snippets/{short_id}` | Get a snippet by ID |
140
| `PUT` | `/api/snippets/{short_id}` | Update a snippet (`{"name": "...", "content": "..."}`) |
141
| `DELETE` | `/api/snippets/{short_id}` | Delete a snippet by ID |
142
143
Authenticated endpoints require an `x-api-key` header.
144
145
#### Raw Output for CLI Tools
146
147
When you access a snippet URL (`/s/{short_id}`) with `curl`, `wget`, or `httpie`, the server returns the raw content as plain text instead of HTML:
148
149
```bash
150
curl https://sipp.so/s/abc123
151
```
152
153
### TUI
154
155
The Sipp TUI makes it easy to create, copy, share, and manage your snippets either locally or remotely. Launch it with:
156
157
```bash
158
# Launch TUI (default behavior when no file argument is given)
159
sipp
160
161
# Or explicitly
162
sipp tui
163
164
# With remote options
165
sipp -r https://sipp.so -k your-api-key
166
```
167
168
#### Local Access
169
170
If you are running `sipp` in the same directory as the `sipp.sqlite` file created by the server instance, the TUI will automatically access the datebase locally and you can edit it directly.
171
172
#### Remote Access
173
174
To access a remote instance of Sipp make sure to do the following:
175
- Set the `SIPP_API_KEY` variable in your server instance
176
- Run `sipp auth` to enter in your server instance URL and the API key, which will be stored under `$HOME/.config/sipp`. You can also set these with the ENV variables `SIPP_REMOTE_URL` and `SIPP_API_KEY`
177
178
>[!NOTE]
179
>You can try a limited remote instance without an API key with `sipp -r https://sipp.so`
180
181
#### Actions
182
183
While inside the TUI the following actions are available
184
185
| Key | Action |
186
|---|---|
187
| `j`/`↓` | Move down / Scroll down |
188
| `k`/`↑` | Move up / Scroll up |
189
| `Enter` | Focus content pane |
190
| `Esc` | Back / Quit |
191
| `y` | Copy snippet content |
192
| `Y` | Copy snippet link |
193
| `o` | Open in browser |
194
| `e` | Edit snippet |
195
| `d` | Delete snippet |
196
| `c` | Create snippet |
197
| `/` | Search snippets |
198
| `r` | Refresh snippets (remote only) |
199
| `q` | Quit |
200
| `?` | Toggle help |
201
202
## Deployment
203
204
Since Sipp is a single binary it can be run in virtually any enviornment.
205
206
### Systemd
207
208
Create a service file at `/etc/systemd/system/sipp.service`:
209
210
```ini
211
[Unit]
212
Description=Sipp snippet server
213
After=network.target
214
215
[Service]
216
ExecStart=/usr/local/bin/sipp server --port 3000 --host 0.0.0.0
217
Environment=SIPP_API_KEY=your-secret-key
218
WorkingDirectory=/var/lib/sipp
219
Restart=on-failure
220
221
[Install]
222
WantedBy=multi-user.target
223
```
224
225
```bash
226
sudo systemctl enable --now sipp
227
```
228
229
### Docker
230
231
A `Dockerfile` and `docker-compose.yml` are included in the repository.
232
233
```bash
234
# Using Docker Compose (recommended)
235
SIPP_API_KEY=your-secret-key docker compose up -d
236
237
# Or build and run manually
238
docker build -t sipp .
239
docker run -p 3000:3000 -e SIPP_API_KEY=your-secret-key -v sipp-data:/data sipp
240
```
241
242
### Railway
243
244
1. Fork this repo and connect your fork to [Railway](https://railway.app)
245
2. Set the environment variables `SIPP_API_KEY` and optionally `SIPP_AUTH_ENDPOINTS`
246
3. Add a [volume](https://docs.railway.com/guides/volumes) to your service and mount it at `/data`
247
4. Set `SIPP_DB_PATH` to `/data/sipp.sqlite` so the database persists across deploys