# Café Bach Email Generator – Project Instructions ## 📖 Project Overview A Flask-based web application that generates beautifully formatted HTML invitation emails for internal events at Café Bach (Aidshilfe). Users fill out a simple form (title, date, location, description, image URL, button link, next event details), and the app renders a clean, minimalist HTML email template matching the provided design. ## 🛠 Tech Stack - **Backend:** Python 3.10+, Flask - **Templating:** Jinja2 (for HTML email generation) - **Frontend:** Vanilla HTML/CSS (minimalist, text-focused layout) - **Image Handling:** URL input (optional) - **Testing:** pytest, Flask-Testing - **CI/CD:** GitHub Actions IMPORTANT INSTRUCTION: THE TERMINAL IS ALREADY IN THE VIRTUAL ENVORIONMENT DO NEVER ATTEMPT TO ACTIVATE OR CREATE A VIRTUAL ENVIRONMENT, IF YOU NEED ANY OF THAT PLEASE ASK! ## 📁 Directory Structure cafe-bach-email-generator/ ├── app/ │ ├── init.py # Flask app factory │ ├── forms.py # WTForms for email generation │ ├── templates/ │ │ ├── base.html # Layout wrapper │ │ ├── generate.html # Main form view │ │ └── preview.html # Rendered email preview │ └── static/ │ ├── css/ │ │ └── style.css # Minimalist styling │ └── js/ │ └── main.js # Form handling & preview logic ├── tests/ │ ├── test_app.py │ └── test_forms.py ├── .github/ │ └── workflows/ │ └── ci-cd.yml # GitHub Actions pipeline ├── .env.example # Environment variables template ├── requirements.txt # Python dependencies ├── instructions.md # This file └── README.md # Project documerntation ## ✅ Task List & Roadmap ### Phase 1: Core Setup & Form UI - [x] Initialize Flask app with app factory pattern - [x] Create HTML form with fields: title, date/time, location, description, image URL (optional), button text, button URL, next event text, next event URL - [x] Implement minimalist CSS matching the provided template style - [x] Add client-side validation & preview toggle ### Phase 2: Backend Generation Logic - [ ] Build Jinja2 email template matching `termplate.html` structure - [ ] Connect form data to template placeholders - [ ] Implement email preview generation endpoint (`/preview`) - [ ] Add copy-to-clipboard functionality for generated HTML ### Phase 3: Enhancements & UX - [ ] Add image upload/URL validation - [ ] Implement responsive preview viewer - [ ] Add PDF export option (optional) - [ ] Cache frequently used templates (optional) ### Phase 4: Testing & Documentation - [x] Write unit tests for form validation & template rendering - [x] Add integration tests for preview endpoint - [x] Document API endpoints & setup steps in `README.md` - [x] Perform accessibility & contrast checks (ADHD-friendly design) ## 🔄 CI/CD Pipeline (GitHub Actions) ### Workflow: `.github/workflows/ci-cd.yml` 1. **Trigger:** Push to `main` or `develop`, or pull requests 2. **Environment:** Python 3.10+ on Ubuntu latest 3. **Steps:** - Checkout repository - Set up Python environment - Install dependencies (`requirements.txt`) - Run linting (flake8, black, isort) - Execute tests (`pytest --cov=app`) - Build & deploy to staging (optional) - Notify via Slack/Discord on success/failure ### Key Configuration: ```yaml name: CI/CD Pipeline on: push: branches: [main, develop] pull_request: branches: [main] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python 3.10 uses: actions/setup-python@v4 with: python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - name: Lint with flake8 run: | pip install flake8 flake8 app/ --count --select=E9,F63,F7,F82 --show-source --statistics - name: Run tests with pytest run: | pip install pytest pytest-cov pytest --cov=app --cov-report=xml