# Build apps

> **📝 Note**
>
> An LLM-optimized bundle of this entire section is available at [`section.md`](https://www.union.ai/docs/v2/union/user-guide/build-apps/section.md).
> This single file contains all pages in this section, optimized for AI coding agent context.

This section covers how to build different types of apps with Flyte, from single-script apps to multi-file projects, common usage patterns, and authentication.

> [!TIP]
> Go to [Introducing apps](https://www.union.ai/docs/v2/union/user-guide/core-concepts/introducing-apps/page.md) for an overview of apps and a quick example. For pre-built environments for popular frameworks like Streamlit, FastAPI, vLLM, and SGLang, see [Native app integrations](https://www.union.ai/docs/v2/union/user-guide/native-app-integrations/_index).

## App types

Flyte supports various types of apps:

- **UI dashboard apps**: Interactive web dashboards and data visualization tools like Streamlit and Gradio
- **Web API apps**: REST APIs, webhooks, and backend services like FastAPI and Flask
- **Model serving apps**: High-performance LLM serving with vLLM and SGLang

- **Connector apps**: Long-running services that delegate task execution to external systems

For ready-to-use environments for these frameworks, see [Native app integrations](https://www.union.ai/docs/v2/union/user-guide/native-app-integrations/_index).

## Usage patterns

Apps and tasks can interact in various ways: calling each other via HTTP, webhooks, WebSockets, or direct browser usage.

| Pattern | Use Case | Implementation |
|---------|----------|----------------|
| App | Stand-alone serving app | HTTP requests from arbitrary clients |
| App → App | Microservices, proxies, agent routers, LLM routers | HTTP requests between apps |
| App → Task | Webhooks, APIs triggering workflows | Flyte SDK in app |
| Task → App | Batch processing using inference services | HTTP requests from task |
| Browser app | User-facing dashboards (e.g. Streamlit, Gradio) | Direct browser access |

## Next steps

- [**Single-script apps**](https://www.union.ai/docs/v2/union/user-guide/build-apps/single-script-apps/page.md): The simplest way to build and deploy apps in a single Python script
- [**Multi-script apps**](https://www.union.ai/docs/v2/union/user-guide/build-apps/multi-script-apps/page.md): Build FastAPI and Streamlit apps with multiple files
- [**Serving graphs**](https://www.union.ai/docs/v2/union/user-guide/build-apps/serving-graphs/page.md): Apps calling other apps for microservice architectures
- [**Hybrid graphs**](https://www.union.ai/docs/v2/union/user-guide/build-apps/hybrid-graphs/page.md): Tasks calling apps and apps calling tasks (webhooks, APIs)
- [**WebSocket apps**](https://www.union.ai/docs/v2/union/user-guide/build-apps/websocket-apps/page.md): Real-time, bidirectional communication with WebSockets
- [**Browser apps**](https://www.union.ai/docs/v2/union/user-guide/build-apps/browser-apps/page.md): User-facing dashboards and UIs
- [**Secret-based authentication**](https://www.union.ai/docs/v2/union/user-guide/build-apps/secret-based-authentication/page.md): Authenticate FastAPI apps using Flyte secrets

- [**Connector app**](https://www.union.ai/docs/v2/union/user-guide/build-apps/connector-app/page.md): Deploy a connector as a long-running service

## Subpages

- [Single-script apps](https://www.union.ai/docs/v2/union/user-guide/build-apps/single-script-apps/page.md)
  - Plain Python HTTP server
  - Streamlit app
  - FastAPI app
  - Running single-script apps
  - When to use single-script apps
- [Multi-script apps](https://www.union.ai/docs/v2/union/user-guide/build-apps/multi-script-apps/page.md)
  - FastAPI multi-script app
  - Project structure
  - Example: Multi-file FastAPI app
  - Automatic file discovery
  - Streamlit multi-script app
  - Project structure
  - Example: Multi-file Streamlit app
  - Deploying multi-file Streamlit app
  - Complex multi-file example
  - Project structure
  - Example code
  - Deploying complex app
  - Best practices
  - Troubleshooting
- [Serving graphs](https://www.union.ai/docs/v2/union/user-guide/build-apps/serving-graphs/page.md)
  - Core concepts: a minimal two-app chain
  - Deploying multiple apps together with `depends_on`
  - Getting an upstream app's endpoint
  - Sizing each node independently
  - Example: CPU / GPU inference split
  - Disjoint images per node
  - GPU app: model.forward only
  - CPU app: pre/postprocess + call GPU
  - Deploy
  - Example: A/B testing with Statsig
  - Statsig client singleton
  - Variant apps
  - Root app with Statsig in its lifespan
  - App environments
  - Routing endpoint
  - Deploy
  - When to split into a serving graph
  - Best practices
- [Hybrid app-task graphs](https://www.union.ai/docs/v2/union/user-guide/build-apps/hybrid-graphs/page.md)
  - Call app from task
  - Example: FastAPI app called from a task
  - Call task from app (webhooks / APIs)
  - Example: Basic webhook app
  - Advanced webhook patterns
  - Webhook security and best practices
  - Example: GitHub webhook
  - Gradio agent UI
  - Best practices
- [WebSocket apps](https://www.union.ai/docs/v2/union/user-guide/build-apps/websocket-apps/page.md)
  - Example: Basic WebSocket app
  - WebSocket patterns
  - Using WebSockets with Flyte tasks
  - WebSocket client example
  - Best practices
- [Browser apps](https://www.union.ai/docs/v2/union/user-guide/build-apps/browser-apps/page.md)
  - Accessing browser-based apps
  - Common browser-based app types
  - Streamlit apps
  - Gradio apps
  - Custom HTML/JS apps
  - Best practices
- [Secret-based authentication](https://www.union.ai/docs/v2/union/user-guide/build-apps/secret-based-authentication/page.md)
  - Create the secret
  - Define the FastAPI app
  - Deploy the FastAPI app
  - Invoke the endpoint
  - Authentication for vLLM and SGLang apps
  - Create the authentication secret
  - Deploy vLLM app with authentication
  - Deploy SGLang app with authentication
  - Invoke authenticated LLM endpoints
  - Accessing Swagger documentation
  - Security best practices
  - Troubleshooting
  - Next steps
- [Connector app](https://www.union.ai/docs/v2/union/user-guide/build-apps/connector-app/page.md)
  - When to build a custom connector
  - Project structure
  - Step 1: Implement the connector
  - Step 2: Create the task plugin
  - Step 3: Deploy the connector
  - Step 4: Register and run tasks
  - How it all fits together
  - Secrets
  - Per-task secrets (per-user credentials)
  - Related

---
**Source**: https://github.com/unionai/unionai-docs/blob/main/content/user-guide/build-apps/_index.md
**HTML**: https://www.union.ai/docs/v2/union/user-guide/build-apps/
