When your app spans multiple files, uses local utility modules, or depends on code from a private repository, you need a way to include that code in the remote environment where your runners execute. This page covers the mechanisms fal provides:Documentation Index
Fetch the complete documentation index at: https://fal.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
app_files for local files and directories, local_python_modules for Python modules that should be serialized alongside your app, and clone_repository for pulling external Git repos at startup.
These mechanisms work with the fal Runtime (pip requirements). They are not available when using a custom Docker container, where you should use COPY in your Dockerfile to include local files instead.
Choosing the Right Mechanism
fal provides three ways to bring code into the remote environment, each suited to a different situation. Useapp_files when you have a multi-file project and want the remote environment to mirror your local directory structure. Files are uploaded and placed at the same relative paths, so imports and file reads work identically to local development. This is the recommended approach for most projects.
Use local_python_modules when you have a simple Python module that your app imports at the top level. The module is serialized (pickled) alongside your app class and made available on the remote Python path. This is lighter-weight than app_files but only works for importable Python packages.
Use clone_repository when you need to pull code from an external Git repository at runner startup. The clone happens inside setup(), so the code is available before your first request.
App Files
Theapp_files attribute includes local files and directories in the remote environment, mirroring your local file layout exactly. Imports and file paths work the same way they do on your machine.
from utils.helper import process_data and from models.classifier import MyModel work exactly as they do locally. Files are placed relative to your app file location.
Context Directory
By default, all file paths are resolved relative to the directory containing your fal app file. You can change this base directory withapp_files_context_dir, which is useful for monorepos or when you need to include files from a parent directory:
../../outside) are rejected. Included files are read-only on the runner.
Ignoring Files
Useapp_files_ignore to exclude files using regex patterns. fal excludes .pyc, __pycache__/, .git/, and .DS_Store by default.
Local Python Modules
Thelocal_python_modules attribute ships a Python module alongside your app by serializing it into the deployment payload. This is a simpler mechanism than app_files - it adds the specified modules to the remote Python path so they can be imported directly. Use it when you have a small utility module that your app imports at the top level.
app_files is the better choice because it preserves the full directory structure and supports ignore patterns.
Git Repositories
Useclone_repository to pull code from a Git repository at runner startup. The clone happens inside setup(), so the repository is available before any requests are processed. Pin to a specific commit hash for reproducibility.
include_to_path=True adds the cloned directory to PYTHONPATH, so you can import modules from the repository directly. For private repositories, include a personal access token in the URL: https://YOUR_TOKEN@github.com/myorg/private-repo.git.