From uploaded HTML documentation to structured API specs, editable test code, and contextual Q&A.
English · 한국어
Project · Tech Stack · Architecture · Workflow · Technical Decisions · Screenshots
Client project. Under the project agreement, client materials and source code cannot be made public.
| Category | Details |
|---|---|
| Period | July – September 2025 |
| Project type | Client project |
| Role | Full-stack developer |
| Responsibilities | HTML preprocessing, AI-assisted specification extraction and code generation, multi-language execution, session-based Q&A, and frontend integration |
| Supported languages | Python, JavaScript, Java, and Go |
| Area | Technologies |
|---|---|
| Backend | Python, FastAPI, Pydantic |
| AI | OpenAI API |
| Frontend | JavaScript, React, Vite, React Router |
API documentation differs widely between providers. Developers often have to locate request parameters manually, understand authentication and response formats, and then write separate test code for each language.
The project aimed to combine those steps into one workflow. The initially planned Replit embed did not satisfy the required interaction and execution flow, so an in-app alternative was needed for editing generated code and reviewing execution results.
- Removed scripts, styles, HTML tags, and unnecessary whitespace before AI analysis.
- Converted the cleaned documentation into a consistent JSON structure for request and response headers and body fields.
- Generated editable, runnable API test-code for Python, JavaScript, Java, and Go.
- Used both the structured analysis and cleaned source text during generation to reduce missing API details.
- Built an in-app code workspace that executes completed code through language-specific server commands and returns output and errors.
- Stored generated code and Q&A history by session, then included previous context into follow-up prompts.
- Implemented the client-provided Figma design and extended additional screens while preserving its visual direction.
- Adapted the product through frequent client meetings and design review cycles.
%%{init: {"themeVariables": {"fontSize": "16px"}, "flowchart": {"curve": "linear", "nodeSpacing": 45, "rankSpacing": 55}}}%%
flowchart TB
User["User"]:::person
subgraph Browser["Browser"]
WebApp["Web UI<br/>React + Vite<br/>Collects user input<br/>Displays specs, code and results"]:::app
end
subgraph ApplicationServer["Application server"]
direction TB
API["Backend API<br/>Python + FastAPI<br/>Cleans documents · manages sessions<br/>Calls AI · starts code runs"]:::app
SessionStore[("Session files<br/>Cleaned text · specs<br/>Conversations · run files")]:::storage
Runner["Code runner<br/>Same-server subprocesses<br/>30-second timeout"]:::execution
API <-->|"Reads / writes"| SessionStore
API -->|"Executes code"| Runner
end
subgraph ExternalServices["External services"]
direction TB
OpenAI["OpenAI API<br/>Spec extraction · code generation · Q&A"]:::external
TargetAPI["Target API<br/>Called by generated test code"]:::external
end
User -->|"Uses"| WebApp
WebApp -->|"Uploads and user actions"| API
API -->|"Model requests"| OpenAI
Runner -->|"Calls with user inputs"| TargetAPI
classDef person fill:#FFFFFF,stroke:#475569,color:#0F172A,stroke-width:2px;
classDef app fill:#EFF6FF,stroke:#2563EB,color:#1E3A8A,stroke-width:2px;
classDef storage fill:#ECFDF5,stroke:#059669,color:#065F46,stroke-width:2px;
classDef external fill:#F3F4F6,stroke:#6B7280,color:#374151,stroke-width:2px;
classDef execution fill:#FFFBEB,stroke:#D97706,color:#92400E,stroke-width:2px;
style Browser fill:#F8FAFC,stroke:#94A3B8,stroke-width:1px,color:#334155
style ApplicationServer fill:#F8FAFC,stroke:#64748B,stroke-width:2px,color:#334155
style ExternalServices fill:#FAFAFA,stroke:#9CA3AF,stroke-width:1px,color:#374151
The web UI handles user interaction and displays returned data. FastAPI cleans the uploaded document, coordinates AI requests, manages session files, and starts code execution. Only the session ID is kept in browser localStorage; the working data stays in server-side session files.
sequenceDiagram
actor User
participant UI as React UI
participant API as FastAPI
participant AI as OpenAI API
participant Session as Session files
participant Runner as Language runner
User->>UI: Upload HTML documentation
UI->>API: Submit document
API->>API: Remove scripts, styles, tags, and extra whitespace
API->>AI: Send cleaned text for structured extraction
AI-->>API: Return request and response JSON
API->>Session: Save cleaned text and specification
API-->>UI: Return session ID and analysis
UI->>UI: Store session ID in browser localStorage
UI->>API: Re-fetch specification with session ID
API->>Session: Load specification JSON
Session-->>API: Return specification
API-->>UI: Display request and response specification
User->>UI: Select a language
UI->>API: Request test code
API->>Session: Load specification and cleaned source
API->>AI: Send context and selected language
AI-->>API: Return generated code
API->>Session: Save generated code, language, and initial conversation
API-->>UI: Return generated code
UI->>API: Load workspace history and specification
API->>Session: Read saved code, language, conversation, and spec
Session-->>API: Return workspace context
API-->>UI: Return code, conversation, and specification context
alt Run completed code
User->>UI: Fill required inputs and run
UI->>API: Send code and session ID
API->>Runner: Execute with the language-specific command (30s timeout)
Runner-->>API: Return stdout and stderr
API-->>UI: Display execution result
else Ask a follow-up question
User->>UI: Ask in the chatbot
UI->>API: Send question and session ID
API->>Session: Load code and conversation history
API->>AI: Send previous context and question
AI-->>API: Return contextual answer
API->>Session: Append question and answer
API-->>UI: Display answer
end
HTML upload → text cleanup → structured API specification → language selection → editable code generation → complete required inputs → run → contextual Q&A
The backend removes <style> and <script> blocks, extracts the document body, strips the remaining HTML tags, and normalizes whitespace. The cleaned text is sent to the AI model in JSON mode to produce a predictable request/response structure for the frontend.
During code generation, the structured specification and the cleaned source text are provided together. This preserves details such as authentication requirements or endpoint information that may be lost during the first structuring step.
| Language | Execution flow |
|---|---|
| Python | Save as main.py and run with Python |
| JavaScript | Save as main.js and run with Node.js |
| Go | Save as main.go and run with go run |
| Java | Extract the public class name, compile with javac, then run the compiled class |
Each command runs in its session directory with a timeout. After the user supplies required values such as credentials and input paths, the frontend receives stdout, stderr, and the success state in a common response format.
The prototype uses lightweight, session-scoped files rather than a database. The initially generated code and previous questions and answers are stored for each session, converted back into conversational context, and included in later AI requests.
- Structure before generation: Normalizing different document formats into one JSON shape gave the UI and code-generation prompt a stable input.
- Keep the cleaned source as supporting context: The structured result alone could omit details, so the source text was also included when generating code.
- Replace the external execution dependency: A small server-side runner provided the required edit-run-result workflow when the original embedded approach was unsuitable.
- Separate language behaviour explicitly: Command mappings kept single-command and compile-then-run flows understandable without forcing them into one execution path.
- Use lightweight session state: File-based session storage was sufficient for the client prototype and avoided introducing a database without a demonstrated need.
- Keep blocking work bounded: AI calls and code execution used separate per-session task handling so blocking work did not stall the main API request loop.
- Keep the AI pipeline in Python: FastAPI was selected by the client and kept uploads, model calls, session handling, and runner control close to the Python processing code.
- Delivered one workflow from document upload to specification review, code generation, execution, and follow-up questions.
- Supported four programming languages with language-specific compile and run behaviour.
- Removed dependency on the initially planned embedded execution approach.
- Incorporated repeated client feedback while maintaining consistency with the supplied design.
The editor keeps the chatbot and the extracted Request/Response specifications in adjacent tabs, so users can reference the API documentation while reviewing generated code.
Chat tab
Response tab
The code execution feature was built as a client prototype using server-side subprocesses and timeouts. It is not a production-grade security sandbox. A public multi-tenant deployment would require stronger process isolation, resource and network restrictions, authentication, and monitoring.






