How valantoni/full-stack-python-template works
Project Type and Purpose
• This is a full-stack Python application built with Streamlit for the UI layer and Auth0 for authentication.
• It exposes a single entrypoint (app.py) that renders dashboards and runs reporting tools, and it integrates with Auth0 (an external Identity Provider) and an SMTP/email module.
File Structure
• Top Level
• app.py – the Streamlit UI entrypoint, orchestrates page routing and calls into business modules.
• send_email.py – wrapper to send alerts via SMTP or an email service.
• requirements.txt – dependency manifest.
• .streamlit/config.toml, .streamlit/secrets.toml – Streamlit config and Auth0 credentials.
• assets/ – static resources (images, CSS, etc.).
• Business Logic Packages
• reports/ – modules implementing different report pages (alerts.py, bugs.py, dashboard.py).
• tools/ – utility functions (history.py, search.py).
README for Additional Insights
• The README confirms a Streamlit-first approach with Auth0 as the only external auth dependency.
• No database is mentioned—state is in-memory or via external APIs.
• An “email alerts” feature is present via send_email.py.
Main Components
a. User Interface (Streamlit App)
• Node: app.py + assets/
• Responsibilities: render pages, handle routing, capture user interactions.
b. Business Logic Layer
• Node: reports/ (alerts, bugs, dashboard) and tools/ (history, search)
• Responsibilities: compute reports, search history, perform data transformations.
c. Authentication Service (Auth0)
• External service node
• Responsibilities: handle login, token issuance, session management.
d. Email Service
• Node: send_email.py
• Responsibilities: format and send alert emails to users.
Relationships and Data Flows
• User → Streamlit UI: HTTP requests (clicks, form submissions).
• Streamlit UI → Auth0: OAuth2/OpenID Connect redirects for login/auth.
• Post‐login User → Streamlit UI (authorized session).
• Streamlit UI → Business Logic: function calls into reports/ and tools/.
• Business Logic → Email Service: function call inside alerts report to send notifications.
• Optionally, Business Logic could call external APIs or databases (not present here).
Architectural Patterns and Principles
• Separation of Concerns: UI is isolated in app.py, business logic in reports/ and tools/, cross‐cutting email logic in send_email.py.
• Layered Architecture:
• Presentation Layer (Streamlit)
• Application Layer (routing & orchestration)
• Domain/Business Layer (reports and tools modules)
• Infrastructure Layer (Auth0, email service)
• Externalized Configuration via .streamlit/secrets.toml for credentials, keeping code stateless.
Detail Without Over-Engineering
• Every module (alerts.py, bugs.py, history.py, etc.) as sub-components of the Business Logic layer.
• .streamlit/secrets.toml as the configuration source for Auth0 credentials.