A pastebin application written in Rust with a frontend built using Yew. It also includes a CLI tool to create pastes.
The project is organized into three main crates:
toothpaste-backend: The Rust backend servertoothpaste-frontend: The Yew-based frontendtoothpaste-cli: The CLI tool to create pastes
-
Set the
DATABASE_URLenvironment variable (e.g.,DATABASE_URL=sqlite://sqlite.db). -
Initialize the database:
touch sqlite.dbcd crates/toothpaste-frontend
# Build the frontend static
# For development
TOOTHPASTE_API_URL=http://127.0.0.1:8080 trunk serve --port 8081
# For production
trunk build --releasetoothpaste-backend --ip 127.0.0.1 --port 8080 # default valuestoothpaste-cli --name toothpaste.txt --expire-after 86400 < your-content.txt # From stdin redirection
cat your-content.txt | toothpaste-cli --name toothpaste.txt --expire-after 86400 # From stdin indirection
toothpaste-cli --expire-after 86400 -f your-content.txt # From file* * * * * wget -q -O /dev/null "http(s)://your_host/api/paste/cleanup"server {
server_name paste.foo.bar;
root /path/to/toothpaste/frontend;
location / {
try_files $uri $uri/ /index.html;
}
location /api/ {
proxy_pass http://127.0.0.1:8081;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
}
}See the LICENSE file for details.