FE FSD (Front End Full Stack Development) API Documentation This document describes the API endpoints for managing Frontend System Design (FSD) documents. 1. Generate FSD ----------------------- Endpoint: POST /api/modules/{module_id}/functions/{function_id}/generate Description: Generate a Frontend System Design document using Claude AI. Request Parameters: - module_id (path, required): The ID of the module - function_id (path, required): The ID of the function Request Body: { "created_by": "user123", "custom_instructions": "Optional custom instructions for generation" } Fields: - created_by (string, required): User requesting FSD generation - custom_instructions (string, optional): Custom instructions for FSD generation Response: { "status": "success", "message": "FSD generated successfully", "data": { "fsd": { "ID": "FSD_12345678", "screen_id": "SCR_12345678", "content": { "overview": "Overview text", "ascii_design": "ASCII mockup content", "sections": [ { "title": "Section title", "content": "Section content", "order": 1 } ], "references": {} }, "type": "AI_GENERATED", "status": "NON_GENERATED", "version": "1.0.0", "version_number": 1, "function_id": "func_12345678", "module_id": "MOD_12345678", "function_version": 1, "audit": { "created_by": "user123", "created_at": "2024-01-01T00:00:00Z", "updated_by": "user123", "updated_at": "2024-01-01T00:00:00Z", "status_changed_by": "user123", "status_changed_at": "2024-01-01T00:00:00Z" } }, "metadata": { "input_tokens": 1000, "output_tokens": 2000, "parser_warnings": [], "claude_interaction": { "raw_prompt": "Prompt text", "raw_response": "Claude's response", "corrected_response": {} } }, "output_fsd": "Raw FSD content" } } 2. List FSDs -------------------- Endpoint: GET /api/modules/{module_id}/functions/{function_id}/list Description: List all FSDs for a module/function. Request Parameters: - module_id (path, required): The ID of the module - function_id (path, required): The ID of the function Response: { "status": "success", "message": "FSDs retrieved successfully", "data": { "fsds": [ { "ID": "FSD_12345678", "screen_id": "SCR_12345678", "content": {}, "type": "AI_GENERATED", "status": "ACTIVE", "version": "1.0.0", "version_number": 1, "function_id": "func_12345678", "module_id": "MOD_12345678", "function_version": 1, "audit": {} } ], "output_fsd": {} } } 3. Update FSD -------------------- Endpoint: PUT /api/modules/{module_id}/functions/{function_id}/{screen_id}/fsd/{fsd_id} Description: Update an existing FSD. Request Parameters: - module_id (path, required): The ID of the module - function_id (path, required): The ID of the function - screen_id (path, required): The ID of the screen - fsd_id (path, required): The ID of the FSD Request Body: { "updated_by": "user123", "output_fsd": "Updated FSD content" } Fields: - updated_by (string, required): User updating the FSD - output_fsd (string, required): Updated FSD content as text Response: { "status": "success", "message": "FSD updated successfully", "data": { "fsd": { "ID": "FSD_12345678", "content": {}, "version": "1.0.1", "version_number": 2, "audit": {} }, "output_fsd": "Updated FSD content" } } 4. Create FSD Version --------------------------- Endpoint: POST /api/modules/{module_id}/functions/{function_id}/version/{screen_id} Description: Create a new version of an FSD. Request Parameters: - module_id (path, required): The ID of the module - screen_id (path, required): The ID of the screen Request Body: { "created_by": "user123", "comment": "Optional version comment" } Fields: - created_by (string, required): User creating the version - comment (string, optional): Comment about this version Response: { "status": "success", "message": "FSD version created successfully", "data": { "version": { "ID": "FSDV_12345678", "fsd_id": "FSD_12345678", "module_id": "MOD_12345678", "screen_id": "SCR_12345678", "function_id": "func_12345678", "version": "1.0.1", "version_number": 2, "function_version": 1, "content": {}, "created_by": "user123", "created_at": "2024-01-01T00:00:00Z", "comment": "Version comment", "is_current": true, "metadata": {}, "output_fsd": "FSD content" } } } 5. List FSD Versions --------------------------- Endpoint: GET /api/modules/{module_id}/functions/{function_id}/versions/{screen_id} Description: List all versions of an FSD. Request Parameters: - module_id (path, required): The ID of the module - screen_id (path, required): The ID of the screen Response: { "status": "success", "message": "FSD versions retrieved successfully", "data": { "total": 2, "versions": [ { "ID": "FSDV_12345678", "fsd_id": "FSD_12345678", "version": "1.0.1", "version_number": 2, "created_at": "2024-01-01T00:00:00Z", "is_current": true } ] } } 6. Create Manual FSD ------------------------------ Endpoint: POST /api/modules/{module_id}/functions/{function_id}/{screen_id}/manual/create Description: Create a new FSD manually. Request Parameters: - module_id (path, required): The ID of the module - function_id (path, required): The ID of the function - screen_id (path, required): The ID of the screen Request Body: { "title": "FSD Title", "description": "FSD Description", "created_by": "user123", "output_fsd": "FSD content" } Fields: - title (string, required): Title of the FSD - description (string, required): Description of the FSD - created_by (string, required): User creating the FSD - output_fsd (string, required): FSD content Response: { "status": "success", "message": "FSD created successfully", "data": { "fsd": { "ID": "FSD_12345678", "content": {}, "type": "MANUAL", "status": "ACTIVE", "version": "1.0.0", "audit": {} }, "output_fsd": "FSD content" } } 7. Activate FSD -------------------------------- Endpoint: PUT /api/modules/{module_id}/functions/{function_id}/{screen_id}/activate Description: Activate an FSD. Request Parameters: - module_id (path, required): The ID of the module - screen_id (path, required): The ID of the screen Request Body: { "updated_by": "user123" } Fields: - updated_by (string, required): User activating the FSD Response: { "status": "success", "message": "FSD activated successfully", "data": { "screen_id": "SCR_12345678", "status": "ACTIVE", "updated_by": "user123", "updated_at": "2024-01-01T00:00:00Z" } } 8. Deactivate FSD -------------------------------- Endpoint: PUT /api/modules/{module_id}/functions/{function_id}/{screen_id}/deactivate Description: Deactivate an FSD. Request Parameters: - module_id (path, required): The ID of the module - screen_id (path, required): The ID of the screen Request Body: { "updated_by": "user123" } Fields: - updated_by (string, required): User deactivating the FSD Response: { "status": "success", "message": "FSD deactivated successfully", "data": { "screen_id": "SCR_12345678", "status": "INACTIVE", "updated_by": "user123", "updated_at": "2024-01-01T00:00:00Z" } } 9. Restore FSD Version ------------------------- Endpoint: POST /api/modules/{module_id}/functions/{function_id}/restore/{screen_id}/{version_id} Description: Restore an FSD to a specific version. Request Parameters: - module_id (path, required): The ID of the module - screen_id (path, required): The ID of the screen - version_id (path, required): The ID of the version to restore Response: { "status": "success", "message": "FSD version restored successfully", "data": { "fsd": { "ID": "FSD_12345678", "content": {}, "version": "1.0.2", "version_number": 3 }, "output_fsd": "Restored FSD content" } } 10. Mark for Development -------------------- Endpoint: PUT /api/modules/{module_id}/functions/{function_id}/{screen_id}/development Description: Mark an FSD for development use and track its development status. Request Parameters: - module_id (path, required): The ID of the module - function_id (path, required): The ID of the function - screen_id (path, required): The ID of the screen Request Body: { "version": "v1.0.0", "status": "in_development", "notes": "Development notes" } Fields: - version (string, required): Development version (e.g. v1.0.0) - status (string, required): Development status (not_started/in_development/completed/archived) - notes (string, optional): Additional development notes Response: { "status": "success", "message": "FSD marked for development successfully", "data": { "fsd": { "ID": "FSD_12345678", "metadata": { "development_version": "v1.0.0", "development_status": "in_development", "development_notes": "Development notes", "marked_for_development": true, "marked_for_development_at": "2024-01-01T00:00:00Z" } }, "development_info": { "version": "v1.0.0", "status": "in_development", "notes": "Development notes" }, "output_fsd": "FSD content" } } 11. Select FSD -------------------- Endpoint: PUT /api/modules/{module_id}/functions/{function_id}/{screen_id}/fsd/{fsd_id}/select Description: Select an FSD (deselects all others). Request Parameters: - module_id (path, required): The ID of the module - function_id (path, required): The ID of the function - screen_id (path, required): The ID of the screen - fsd_id (path, required): The ID of the FSD Response: { "status": "success", "message": "FSD selected successfully", "data": { "screen_id": "SCR_12345678", "fsd_id": "FSD_12345678", "selected": true, "updated_at": "2024-01-01T00:00:00Z" } } 12. Deselect FSD ---------------------- Endpoint: PUT /api/modules/{module_id}/functions/{function_id}/{screen_id}/fsd/{fsd_id}/deselect Description: Deselect an FSD. Request Parameters: - module_id (path, required): The ID of the module - function_id (path, required): The ID of the function - screen_id (path, required): The ID of the screen - fsd_id (path, required): The ID of the FSD Response: { "status": "success", "message": "FSD deselected successfully", "data": { "screen_id": "SCR_12345678", "fsd_id": "FSD_12345678", "selected": false, "updated_at": "2024-01-01T00:00:00Z" } } Note: All endpoints include CORS headers and proper error handling. Error responses follow the standard HTTP status codes and include detailed error messages in the following format: Error Response Format: { "detail": "Error message describing what went wrong" } Common Error Responses: 1. Not Found (404): { "detail": "Module not found" } { "detail": "FSD not found" } { "detail": "FSD version not found" } 2. Bad Request (400): { "detail": "No screen selected for FSD generation" } { "detail": "No mermaid diagram selected for FSD generation" } 3. Internal Server Error (500): { "detail": "Failed to save FSD" } { "detail": "Failed to create version" } { "detail": "Failed to update FSD" } Common Response Headers: - Access-Control-Allow-Origin: * - Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS - Access-Control-Allow-Headers: * - Content-Type: application/json