# 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 ```bash # 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 API # Frontend (http://127.0.0.1:3000) cd clients pnpm install && pnpm dev # Install deps & start dev server # Tests uv run task test # Backend tests pnpm test # Frontend tests ``` ## Documentation - **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 commands ``` ## Core 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 ```bash ./dev/setup-environment # Generate .env files # For GitHub integration ./dev/setup-environment --setup-github-app --backend-external-url https://yourdomain.ngrok.dev ``` For 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

Polar - An open source monetization platform for developers | Product Hunt Polar - An open source monetization platform for developers | Product Hunt

Website   •   Docs   •   API Reference

Discord Chat Follow @polar_sh


## 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](https://polar.sh/docs/documentation/polar-as-merchant-of-record/fees) ## Roadmap, Issues & Feature Requests **🎯 Upcoming milestones.** [Check out what we're building towards](https://github.com/polarsource/polar/issues/3242) **💬 Shape the future of Polar with us.** [Join our Discord](https://discord.gg/Pnhfz3UThd) **🐛 Found a bug?** [Submit it here](https://github.com/polarsource/polar/issues) **🔓 Found a security vulnerability?** We greatly appreciate responsible and private disclosures. See [Security](./SECURITY.md) ### Polar API & SDK You can integrate Polar on your docs, sites or services using our [Public API](https://polar.sh/docs/api-reference) and [Webhook API](https://polar.sh/docs/integrate/webhooks/endpoints). We also maintain SDKs for the following languages: - JavaScript (Node.js and browsers): [polarsource/polar-js](https://github.com/polarsource/polar-js) - Python: [polarsource/polar-python](https://github.com/polarsource/polar-python) ## Contributions Our [`DEVELOPMENT.md`](./DEVELOPMENT.md) file contains everything you need to know to configure your development environment. > [!TIP] > Want to get started quickly? Use GitHub Codespaces. > > [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/polarsource/polar?machine=standardLinux32gb) ### Contributors ♥️🙏 To our `pyproject.toml` friends: [FastAPI](https://github.com/tiangolo/fastapi), [Pydantic](https://github.com/pydantic/pydantic), [Dramatiq](https://github.com/Bogdanp/dramatiq), [SQLAlchemy](https://github.com/sqlalchemy/sqlalchemy), [Githubkit](https://github.com/yanyongyu/githubkit), [sse-starlette](https://github.com/sysid/sse-starlette), [Uvicorn](https://github.com/encode/uvicorn), [httpx-oauth](https://github.com/frankie567/httpx-oauth), [jinja](https://github.com/pallets/jinja), [blinker](https://github.com/pallets-eco/blinker), [pyjwt](https://github.com/jpadilla/pyjwt), [Sentry](https://github.com/getsentry/sentry) + more
♥️🙏 To our `package.json` friends: [Next.js](https://github.com/vercel/next.js/), [TanStack Query](https://github.com/TanStack/query), [tailwindcss](https://github.com/tailwindlabs/tailwindcss), [openapi-typescript-codegen](https://github.com/ferdikoomen/openapi-typescript-codegen), [axios](https://github.com/axios/axios), [radix-ui](https://github.com/radix-ui/primitives), [cmdk](https://github.com/pacocoursey/cmdk), [framer-motion](https://github.com/framer/motion) + more
♥️🙏 To [IPinfo](https://ipinfo.io) that provides IP address data to help us geolocate customers during checkout. ## License Licensed under [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).