Introduction
Author: Leon Schmid
The OpenEU Backend is built using FastAPI and deployed on Render, leveraging a modern Python architecture with comprehensive data collection, AI-powered processing, and robust authentication. The system integrates multiple European parliamentary data sources through automated scrapers and provides intelligent analysis through LLM services.
๐ Core Framework & Runtimeโ
- FastAPI โ Modern, fast web framework for building APIs with automatic OpenAPI documentation.
- Python 3.13 โ Latest Python runtime with enhanced performance and type safety.
- Uvicorn โ Lightning-fast ASGI server implementation.
- Poetry โ Modern dependency management and packaging tool.
๐๏ธ Database & Authenticationโ
- Supabase โ PostgreSQL database with real-time subscriptions, authentication, and API generation.
- PostgreSQL โ Robust relational database with advanced querying capabilities.
- JWT Authentication โ Secure token-based authentication with Supabase integration.
๐ค AI & Machine Learningโ
- OpenAI โ GPT models for intelligent text processing and analysis.
- Cohere โ Enterprise-grade language models for text understanding.
- LangChain โ Framework for developing applications with language models.
๐ท๏ธ Data Collection & Web Scrapingโ
- Scrapy โ Professional web scraping framework for large-scale data extraction.
- Playwright โ Browser automation for dynamic content scraping.
- crawl4ai โ AI-powered web crawling and content extraction.
- BeautifulSoup) โ HTML/XML parsing library.
- Requests โ HTTP library for API integrations.
๐ง Communication & Translationโ
- Brevo โ Transactional email service for notifications and alerts.
- OpenAI Translation โ Custom LLM-powered multilingual translation to English with custom prompt.
- Jinja2 โ Modern templating engine for email and document generation.
โก Performance & Cachingโ
- FastAPI-Cache2 โ High-performance caching with in-memory backend.
- rapidfuzz โ Fast string matching and fuzzy search.
๐ Background Jobs & Schedulingโ
- schedule โ Python job scheduling library for automated tasks.
- Custom JobScheduler โ Enhanced scheduling wrapper with timeout handling and error tracking.
- Background Processing โ Process-based and thread-based execution for different job types.
- For detailed information, see our Scheduling & Jobs documentation.
๐งช Code Quality & Lintingโ
- Ruff โ Extremely fast Python linter and formatter (replaces Black, isort, flake8).
- MyPy โ Static type checker for Python code.
- pre-commit โ Git hooks for automated code quality checks.
- Type Hints โ Comprehensive type annotations for better IDE support and error detection.
๐ณ Deployment & Infrastructureโ
- Render โ Cloud deployment platform with automatic builds and scaling.
- Docker โ Containerization for consistent development and deployment environments.
- GitHub Actions โ Automated CI/CD pipeline for testing and deployment.
- Supabase Branching โ Database preview deployments for feature development.
๐ Security Featuresโ
- JWT Token Validation โ Secure authentication with Supabase
- API Key Protection โ Background job endpoints secured with tokens
- CORS Policy โ Restricted to approved domains (localhost, netlify.app, openeu.csee.tech)
- Environment Isolation โ Development vs. production configuration separation