How 23f2005217/project1-tds-t3-2025 works
Project type and purpose
• This is a backend‐focused microservice (a specialized “LLM-powered deployment” service) rather than a full UI. It exposes a Flask HTTP API that receives build/revise requests, orchestrates LLM code generation, manages GitHub repos, and notifies an evaluation endpoint.
File structure
• Top-level scripts:
• main.py – starts the Flask server and routes requests
• check_config.py – validates environment variables and external credentials
• test_api.py / test_api.sh – automated tests for the HTTP endpoint
• utils/ modules:
• config.py – loads and validates .env settings
• validation.py – request payload checks and secret verification
• code_generator.py – wraps the OpenAI calls to generate app code and README
• github_manager.py – encapsulates GitHub Repo creation, updates, and Pages setup
• api_notifier.py – implements evaluation API callback with retry logic
Key insights from the README
• Core workflow phases: Build (round 1) vs. Revise (round >1)
• External dependencies: OpenAI API, GitHub API, GitHub Pages, evaluation callback URL
• No persistent database—state is tracked via GitHub repos and round numbers
Main components
a. Client (HTTP consumer)
b. Flask API Server (single process)
• Request Handler (handle_request)
• Secret Verifier (verify_secret)
• LLM Code Generator (generate_app_code)
• GitHub Manager (create_or_update_repo)
• README Generator (generate_readme)
• Evaluation Notifier (notify_evaluation_api)
c. External Services
• OpenAI API
• GitHub API & GitHub Pages
• Evaluation Callback URL
Relationships & data flow
• The client sends an HTTP POST to /api-endpoint.
• The server validates the secret, then calls OpenAI to generate code.
• Next it creates (or updates) a GitHub repo and enables Pages.
• It auto-generates a README and pushes to GitHub.
• Finally, it notifies the evaluation endpoint, with retry/backoff on failure.
Architectural patterns & technologies
• Orchestration pattern: single service coordinating multiple external APIs.
• Retry pattern for evaluation callbacks.
• Module separation: API layer vs. business logic (utils) vs. external integrations.
• Key libs: Flask, python-dotenv, openai, PyGithub, requests.