Skip to content

Getting Started

Prerequisites

  • Node.js 20+
  • pnpm 9+
  • PostgreSQL 17 (or Docker)

Quick Start with Docker Compose

bash
# Clone the repository
git clone https://github.com/your-org/pastebox.git
cd pastebox

# Generate a master encryption key
node -e "console.log(require('crypto').randomBytes(32).toString('base64url'))"

# Create .env file
cp .env.example .env
# Edit .env and set MASTER_KEY to the generated value

# Start PostgreSQL
docker compose -f infra/docker-compose.yml up -d

# Install dependencies and build
pnpm install
pnpm build

# Push database schema
pnpm db:push

# Start the API server
pnpm dev

The API will be available at http://localhost:3000.

Deploy with Coolify

  1. Add your private repository in Coolify
  2. Select Docker Compose as the deployment method
  3. Set the compose file path to docker-compose.coolify.yml
  4. Configure environment variables:
VariableRequiredDescription
POSTGRES_PASSWORDYesDatabase password
BASE_URLYesPublic URL (e.g. https://paste.example.com)
MASTER_KEYYes32 bytes, base64url-encoded
TELEGRAM_BOT_TOKENNoTelegram bot token for notifications
TURNSTILE_SECRET_KEYNoCloudflare Turnstile secret
  1. Set the domain for the api service with port: https://paste.example.com:3000
  2. Deploy

Create Your First Paste

bash
# Via API
curl -X POST https://paste.example.com/api/v1/pastes \
  -H "Content-Type: application/json" \
  -d '{"content": "Hello, World!", "syntax": "text"}'

# Via CLI
npx @pastebox/cli config --url https://paste.example.com
echo "Hello, World!" | npx @pastebox/cli create

Self-hosted paste service with E2EE