Repository: polarsource/polar
Stars: 9656
CLAUDE.md
Polar
Open source payment infrastructure platform for developers. Monorepo with Python/FastAPI backend and Next.js frontend.
Quick Start
Backend (http://127.0.0.1:8000)
cd server
docker compose up -d # Start PostgreSQL, Redis, Minio
uv sync && uv run task api # Install deps & start APIFrontend (http://127.0.0.1:3000)
cd clients
pnpm install && pnpm dev # Install deps & start dev serverTests
uv run task test # Backend tests
pnpm test # Frontend testsDocumentation
- Handbook: https://handbook.polar.sh/engineering/
- Design docs: https://handbook.polar.sh/engineering/design-documents/
- API guidelines: https://handbook.polar.sh/engineering/rest-api-guidelines
Custom Commands
- /polar-code-review - Comprehensive code review with 3 parallel agents (security, conventions, simplification)
Architecture
polar/
├── server/polar/ # Backend modules (see server/CLAUDE.md)
│ ├── {module}/
│ │ ├── endpoints.py # FastAPI routes
│ │ ├── service.py # Business logic
│ │ ├── repository.py # Database queries
│ │ ├── schemas.py # Pydantic models
│ │ └── tasks.py # Background jobs
│ └── backoffice/ # Admin UI (see server/polar/backoffice/CLAUDE.md)
├── clients/ # Frontend (see clients/CLAUDE.md)
│ ├── apps/web/ # Next.js dashboard
│ └── packages/ui/ # Shared components
└── .claude/ # Claude Code configuration
├── settings.json # Hooks configuration
├── hooks/ # Pattern enforcement
└── commands/ # Custom commandsCore Rules
See subdirectory CLAUDE.md files for detailed patterns:
- server/CLAUDE.md - Backend patterns
- server/polar/backoffice/CLAUDE.md - HTMX + DaisyUI patterns
- clients/CLAUDE.md - Frontend design system
Environment Setup
./dev/setup-environment # Generate .env filesFor GitHub integration
./dev/setup-environment --setup-github-app --backend-external-url https://yourdomain.ngrok.devFor Stripe, add to server/.env:
- STRIPE_SECRET_KEY
- STRIPE_PUBLISHABLE_KEY
- STRIPE_WEBHOOK_SECRET
Key Integrations
- Stripe: Payment processing
- GitHub: Authentication and repository features
- S3/Minio: File storage
- Redis: Cache and job queue
- PostgreSQL: Primary database
README.md
<p align="center">
<a href="https://polar.sh">
<img src="https://github.com/user-attachments/assets/89a588e5-0c58-429a-8bbe-20f70af41372" />
</a>
</p>
<div align="center">
<a href="https://www.producthunt.com/posts/polar-5?embed=true&utm_source=badge-top-post-badge&utm_medium=badge&utm_souce=badge-polar-5" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-badge.svg?post_id=484271&theme=dark&period=daily" alt="Polar - An open source monetization platform for developers | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a> <a href="https://www.producthunt.com/posts/polar-5?embed=true&utm_source=badge-top-post-topic-badge&utm_medium=badge&utm_souce=badge-polar-5" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-topic-badge.svg?post_id=484271&theme=dark&period=monthly&topic_id=267" alt="Polar - An open source monetization platform for developers | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
</div>
<hr />
<div align="center">
<a href="https://polar.sh">Website</a>
<span> • </span>
<a href="https://polar.sh/docs">Docs</a>
<span> • </span>
<a href="https://polar.sh/docs/api-reference">API Reference</a>
<p align="center">
<a href="https://discord.gg/Pnhfz3UThd">
<img src="https://img.shields.io/badge/chat-on%20discord-7289DA.svg" alt="Discord Chat" />
</a>
<a href="https://twitter.com/intent/follow?screen_name=polar_sh">
<img src="https://img.shields.io/twitter/follow/polar_sh.svg?label=Follow%20@polar_sh" alt="Follow @polar_sh" />
</a>
</p>
</div>
<hr />
Polar: Open Source payments infrastructure for the 21st century
Focus on building your passion, while we focus on the infrastructure to get you paid.
- Sell SaaS and digital products in minutes
- All-in-one funding & monetization platform for developers.
- Sell access to GitHub repositories, Discord Support channels, File Downloads, License Keys & much more with Digital Products & Subscriptions.
- We're the merchant of record handling the...
- ...boilerplate (billing, receipts, customer accounts etc)
- ...headaches (sales tax, VAT)
Pricing
- 4% + 40¢
- No fixed monthly costs
- Additional fees may apply. Read more
Roadmap, Issues & Feature Requests
🎯 Upcoming milestones. Check out what we're building towards
💬 Shape the future of Polar with us. Join our Discord
🐛 Found a bug? Submit it here
🔓 Found a security vulnerability? We greatly appreciate responsible and private disclosures. See Security
Polar API & SDK
You can integrate Polar on your docs, sites or services using our Public API and Webhook API.
We also maintain SDKs for the following languages:
- JavaScript (Node.js and browsers): polarsource/polar-js
- Python: polarsource/polar-python
Contributions
Our DEVELOPMENT.md file contains everything you need to know to configure your development environment.
Want to get started quickly? Use GitHub Codespaces.
> 
Contributors
<a href="https://github.com/polarsource/polar/graphs/contributors">
<img src="https://contrib.rocks/image?repo=polarsource/polar" />
</a>
<sub>♥️🙏 To our pyproject.toml friends: FastAPI, Pydantic, Dramatiq, SQLAlchemy, Githubkit, sse-starlette, Uvicorn, httpx-oauth, jinja, blinker, pyjwt, Sentry + more</sub><br />
<sub>♥️🙏 To our package.json friends: Next.js, TanStack Query, tailwindcss, openapi-typescript-codegen, axios, radix-ui, cmdk, framer-motion + more</sub><br />
<sub>♥️🙏 To IPinfo that provides IP address data to help us geolocate customers during checkout.</sub>
License
Licensed under Apache License, Version 2.0.