$git clone https://github.com/vivek100/oneShotCodeGenA modular agent-based system for generating and editing app configurations through AI-driven steps organized in flows.
| 1 | # oneShotCodeGen - AI Retool/ERP App Generation |
| 2 | |
| 3 | A modular agent-based system for generating and editing app configurations through AI-driven steps organized in flows. |
| 4 | |
| 5 | ## Overview |
| 6 | |
| 7 | This project provides an advanced AI-powered platform for automatically generating and editing enterprise application configurations through a series of intelligent agent flows. Built with a modular architecture, it leverages OpenAI's APIs and structured generation to produce consistent, high-quality app specifications. |
| 8 | |
| 9 | **Repository: [https://github.com/vivek100/oneShotCodeGen](https://github.com/vivek100/oneShotCodeGen)** |
| 10 | |
| 11 | ## Project Structure |
| 12 | |
| 13 | - **backend/**: Modular FastAPI backend with agent flow system |
| 14 | - **frontend/**: React-based frontend interface with real-time updates |
| 15 | |
| 16 | ## Quick Start |
| 17 | |
| 18 | ### Backend Setup |
| 19 | |
| 20 | 1. Clone the repository: |
| 21 | ```bash |
| 22 | git clone https://github.com/vivek100/oneShotCodeGen.git |
| 23 | cd oneShotCodeGen |
| 24 | ``` |
| 25 | |
| 26 | 2. Set up Python environment: |
| 27 | ```bash |
| 28 | cd backend |
| 29 | python -m venv venv |
| 30 | # On Windows |
| 31 | venv\Scripts\activate |
| 32 | # On macOS/Linux |
| 33 | source venv/bin/activate |
| 34 | ``` |
| 35 | |
| 36 | 3. Install dependencies: |
| 37 | ```bash |
| 38 | pip install -r requirements.txt |
| 39 | ``` |
| 40 | |
| 41 | 4. Create environment file: |
| 42 | ```bash |
| 43 | cp sample.env .env |
| 44 | ``` |
| 45 | |
| 46 | 5. Configure your environment variables in `.env`: |
| 47 | ``` |
| 48 | # API Configuration |
| 49 | HOST=0.0.0.0 |
| 50 | PORT=8000 |
| 51 | |
| 52 | # Database Configuration |
| 53 | DB_URL=sqlite:///./agent.db |
| 54 | |
| 55 | # OpenAI API Configuration |
| 56 | OPENAI_API_KEY=your_openai_api_key_here |
| 57 | OPENAI_MODEL_NAME=gpt-4.1-nano |
| 58 | |
| 59 | # Frontend Configuration (for CORS) |
| 60 | FRONTEND_ORIGIN=http://localhost:3000 |
| 61 | ``` |
| 62 | |
| 63 | 6. Start the backend server: |
| 64 | ```bash |
| 65 | # Development mode with auto-reload |
| 66 | python main.py |
| 67 | # Or using uvicorn directly |
| 68 | uvicorn main:app --host 0.0.0.0 --port 8000 --reload |
| 69 | ``` |
| 70 | |
| 71 | The backend API will be available at `http://localhost:8000`. |
| 72 | |
| 73 | ### Frontend Setup |
| 74 | |
| 75 | 1. Navigate to the frontend directory: |
| 76 | ```bash |
| 77 | cd frontend |
| 78 | ``` |
| 79 | |
| 80 | 2. Install Node.js dependencies: |
| 81 | ```bash |
| 82 | npm install |
| 83 | ``` |
| 84 | |
| 85 | 3. Create environment file: |
| 86 | ```bash |
| 87 | cp .env.example .env.local |
| 88 | ``` |
| 89 | |
| 90 | 4. Configure your environment variables in `.env.local`: |
| 91 | ``` |
| 92 | NEXT_PUBLIC_BACKEND_URL=http://localhost:8000 |
| 93 | ``` |
| 94 | |
| 95 | 5. Start the development server: |
| 96 | ```bash |
| 97 | npm run dev |
| 98 | ``` |
| 99 | |
| 100 | The frontend will be available at `http://localhost:3000`. |
| 101 | |
| 102 | ## Backend Architecture |
| 103 | |
| 104 | The backend is built with a modular architecture focused on managing agent flows and step execution: |
| 105 | |
| 106 | ### Core Modules |
| 107 | |
| 108 | 1. **Agent Router**: Routes user messages to appropriate flows based on the main agent decision. |
| 109 | 2. **Flow Registry**: Manages flow definitions and their steps. |
| 110 | 3. **Flow Runner**: Orchestrates flow execution by running steps in sequence. |
| 111 | 4. **Step Executor**: Executes individual steps (AI or tool calls). |
| 112 | 5. **Tool Call Module**: Executes non-AI operations like entity reorganization, merging, etc. |
| 113 | 6. **Prompt & Schema Store**: Manages prompt templates, schemas, and examples. |
| 114 | 7. **Message Dispatcher**: Handles system messages during flow execution. |
| 115 | 8. **Replay Engine**: Re-runs steps with original or modified inputs for testing and debugging. |
| 116 | 9. **WebSocket Manager**: Provides real-time communication for chat messages and flow status updates. |
| 117 | |
| 118 | ### Flow Types |
| 119 | |
| 120 | - **Main Agent Flow**: Decides what to do with user input |
| 121 | - **Create App Flow**: Generates a complete app configuration |
| 122 | - **Edit Decision Flow**: Decides how to handle edit requests |
| 123 | - **Partial Edit Flow**: Updates specific parts of an app configuration |
| 124 | |
| 125 | ### Database Structure |
| 126 | |
| 127 | The system uses SQLite with the following key tables: |
| 128 | |
| 129 | - **Projects**: Stores project metadata |
| 130 | - **Messages**: Stores chat messages for each project |
| 131 | - **AppVersions**: Stores app configuration versions |
| 132 | - **Flows**: Stores flow definitions |
| 133 | - **Steps**: Stores step definitions within flows |
| 134 | - **FlowRuns**: Tracks executions of flows |
| 135 | - **StepRuns**: Tracks executions of individual steps |
| 136 | - **Prompts**: Stores prompt templates |
| 137 | - **Schemas**: Stores JS |