Skip to main content

Introduction

Bounty is a modern bounty platform built with Next.js, PostgreSQL, and TypeScript. While Bounty is available as a hosted service, you can self-host your own instance for complete control over your data, infrastructure, and deployment strategy.

Why Self-Host?

Control & Privacy
  • Full control over your data and infrastructure
  • Host on your preferred cloud provider or on-premises
  • Comply with data residency requirements
Customization
  • Customize the platform to your specific needs
  • Integrate with your existing systems
  • Extend functionality with custom features
Cost Management
  • Optimize infrastructure costs based on your usage
  • Use existing infrastructure resources
  • No per-user or transaction fees

Prerequisites

Before self-hosting Bounty, ensure you have:
  • Bun v1.2.17 or higher (primary package manager)
  • Node.js v18+ (required for some dependencies)
  • npm/pnpm (alternative package managers, optional)
  • PostgreSQL v14 or higher
  • Recommended: Neon for serverless PostgreSQL
  • Database with SSL support for production
  • At least 1GB storage for initial deployment
The following services are required for full functionality:
  • Better Auth - Authentication (secret key generation)
  • GitHub OAuth - User authentication
  • GitHub App - Repository integration
  • Upstash Redis - Rate limiting and caching
These services enable additional features:
  • Discord - Community integration and webhooks
  • Stripe or Autumn - Payment processing
  • Resend - Transactional emails
  • PostHog - Analytics and feature flags
  • Sentry - Error tracking and monitoring
  • Unkey - API key management
  • Marble CMS - Blog and content management

Architecture Overview

Bounty is built as a monorepo using Turborepo with the following structure:

Application Structure

bounty.new/
├── apps/
│   ├── web/              # Next.js web application
│   └── discord-bot/      # Discord bot (optional)
├── packages/
│   ├── api/              # tRPC API layer
│   ├── auth/             # Better Auth configuration
│   ├── db/               # Drizzle ORM & database schemas
│   ├── email/            # Email templates (Resend)
│   ├── stripe/           # Stripe payment integration
│   ├── ui/               # Shared UI components
│   └── types/            # Shared TypeScript types
└── package.json          # Root workspace configuration

Technology Stack

Frontend

  • Next.js 16 with App Router
  • React 19 with TypeScript
  • TailwindCSS 4.x
  • Radix UI & shadcn/ui components

Backend

  • Next.js API routes
  • tRPC for type-safe APIs
  • Better Auth for authentication
  • Drizzle ORM for database

Database

  • PostgreSQL 14+
  • Drizzle ORM
  • node-postgres (pg) driver
  • SSL support for production

Infrastructure

  • Vercel (recommended)
  • Upstash Redis
  • Neon PostgreSQL
  • GitHub App webhooks

Data Flow

  1. User Authentication
    • GitHub OAuth flow via Better Auth
    • Session management with PostgreSQL
    • Passkey support for passwordless auth
  2. Bounty Management
    • GitHub App integration for repository access
    • Webhook handling for issue synchronization
    • Real-time updates via Upstash Realtime
  3. Payment Processing
    • Stripe Connect for payouts
    • Autumn as alternative payment processor
    • Automated payment tracking

Security Considerations

Important Security Practices
  • Never commit .env files to version control
  • Use strong, randomly generated secrets (minimum 32 characters)
  • Enable SSL/TLS for all production connections
  • Rotate API keys and secrets regularly
  • Use environment-specific credentials (dev, staging, production)
Generate secure secrets using:
openssl rand -base64 32

Deployment Workflow

The typical self-hosting workflow involves:
  1. Environment Setup - Configure all required environment variables
  2. Database Setup - Initialize PostgreSQL and run migrations
  3. Build & Deploy - Build the application and deploy to your platform
  4. Verification - Test authentication, webhooks, and integrations
  5. Monitoring - Set up error tracking and analytics

Next Steps

Environment Variables

Configure all required and optional environment variables

Database Setup

Set up PostgreSQL and run Drizzle migrations

Deployment

Deploy to Vercel or your own infrastructure

Installation

Local development setup and installation

Getting Help

If you encounter issues during self-hosting:
Self-hosting requires technical knowledge of web application deployment, database management, and DevOps practices. If you’re not comfortable with these topics, consider using the hosted version of Bounty.

Build docs developers (and LLMs) love