---
name: flask-backend
description: Starts the Flask backend using the local virtual environment.
disable-model-invocation: true
---

# Instructions

1. **Locate Environment:** Check for a virtual environment folder (usually `.venv` or `venv`) inside the `/backend` directory.
2. **Activation Logic:**
   - If on **Windows**: Use `backend\.venv\Scripts\activate`
   - If on **macOS/Linux**: Use `source backend/.venv/bin/activate`
3. **Set Environment Variables:**
   - `FLASK_APP`: `main.py`
   - `FLASK_DEBUG`: `1`
   - `DB_ENV`: `e2e`
   - `DATA_ENV`: `e2e`
   - `SECRET_KEY`: `dev-secret-key-change-in-production`
   - `REFRESH_TOKEN_EXPIRY_DAYS`: `90`
4. **Command:** Execute the following via the `terminal` tool:
   `flask run --host=0.0.0.0 --port=5000 --no-debugger --no-reload`
5. **Execution:** Run `python -m flask run --host=0.0.0.0 --port=5000`
   _Note: Using `python -m flask` ensures the version inside the venv is used._
6. **Verification:** After running, check the terminal output for "Running on http://0.0.0.0:5000". If it fails, check if port 5000 is already in use.
