Skip to content

Latest commit

 

History

History
196 lines (144 loc) · 4.76 KB

File metadata and controls

196 lines (144 loc) · 4.76 KB

Flask Web Interface for A.U.R.O.R.A. Orchestrator

This Flask application provides a web-based dashboard and API for viewing and serving files generated by the A.U.R.O.R.A. (Autonomous User-Responsive Orchestrator for Rapid Application development) orchestrator.

Features

  • Interactive Dashboard: Beautiful web UI showing project statistics, generated files, design system, and message bus
  • Dynamic File Serving: View generated frontend/backend files without writing them to disk
  • RESTful API: JSON endpoints for programmatic access to project state and files
  • Real-time Updates: Displays current project state from aurora_orchestrator

Quick Start

Prerequisites

pip install flask>=3.0.0

Running the Server

python flask_app.py

The server will start on http://localhost:5000 by default.

Environment Variables

  • FLASK_HOST: Host address to bind to (default: 0.0.0.0)
  • FLASK_PORT: Port number to listen on (default: 5000)
  • FLASK_DEBUG: Enable debug mode (default: False)

Example:

FLASK_PORT=8080 FLASK_DEBUG=true python flask_app.py

Endpoints

Web Interface

  • / - Main dashboard with project overview
  • /files/<path> - View individual generated files with syntax highlighting

API Endpoints

  • GET /api/state - Returns the complete PROJECT_STATE as JSON

    {
      "tasks": {...},
      "codebase": {...},
      "design_system": {...},
      "message_bus": [...]
    }
  • GET /api/files - Returns all generated files with their content

    {
      "files": {
        "frontend/src/components/LandingPage.jsx": "...",
        "legal/terms_of_service.md": "..."
      },
      "count": 2
    }
  • POST /api/run-orchestrator - Runs the aurora_orchestrator to generate new files

    {
      "success": true,
      "message": "Orchestrator completed successfully",
      "stats": {
        "completed": 6,
        "files": 2,
        "messages": 6
      }
    }

Integration with Aurora Orchestrator

The Flask app integrates seamlessly with aurora_orchestrator.py:

  1. Imports orchestrator components: Uses PROJECT_STATE, CONFIG, and other orchestrator modules
  2. Automatic initialization: Runs the orchestrator on first launch if no files exist
  3. Dynamic serving: Serves files directly from PROJECT_STATE["codebase"]["files"] dictionary
  4. Live updates: Reflects changes to PROJECT_STATE immediately

Example: Using with Orchestrator

from aurora_orchestrator import AuroraOrchestrator, SimulationSettings
from flask_app import app

# Run orchestrator
settings = SimulationSettings()
orchestrator = AuroraOrchestrator(settings)
orchestrator.generate_initial_tasks()
orchestrator.main_loop()

# Start Flask server
app.run(host='0.0.0.0', port=5000)

Architecture

Components

  1. Dashboard Template: Beautiful, responsive HTML/CSS interface
  2. File Viewer: Syntax-highlighted code viewer for generated files
  3. API Layer: RESTful endpoints for programmatic access
  4. State Integration: Direct access to aurora_orchestrator PROJECT_STATE

Data Flow

aurora_orchestrator.py
    ↓
PROJECT_STATE (in-memory dictionary)
    ↓
flask_app.py (reads PROJECT_STATE)
    ↓
Web Dashboard / API Endpoints

Testing

Run the test suite:

pytest tests/test_flask_integration.py -v

Tests cover:

  • Dashboard rendering
  • API endpoints
  • File viewing
  • Error handling
  • Project state integration

Screenshots

Dashboard

Dashboard

File Viewer

File Viewer

Development

Adding New Routes

@app.route('/your-route')
def your_handler():
    # Access PROJECT_STATE
    data = PROJECT_STATE['codebase']['files']
    return jsonify(data)

Customizing the Dashboard

The dashboard uses inline HTML templates. Modify DASHBOARD_TEMPLATE in flask_app.py to customize the UI.

Security Considerations

⚠️ Development Server Warning: The Flask development server is NOT suitable for production. Use a production WSGI server like Gunicorn or uWSGI.

For production deployment:

pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 flask_app:app

Troubleshooting

Port Already in Use

# Change the port
FLASK_PORT=8080 python flask_app.py

No Files Generated

If the dashboard shows no files, the orchestrator hasn't run yet. Either:

  1. Restart the Flask app (it auto-runs the orchestrator)
  2. Call the /api/run-orchestrator endpoint
  3. Manually run python aurora_orchestrator.py

Import Errors

Ensure aurora_orchestrator.py is in the same directory as flask_app.py.

License

[Same as parent project]