A containerized Flask web application that integrates the Langflow embedded chat widget.
- Docker
- Docker Compose
Before starting the application for the first time, you must create the persistent volumes for Langflow data:
# Create the external Docker volumes that will store all Langflow data
docker volume create langflow-data
docker volume create langflow-postgresThis step is critical as it ensures your flows, configurations, and database persist between container restarts and removals.
Update the .env file with your configuration:
FLOW_ID=your_flow_id
LANGFLOW_URL=http://localhost:7860
Run the application with Docker Compose:
docker-compose up -dThis will start three containers:
langflow-frontend: The Flask application serving the chat interfacelangflow-service: The Langflow backend servicelangflow-backend: PostgreSQL database for Langflow
- Access the Langflow backend at
http://localhost:7860 - Create a flow in Langflow and copy the flow ID
- Update the
.envfile with your new flow ID - Restart the containers:
docker-compose restartAccess the frontend application at http://localhost:8080
The application uses the following environment variables:
FLOW_ID: ID of the flow created in Langflow (required)LANGFLOW_URL: URL of the Langflow instance (default:http://localhost:7860)
Both variables should be configured in the .env file.
The project includes a Docker Compose configuration that sets up both the Langflow backend and the frontend application:
- Start the entire stack:
docker-compose up -d-
Access Langflow at
http://localhost:7860to create your flow -
Access the frontend at
http://localhost:8080 -
Stop the services:
docker-compose down- View logs:
docker-compose logs -fThe Langflow backend uses two external named volumes to persist data:
langflow-data: Stores flows, file storage, monitor data and secret keyslangflow-postgres: Stores the PostgreSQL database
This ensures that your flows and configurations are preserved even when you run docker-compose down.
To completely remove the persistent data:
# First stop the containers
docker-compose down
# Then remove the volumes
docker volume rm langflow-data
docker volume rm langflow-postgresTo run the application locally without Docker:
- Install dependencies:
pip install -r requirements.txt- Run the Flask application:
python app.pyNote: When running locally, you'll still need a Langflow instance accessible at the URL specified in your .env file.
For production deployment:
- Update the
.envfile with your production configuration:
LANGFLOW_URL=https://your-production-langflow-instance.com
FLOW_ID=your_production_flow_id
- Deploy using Docker Compose:
docker-compose up -d frontendThis allows you to connect to an existing Langflow instance in production without deploying the Langflow backend.
If you encounter connection issues:
- Check that all containers are running:
docker-compose ps- Verify the Langflow health endpoint is accessible:
curl http://localhost:7860/health-
Ensure your flow ID is correct in the
.envfile -
Check the logs for any errors:
docker-compose logs -f- Frontend: Flask 3.0.0 web application
- Embedded Chat: Using Langflow's embedded chat widget (v1.0.7)
- Database: PostgreSQL 16
- Langflow: Latest version from Docker Hub