Skip to main content

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