ShiftPaste is a flexible backend solution for creating, managing, and sharing editable snippets.
With a primary emphasis on content updates, ShiftPaste provides users with persistent links that allow the associated data to be modified without breaking the original link.
This dynamic approach ensures that snippets remain accessible even as their content evolves.
ShiftPaste also supports QR code generation for seamless sharing and retrieval, making it an ideal choice for anyone needing a robust, adaptable snippet storage service.
# Build ShiftPaste
docker build -t shiftpaste .
# Configure PostgreSQL (user: postgres, db: postgres)
docker run --name shiftpaste-postgres -p 5432:5432 -e POSTGRES_DB="shiftpaste" -e POSTGRES_HOST_AUTH_METHOD="trust" -d postgres
# Apply DB Migrations (requires SQLX CLI)
DATABASE_URL="postgres://postgres@localhost:5432/shiftpaste" sqlx migrate run
# Run ShiftPaste
docker run --name=shiftpaste -p 4000:4000 -e DATABASE_URL="postgres://[email protected]:5432/shiftpaste" -e API_BASE_URL="http://localhost:4000" -d shiftpaste
# Navigate to Swagger UI (on Linux)
xdg-open "http://localhost:4000/swagger/"
Variable | Description | Required | Default | Example |
---|---|---|---|---|
DATABASE_URL |
The connection string URL for your PostgreSQL database. | True |
β | postgres://localhost:5432/db |
API_PORT |
The port to be used by the HTTP server. | False |
4000 |
8080 |
API_BASE_URL |
A public URL pointing to the backend API's root path. | True |
β | https://foo.bar.baz/api |
APP_SNIPPET_VIEW_URL |
A public URL pointing to the frontend app's snippet preview page. May be used to customize snippet redirections. Frontend app is expected to handle GET requests at $APP_SNIPPET_VIEW_URL/:snippet_id . |
False |
$API_BASE_URL/snippets |
https://foo.bar.baz/snippets |
RUST_LOG |
Specifies the desired logging level. Refer to the env_logger documentation for details. |
False |
error |
info |
The following section assumes your environment contains an installation of the Rust development toolchain.
# Prepare Git Hooks
lefthook install
# Install the SQLX CLI
cargo install sqlx-cli --no-default-features --features postgres
# Apply DB Migrations
DATABASE_URL="postgres://postgres@localhost:5432/shiftpaste" sqlx migrate run
# Build ShiftPaste
cargo build
# Run ShiftPaste
DATABASE_URL="postgres://postgres@localhost:5432/shiftpaste" API_BASE_URL="http://localhost:4000" cargo run
# Navigate to Swagger UI (on Linux)
xdg-open "http://localhost:4000/swagger/"