Iterative is an advanced AI-powered platform that simplifies frontend development. It dynamically generates React code using OpenAI's API, provides actionable recommendations for project improvement, manages project states for A/B testing, and enables secure deployment. Iterative includes full database migration support using Alembic and Flask-Migrate.
- React Code Generation: Generates functional React components with inline styling based on user input.
- AI Recommendations: Offers tailored suggestions to enhance your project.
- Version Control: Enables reverting to previous project states and conducting A/B tests.
- Secure Deployment: Deploy and manage project states with password-protected access.
- Real-Time Collaboration: Leverage Socket.IO for live code updates and feedback.
- Authentication: Stytch-powered secure user authentication.
🚀 Demo Screencast: Watch the demo on YouTube
- Docker
- OpenAI API Key
- Stytch API credentials
Create a .env
file in the project root:
DATABASE_URL=postgresql://user:pass@host:5432/db
SECRET_KEY=
OPENAI_API_KEY=
OPENAI_ORG_ID=
OPENAI_MODEL=gpt-3.5-turbo # Default: gpt-3.5-turbo
STYTCH_PROJECT_ID=
STYTCH_SECRET=
NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN=
STYTCH_PROJECT_ENV=test
ITERATIVE_ENV=dev
# Application Settings
NEXT_PUBLIC_API_BASE_URL= # Default: http://localhost:8000
NEXT_PUBLIC_CONVERTER_BASE_URL= # Default: http://iterative_backend_modules:8080
FRONTEND_HOSTNAME= # Default: http://localhost:3000
Secret keys can be generated on the fly with openssl rand -base64 32
.
-
The OpenAI API key used should be explicitly authorized to use the chosen model. This setting can be found in the Limits tab of the project. In addition, the chosen model should be one of [this list]. Additional models available soon. Using the default
gpt-3.5-turbo
is recommended for testing purposes. -
When creating a new Stytch project, make sure to select Consumer Authentication as the authentication type. This project does not currently support B2B SAAS Authentication. Stytch Project ID, Stytch Secret, and Stytch Public Token can be found on the new project's main page.
Important
Postgres database is required, and credentials should be in the previously mentioned env. See the Postgres Docker image for help setting up a container.
docker compose run --rm --build iterative_backend bash -c "flask db init && flask db migrate && flask db upgrade"
docker-compose up -d --build
The application should now be accessible at http://localhost:3000 (or the hostname configured in your reverse proxy and in the .env file).
- Database Errors: Ensure your
DATABASE_URL
in.env
is correct and the database server is running.
Send a POST request to /api/generate
with project details to generate React code.
Use /api/recommendations
to get suggestions for improving your project.
Create, update, delete, and fetch projects using the /api/projects
endpoints.
Manage project states via /api/projects/project_state
.
Deploy project states securely through /api/deployments
.
Customize settings for AI models, CSS frameworks, and color schemes via /api/update-user-settings
.
Apply migrations and manage schema changes seamlessly using Alembic.
Use /api/health
for system health checks.
app/
: Core application logic, organized by blueprints.projects/
: Manage projects and states.deployments/
: Handle deployment and A/B testing.settings/
: Manage user-specific configurations.chat/
: Real-time interactions and AI-driven recommendations.openai/
: OpenAI API integration and prompt handling.
migrations/
: Database migration files generated with Alembic.versions/
: Contains migration scripts for schema changes.
config.py
: Configuration for development and production.tasks.py
: Celery tasks for handling asynchronous processes.requirements.txt
: Python dependencies.Dockerfile
: Docker container setup.compose-dev.yaml
: Docker Compose configuration for development.
Key Python dependencies:
- Flask (
Flask
,Flask-SQLAlchemy
,Flask-Migrate
,Flask-SocketIO
) - OpenAI API (
openai
) - Stytch Authentication (
stytch
) - Alembic for database migrations
- Asynchronous Task Management (
celery
,redis
)
Run the test suite:
pytest
From the iterativeconverter-main repository, additional Docker deployment options are available for varying CPU architectures:
-
Build and deploy the backend with Docker:
docker build -t iterative-backend .
-
For CPU-specific builds:
docker buildx build --platform linux/amd64 -t iterative-backend .
-
To deploy locally using Docker Compose:
docker compose up --build
We welcome contributions! Please see CONTRIBUTING.md
for guidelines.
This project is licensed under the MIT License. See LICENSE
for details.
Thanks to OpenAI for powering React code generation and the open-source community for their contributions. Also special thanks to Kai Mou for building out a huge part of Iterative!!