> ## Documentation Index
> Fetch the complete documentation index at: https://forest-chore-open-api.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Architecture

> Deploy the Forest back-end in your infrastructure while Forest hosts the UI - the most popular deployment option

The self-hosted architecture gives you full control over your data and code by hosting the Forest back-end in your own infrastructure. This is the **most popular deployment option** for production applications.

## Architecture overview

<img src="https://mintcdn.com/forest-chore-open-api/DwOJ-XBdKEod-4Pc/assets/architecture-self-hosted.svg?fit=max&auto=format&n=DwOJ-XBdKEod-4Pc&q=85&s=af2704ebb4707ceb57b6933329a508b9" alt="Self-Hosted Architecture Diagram" width="1400" height="900" data-path="assets/architecture-self-hosted.svg" />

### How it works

1. **Your users** access the Forest UI hosted at `app.forestadmin.com`
2. **Forest UI** makes API calls to your back-end
3. **Your back-end** runs in your infrastructure (AWS, GCP, Heroku, etc.)
4. **Your back-end** queries your database directly
5. **All data** stays within your infrastructure

<Info>
  **Key benefit**: This architecture follows our privacy by design motto. Your data never leaves your infrastructure.
</Info>

## Components

| Component         | Hosted by | Location              | Responsibilities                                                                                                                                                                                                       |
| ----------------- | --------- | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Your Back-end** | You       | Your infrastructure   | • Runs in Node.js or Ruby<br />• Direct access to your database<br />• Executes business logic (actions, computed fields, hooks)<br />• Handles authentication and authorization<br />• Exposes REST API for Forest UI |
| **Forest UI**     | Forest    | `app.forestadmin.com` | • Back-office interface for your users<br />• Communicates with your back-end via HTTPS<br />• Receives only schema metadata (no data)<br />• Managed and updated by Forest                                            |
| **Your Database** | You       | Your infrastructure   | • PostgreSQL, MySQL, MongoDB, etc.<br />• Only accessible to your back-end<br />• No direct connection from Forest<br />• Your data never leaves your infrastructure                                                   |

## Back-end deployment

You can deploy the Forest back-end in two ways, depending on your application architecture:

### In-app deployment

With in-app deployment, the Forest back-end becomes part of your existing application. It runs in the same Node.js or Ruby process, sharing the same database connection pool and resources. When you deploy your application, the back-end deploys with it as a single unit.

This approach is particularly valuable when you want to leverage your existing ORM models. Whether you're using Sequelize, Mongoose, or ActiveRecord, Forest can read directly from your model definitions, no need to redefine your schema. You can also reuse your existing business logic, sharing code, services, and utilities between your application and Forest without duplication.

<img src="https://mintcdn.com/forest-chore-open-api/DwOJ-XBdKEod-4Pc/assets/deployment-in-app.svg?fit=max&auto=format&n=DwOJ-XBdKEod-4Pc&q=85&s=1a4f2ebaa5ea43cda21e8295a2662764" alt="In-app Deployment Architecture" width="800" height="700" data-path="assets/deployment-in-app.svg" />

### Standalone deployment

Standalone deployment runs the Forest back-end as a completely separate service. It operates in its own process or container with dedicated resources and its own database connection pool. Your application and the back-office are deployed and scaled independently.

This architecture provides a cleaner separation of concerns. Your application code stays focused on your business logic, while Forest responsibilities are isolated in their own service. The two services communicate through well-defined boundaries, making your overall system architecture simpler to understand and maintain. This is particularly beneficial as your team grows, developers working on the application don't need to think about back-office concerns, and vice versa.

<Info>
  **Note**: Standalone deployment is currently available for Node.js only. If you need standalone deployment with Ruby, please [contact our sales team](https://www.forestadmin.com/contact).
</Info>

<img src="https://mintcdn.com/forest-chore-open-api/DwOJ-XBdKEod-4Pc/assets/deployment-standalone.svg?fit=max&auto=format&n=DwOJ-XBdKEod-4Pc&q=85&s=b2157ce1ec3fb560ee1ef9103457df7e" alt="Standalone Deployment Architecture" width="900" height="600" data-path="assets/deployment-standalone.svg" />

<Info>
  **Recommendation**: We recommend **standalone deployment** for cleaner architecture and better separation of concerns. Use **in-app** if you need to reuse your ORM models or existing business logic.
</Info>

## Privacy by design

The self-hosted architecture is built with privacy as a core principle. Here's how data flows when a user accesses Forest:

<img src="https://mintcdn.com/forest-chore-open-api/DwOJ-XBdKEod-4Pc/images/diagrams/self-hosted.svg?fit=max&auto=format&n=DwOJ-XBdKEod-4Pc&q=85&s=cc76eed9aba02a129a9299e2dfaacb85" alt="When a user opens Forest, the browser loads UI and config from Forest's public endpoints, but all data requests go directly to your Forest back-end behind your firewall, so your data never reaches Forest servers" width="100%" data-path="images/diagrams/self-hosted.svg" />

**The key principle:** Forest's servers (`app.forestadmin.com`, `api.forestadmin.com`) only send configuration and UI code to your browser. All data requests go directly from your browser to your back-end behind your firewall, and your data never leaves your infrastructure.

<Note>
  **Looking for a different setup?** Forest also offers **on-premise** deployments where even the Forest UI runs in your own infrastructure. [Contact us](https://www.forestadmin.com/contact) to find the right fit for your organization.
</Note>
