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 devThe API will be available at http://localhost:3000.
Deploy with Coolify
- Add your private repository in Coolify
- Select Docker Compose as the deployment method
- Set the compose file path to
docker-compose.coolify.yml - Configure environment variables:
| Variable | Required | Description |
|---|---|---|
POSTGRES_PASSWORD | Yes | Database password |
BASE_URL | Yes | Public URL (e.g. https://paste.example.com) |
MASTER_KEY | Yes | 32 bytes, base64url-encoded |
TELEGRAM_BOT_TOKEN | No | Telegram bot token for notifications |
TURNSTILE_SECRET_KEY | No | Cloudflare Turnstile secret |
- Set the domain for the
apiservice with port:https://paste.example.com:3000 - 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