--- title: Containerize a Langflow application slug: /develop-application --- import Icon from "@site/src/components/icon"; import PartialPodmanAlt from '@site/docs/_partial-podman-alt.mdx'; Designing flows in the visual editor is only the first step in building an application that uses Langflow. Once you have a functional flow, you can use that flow in a larger application, such as a website or mobile app. Because Langflow is both an IDE and a runtime, you can use Langflow to build and test your flows locally, and then package and serve your flows in a production environment. This guide introduces application development with Langflow from initial setup through packaging and deployment. This documentation doesn't explain how to write a complete application; it only describes how to include Langflow in the context of a larger application. ## Directory structure The following example describes the directory structure for a minimal Langflow application: ```text LANGFLOW-APPLICATION/ ├── docker.env ├── Dockerfile ├── flows/ │ ├── flow1.json │ └── flow2.json ├── langflow-config-dir/ ├── README.md ``` This directory contains the following: * [`docker.env`](#docker-env): This file is copied to the Docker image as a `.env` file in the container root. * [`Dockerfile`](#dockerfile): This file controls how your Langflow image is built. * [`/flows`](#flows): This folder holds the flows you want to host, which are the flows that your application uses. * `/langflow-config-dir`: This folder is referenced in the Dockerfile as the location for your Langflow deployment's configuration files, database, and logs. * `README.md`: This is a typical README file for your application's documentation. This is a minimal example of a Langflow application directory. Your application might have additional files and folders, such as a `/components` folder for custom components, or a `pyproject.toml` file for additional dependencies. ### Package management The base Langflow Docker image includes the Langflow core dependencies because it uses `langflowai/langflow:latest` as the parent image. If your application requires additional dependencies, create a [`pyproject.toml`](https://packaging.python.org/en/latest/guides/writing-pyproject-toml) file for the additional dependencies. For more information, see [Install custom dependencies](/install-custom-dependencies). To deploy an application with additional dependencies to Docker, you must copy the `pyproject.toml` and `uv.lock` files to the Docker image. To do this, add the following to your Langflow application's Dockerfile: ```text COPY pyproject.toml uv.lock /app/ ``` ### Environment variables {#docker-env} The `docker.env` file is a `.env` file loaded into your Docker image. It contains [Langflow environment variables](/environment-variables) that are used in flows or control Langflow's behavior, such as authentication, database storage, API keys, and server configurations. For example: ```text LANGFLOW_AUTO_LOGIN=True LANGFLOW_SAVE_DB_IN_CONFIG_DIR=True LANGFLOW_BASE_URL=http://0.0.0.0:7860 OPENAI_API_KEY=sk-... ``` You can set environment variables in the Dockerfile as well. However, if you set an environment variable in both `docker.env` and the Dockerfile, Langflow uses the value set in `docker.env`. Langflow can also [create global variables from your environment variables](/configuration-global-variables#add-custom-global-variables-from-the-environment), or [use environment variables as a backup for missing global variables](/configuration-global-variables#use-environment-variables-for-missing-global-variables). ### Secrets For simplicity, the examples in the Langflow documentation might use direct references to API keys and other sensitive values. In your own applications, you should always follow industry best practices for managing secrets, such as using environment variables or secret management tools. For information about generating authentication keys and managing secrets in Langflow, see [API keys and authentication](/api-keys-and-authentication). ### Storage By default, Langflow uses an [SQLite](https://www.sqlite.org/) database for storage. If you prefer to use PostgreSQL, see [Configure an external PostgreSQL database](/configuration-custom-database). For more information about storage, including cache and memory, see [Memory management options](/memory). ### Flows {#flows} Your local Langflow instance might have many flows for different applications. When you package Langflow as a dependency of an application, you only want to include the flows your application uses. 1. [Export flows](/concepts-flows-import) that are relevant to your application. If you have chained flows (flows that trigger other flows), make sure you export _all_ necessary flows. 2. Add the exported Langflow JSON files to the `/flows` folder in your application directory. ### Components The