The backend service for Scrawn - a usage-based billing platform with gRPC API endpoints for event tracking, authentication, and payment processing.
Scrawn backend provides gRPC services for:
- Event tracking - Register SDK calls and usage events
- Authentication - API key management
- Payment processing - Checkout link generation via Lemon Squeezy
Works with the Scrawn frontend SDK. For detailed API documentation and gRPC endpoint usage, visit the Scrawn Docs.
- Bun (latest version)
- PostgreSQL database
- Lemon Squeezy account (for payment processing)
-
Install dependencies
bun install
-
Configure environment variables
Create a
.env.localfile in the backend directory:DATABASE_URL=postgresql://user:password@localhost:5432/scrawn HMAC_SECRET=your-hmac-secret-key LEMON_SQUEEZY_API_KEY=your-ls-api-key LEMON_SQUEEZY_STORE_ID=your-store-id LEMON_SQUEEZY_VARIANT_ID=your-variant-id LEMON_SQUEEZY_WEBHOOK_SECRET=your-webhook-secret
-
Run database migrations
bunx drizzle-kit push
-
Generate initial API key (optional)
bun run init_key
-
Generate protocol buffers (if needed)
bun run gen
Development mode (with auto-reload):
bun run dev:backendProduction mode:
bun startThe server will start on http://localhost:8069
- gRPC services:
http://localhost:8069(all gRPC endpoints) - Webhook:
http://localhost:8069/webhooks/lemonsqueezy/createdCheckout
For complete gRPC API documentation, endpoint details, and integration guides, check API references..