Production-ready improvements: security hardening, Redis sessions, retry logic, updated pricing

Changes:
- Removed hardcoded admin credentials (now requires env vars)
- Added Redis session storage with in-memory fallback
- Improved CORS configuration with warnings for development mode
- Added retry_with_backoff decorator for translation API calls
- Updated pricing: Starter=, Pro=, Business=
- Stripe price IDs now loaded from environment variables
- Added redis to requirements.txt
- Updated .env.example with all new configuration options
- Created COMPREHENSIVE_REVIEW_AND_PLAN.md with deployment roadmap
- Frontend: Updated pricing page, new UI components
This commit is contained in:
2025-12-31 10:43:31 +01:00
parent 721b18dbbd
commit c4d6cae735
27 changed files with 7824 additions and 2181 deletions

View File

@@ -22,8 +22,11 @@ class SubscriptionStatus(str, Enum):
TRIALING = "trialing"
PAUSED = "paused"
import os
# Plan definitions with limits
# NOTE: Stripe price IDs should be set via environment variables in production
# Create products and prices in Stripe Dashboard: https://dashboard.stripe.com/products
PLANS = {
PlanType.FREE: {
"name": "Free",
@@ -46,8 +49,8 @@ PLANS = {
},
PlanType.STARTER: {
"name": "Starter",
"price_monthly": 9,
"price_yearly": 90, # 2 months free
"price_monthly": 12, # Updated pricing
"price_yearly": 120, # 2 months free
"docs_per_month": 50,
"max_pages_per_doc": 50,
"max_file_size_mb": 25,
@@ -61,17 +64,17 @@ PLANS = {
],
"api_access": False,
"priority_processing": False,
"stripe_price_id_monthly": "price_starter_monthly",
"stripe_price_id_yearly": "price_starter_yearly",
"stripe_price_id_monthly": os.getenv("STRIPE_PRICE_STARTER_MONTHLY", ""),
"stripe_price_id_yearly": os.getenv("STRIPE_PRICE_STARTER_YEARLY", ""),
},
PlanType.PRO: {
"name": "Pro",
"price_monthly": 29,
"price_yearly": 290, # 2 months free
"price_monthly": 39, # Updated pricing
"price_yearly": 390, # 2 months free
"docs_per_month": 200,
"max_pages_per_doc": 200,
"max_file_size_mb": 100,
"providers": ["ollama", "google", "deepl", "openai", "libre"],
"providers": ["ollama", "google", "deepl", "openai", "libre", "openrouter"],
"features": [
"200 documents per month",
"Up to 200 pages per document",
@@ -83,17 +86,17 @@ PLANS = {
"api_access": True,
"api_calls_per_month": 1000,
"priority_processing": True,
"stripe_price_id_monthly": "price_pro_monthly",
"stripe_price_id_yearly": "price_pro_yearly",
"stripe_price_id_monthly": os.getenv("STRIPE_PRICE_PRO_MONTHLY", ""),
"stripe_price_id_yearly": os.getenv("STRIPE_PRICE_PRO_YEARLY", ""),
},
PlanType.BUSINESS: {
"name": "Business",
"price_monthly": 79,
"price_yearly": 790, # 2 months free
"price_monthly": 99, # Updated pricing
"price_yearly": 990, # 2 months free
"docs_per_month": 1000,
"max_pages_per_doc": 500,
"max_file_size_mb": 250,
"providers": ["ollama", "google", "deepl", "openai", "libre", "azure"],
"providers": ["ollama", "google", "deepl", "openai", "libre", "openrouter", "azure"],
"features": [
"1000 documents per month",
"Up to 500 pages per document",
@@ -108,8 +111,8 @@ PLANS = {
"api_calls_per_month": -1, # Unlimited
"priority_processing": True,
"team_seats": 5,
"stripe_price_id_monthly": "price_business_monthly",
"stripe_price_id_yearly": "price_business_yearly",
"stripe_price_id_monthly": os.getenv("STRIPE_PRICE_BUSINESS_MONTHLY", ""),
"stripe_price_id_yearly": os.getenv("STRIPE_PRICE_BUSINESS_YEARLY", ""),
},
PlanType.ENTERPRISE: {
"name": "Enterprise",
@@ -118,7 +121,7 @@ PLANS = {
"docs_per_month": -1, # Unlimited
"max_pages_per_doc": -1,
"max_file_size_mb": -1,
"providers": ["ollama", "google", "deepl", "openai", "libre", "azure", "custom"],
"providers": ["ollama", "google", "deepl", "openai", "libre", "openrouter", "azure", "custom"],
"features": [
"Unlimited documents",
"Unlimited pages",