Developer setup

How to be ready to expand the template to build your unique SaaS.

Environment Variables

All configuration is managed via environment variables. Copy .env.example to .env and configure:

Database

POSTGRES_SERVER=localhost
POSTGRES_PORT=5432
POSTGRES_DB=app
POSTGRES_USER=postgres
POSTGRES_PASSWORD=changethis

Authentication

JWT_SECRET_KEY=your-secret-key-here
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
REFRESH_TOKEN_EXPIRE_DAYS=30

Email Service

EMAIL_SERVICE=fake  # or "resend"
RESEND_API_KEY=     # Required if EMAIL_SERVICE=resend

Stripe

Initial Data

Error Tracking (Optional)

Email Configuration

The application supports two email providers:

Fake Email Service (Development):

  • Set EMAIL_SERVICE=fake

  • Emails are logged to console

  • No external service required

Resend (Production):

  • Set EMAIL_SERVICE=resend

  • Set RESEND_API_KEY=re_...

  • Transactional email delivery

Stripe Configuration

1

Create Stripe Account

  • Sign up at https://stripe.com

  • Get API keys from Stripe Dashboard (Settings → API keys)

  • Use test keys for development (sk_test_... and pk_test_...)

2

Create Products and Prices

For each subscription plan (Basic, Pro, Enterprise), create two prices in Stripe:

Monthly Price:

  • Go to Products → Create Product

  • Set product name (e.g., "Basic Plan")

  • Create a recurring price with "Monthly" billing

  • Note the Price ID (e.g., price_1234monthly)

Annual Price:

  • In the same product, click "Add another price"

  • Create a recurring price with "Yearly" billing

  • Set price (typically 10 months worth for 20% discount)

  • Note the Price ID (e.g., price_1234annual)

Repeat for all plans.

3

Configure Environment Variables

Update .env with your Stripe Price IDs:

Pricing Strategy:

  • Monthly prices are charged per month

  • Annual prices are typically 10 months worth (20% discount)

  • Example: $10/month → $120/year (or $100/year for 20% savings)

4

Configure Webhook Endpoint

Set up webhooks in Stripe Dashboard (Developers → Webhooks):

  • URL: https://yourdomain.com/payments/webhooks/stripe

  • Events to listen for:

    • customer.subscription.created

    • customer.subscription.updated

    • customer.subscription.deleted

    • invoice.payment_succeeded

    • invoice.payment_failed

  • Copy the webhook signing secret to STRIPE_WEBHOOK_SECRET

5

Billing Interval Options

Users can choose between monthly and annual billing:

  • Monthly: Charged every month at the monthly rate

  • Annual: Charged once per year, displayed as monthly equivalent

    • Example: $96/year shown as "$8/month (billed $96 annually)"

  • Users select their preferred interval before subscribing

Development Workflow

Initial Setup

Daily Development

Database Operations

Testing

Code Quality

The project uses:

  • mypy - Static type checking (strict mode)

  • ruff - Fast Python linter and formatter

  • pre-commit - Git hooks for automatic checks

Frontend Development

Docker Commands

Last updated