Padelnomics
Plan, finance, and build your padel business
Quick Start
# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install dependencies
uv sync
# Copy environment file
cp .env.example .env
# Edit .env with your settings
# Initialize database
uv run python -m padelnomics.migrations.migrate
# Run the app
uv run python -m padelnomics.app
# In another terminal, run the worker
uv run python -m padelnomics.worker
Visit http://localhost:5000
Configuration
Copy .env.example to .env and configure:
# Required
SECRET_KEY=generate-a-real-secret-key
RESEND_API_KEY=re_xxxx
# Stripe (required for billing)
STRIPE_SECRET_KEY=sk_test_xxxx
STRIPE_PUBLISHABLE_KEY=pk_test_xxxx
STRIPE_WEBHOOK_SECRET=whsec_xxxx
STRIPE_PRICE_STARTER=price_xxxx
STRIPE_PRICE_PRO=price_xxxx
Development
# Run with auto-reload
uv run python -m padelnomics.app
# Run worker
uv run python -m padelnomics.worker
# Run tests
uv run pytest
Project Structure
src/padelnomics/
app.py # Application factory, blueprints
core.py # DB, config, email, middleware
worker.py # Background task processor
auth/ # Authentication domain
routes.py # Login, signup, magic links
templates/
billing/ # Billing domain
routes.py # Checkout, webhooks, subscriptions
templates/
dashboard/ # User dashboard domain
routes.py # Settings, API keys, search
templates/
public/ # Marketing pages domain
routes.py # Landing, pricing, terms
templates/
api/ # REST API domain
routes.py # API endpoints, rate limiting
templates/ # Shared templates
base.html
components/
email/
migrations/
schema.sql
migrate.py
Deployment
Docker (recommended)
# Build and run
docker compose up -d
# View logs
docker compose logs -f
Manual
# Install dependencies
uv sync --frozen
# Run migrations
uv run python -m padelnomics.migrations.migrate
# Run with hypercorn
uv run hypercorn padelnomics.app:app --bind 0.0.0.0:5000
Stripe Setup
- Create products/prices in Stripe Dashboard
- Add price IDs to
.env - Set up webhook endpoint:
https://yourdomain.com/billing/webhook/stripe - Enable events:
checkout.session.completed,customer.subscription.updated,customer.subscription.deleted
Litestream Backups
Configure litestream.yml with your S3/R2 bucket, then:
# Run with replication
litestream replicate -config litestream.yml