NoCode FSM Generator
Project purpose
The NoCode FSM Generator is a backend service designed to convert natural language descriptions of user interface (UI) logic or chatbot flows into structured Finite State Machine (FSM) data. This enables the rapid creation of MiniApps, chatbots, or Telegram bot interfaces by leveraging Large Language Models (LLMs) orchestrated via LangGraph.
The system accepts a text prompt describing the desired application flow. A LangGraph workflow then processes this prompt, identifies necessary FSM components (messages, user actions, and connections), generates the corresponding JSON, and validates its structure.
Core Capabilities
- Natural Language to FSM JSON: Transforms descriptive text into structured FSM data.
- Modular Prompt Management: Manages versioned LLM prompts from a centralized
prompt_storage.json. - AI Workflow Orchestration: Utilizes LangGraph for multi-step AI process management.
- Schema Validation: Employs Pydantic for defining and validating FSM data models.
- API Interface: Provides a REST API for programmatic access.
- Prompt Versioning: Supports specifying different prompt template versions for development and testing.
Project Layout
.
├── app/
│ ├── main.py # starts all
│ ├── api/
│ │ ├── __init__.py
│ │ └── routes.py # Handles API requests
│ ├── llm/
│ │ ├── __init__.py
│ │ ├── actions.py # LangGraph nodes and LLM interaction logic
│ │ ├── prompts/
│ │ │ └── prompt_storage.json # Centralized storage for LLM prompt templates
│ │ └── lifespan_manager.py # FastAPI startup/shutdown tasks
│ ├── models/
│ │ ├── __init__.py
│ │ └── models.py # Defines FSM data models (e.g., MessageBlock)
│ └── main.py # Main FastAPI application entry point
├──test
│ ├── user_prompts/ # Directory for user input test prompts
│ │ └── example_prompt.txt # Example prompt
│ ├── json_generations_v2/ # Directory for generated FSM JSONs from tests
│ │ └── ... # Saved JSON files
│ └── bruteforce_json_generation.py # API testing script
└── README.md # This file
Getting Started
Prerequisites
- Python 3.10+
- uv (Python package manager)
- Mistral AI API Key
Installation Steps
-
Clone the repository:
bash git clone https://github.com/MrIlyaneX/NoCode-FSM-Generator.git cd NoCode-FSM-Generator -
Set up your Python environment:
bash uv venv --python 3.13 --seed source .venv/bin/activate # On Windows: .venv\Scripts\activate -
Install project dependencies with uv: Ensure you have a
pyproject.tomlfile in your project_root/app.Then, run:
bash uv syncThis installs dependencies and creates a
uv.lockfile for reproducible environments. -
Add your Mistral AI API Key:
Create a file named
.envin the root of your project and add your API key:MISTRAL_API_KEY="your_mistral_api_key_here"Ensure your application loads this environment variable (e.g., using
python-dotenvoros.getenv()).
Running the Application
Start the FastAPI server:
uvicorn app.main:app
#The API will be available at http://localhost:8080. API documentation is at # http://localhost:8080/#docs (Swagger UI).
# For production use gunicorn
Proceed to this page to see about API endpoints Or visit testing and development