this is a minimal pastebin I designed for Wentworth Institute of Technology's Coding Club
- Random IDs or custom slugs
- Syntax highlighting via highlight.js
- Basic auth for creating pastes
- Web form at
/new - SQLite storage
- Single binary via Bun
- No expiration
# Install deps
bun install
# Run locally
AUTH_USERNAME=admin AUTH_PASSWORD=secret bun run devThen visit http://localhost:3000/new to create your first paste.
Add to your flake inputs:
{
inputs.strings.url = "github:jaspermayone/strings";
}Then in your configuration:
{ inputs, ... }:
{
imports = [ inputs.strings.nixosModules.default ];
services.strings = {
enable = true;
port = 3000;
username = "admin";
passwordFile = "/run/secrets/strings-password"; # use sops-nix or agenix
baseUrl = "https://strings.witcc.dev";
};
# Reverse proxy with nginx
services.nginx.virtualHosts."strings.witcc.dev" = {
enableACME = true;
forceSSL = true;
locations."/".proxyPass = "http://127.0.0.1:3000";
};
}# Plain text with random ID
curl -u admin:secret -X POST https://strings.witcc.dev/api/paste \
-H "X-Filename: example.py" \
-d 'print("hello")'
# With custom slug
curl -u admin:secret -X POST https://strings.witcc.dev/api/paste \
-H "Content-Type: application/json" \
-d '{"content": "print(1)", "filename": "test.py", "slug": "my-snippet"}'
# Pipe a file
cat myfile.rs | curl -u admin:secret -X POST https://strings.witcc.dev/api/paste \
-H "X-Filename: myfile.rs" \
--data-binary @-Response:
{
"id": "aBc123xy",
"url": "https://strings.witcc.dev/aBc123xy",
"raw": "https://strings.witcc.dev/aBc123xy/raw"
}GET /{id} # HTML with syntax highlighting
GET /{id}/raw # Plain text
curl -u admin:secret -X DELETE https://strings.witcc.dev/aBc123xy/- Home page with API docs/new- Create paste form (requires auth)
Install the CLI:
# With Nix
nix profile install .#cli
# Or just copy the script
cp cli/strings ~/.local/bin/
chmod +x ~/.local/bin/stringsUsage:
export STRINGS_HOST="https://strings.witcc.dev"
export STRINGS_USER="admin"
export STRINGS_PASS="secret"
# Paste a file
strings myfile.py
# With custom slug
strings myfile.py --slug my-snippet
# Pipe content
echo "hello world" | strings
# From clipboard (macOS)
pbpaste | strings| Variable | Default | Description |
|---|---|---|
PORT |
3000 |
HTTP port |
AUTH_USERNAME |
admin |
Basic auth username |
AUTH_PASSWORD |
changeme |
Basic auth password |
AUTH_PASSWORD_FILE |
- | Read password from file |
DB_PATH |
./strings.db |
SQLite database path |
BASE_URL |
http://localhost:3000 |
Public URL (for response) |
See license.md file.