<!-- llms-txt: https://hydron.app/llms.txt -->
<!-- llms-full-txt: https://hydron.app/llms-full.txt -->
<!-- canonical: https://hydron.app/docs/how-it-works -->

# How It Works

This page explains Hydron's full deployment pipeline — from the moment you connect your code to when your application is live and serving traffic.

## The deployment pipeline

Hydron's deployment process consists of six stages: **Source Connection**, **Analysis**, **Planning**, **Provisioning**, **Building**, and **Deployment**.

## Stage 1: Source connection

You provide the source of your application through one of three methods:

- **Git repository** — GitHub, GitLab, Bitbucket, or any public URL
- **Docker image** — An existing image from any Docker registry
- **Template** — A pre-configured stack from the template gallery

For Git repositories, Hydron clones the code to analyze it. For Docker images, analysis is skipped and you proceed directly to infrastructure planning.

![Choose your deployment source — Git, Docker, or templates](/images/docs/deploy-source-selection.png)

## Stage 2: Code analysis

The AI performs a deep analysis of your codebase:

**Language & framework detection**
- Identifies programming languages and their versions
- Detects frameworks (Express, Django, Rails, Spring, Next.js, etc.)
- Reads package managers (npm, pip, bundler, maven, etc.)

**Service discovery**
- Finds entry points and service boundaries
- Detects monorepo structures
- Identifies background workers, API servers, and frontends

**Configuration extraction**
- Extracts environment variable references
- Finds existing Dockerfiles
- Detects port configurations and health check endpoints

**Dependency mapping**
- Maps service-to-service dependencies
- Identifies database and cache requirements
- Detects external service integrations

The analysis results in a list of **services** with their configurations, which you review and approve.

![Code analysis results appear in the chat with service details in the sidebar](/images/docs/chat-interface.png)

## Stage 3: Infrastructure planning

Based on the analysis, the AI generates an **infrastructure plan** that specifies:

### Server selection
The AI recommends server specifications based on your application's needs:

~~~
Application Analysis         Recommended Server
─────────────────────       ──────────────────────
Node.js API + React         KS-LE-B
3 services                  4 vCPU, 16GB RAM
Low-medium traffic          500GB SSD
                            Frankfurt, DE
~~~

Factors considered:
- Number and type of services
- Expected resource usage (CPU, memory, disk)
- Geographic location preference
- Budget constraints

### Docker configuration
For each service, a Dockerfile is either detected or generated. The AI creates optimized multi-stage builds that minimize image size and build time.

### Networking
The plan defines:
- Port mappings for each service
- Internal networking between services
- External port exposure for public-facing services
- Reverse proxy configuration

### Environment & security
- Environment variable definitions
- SSL certificate requirements
- Firewall rules
- Security best practices

You review the complete plan in the **Infrastructure** panel and can request changes through the chat before approving.

![The Plan tab showing infrastructure configuration](/images/docs/sidebar-plan.png)

## Stage 4: Server provisioning

Once you approve the plan, Hydron provisions your dedicated server:

~~~
Provisioning Steps
┌─────────────────────────────────────────────────┐
│  [====] Install operating system         Done   │
│  [====] Configure networking             Done   │
│  [====] Install Docker & tools           Done   │
│  [====] Set up firewall rules            Done   │
│  [====] Configure SSH access             Done   │
│  [==  ] Pull base images              Running   │
│  [    ] Configure reverse proxy       Pending   │
│  [    ] Set up SSL certificates       Pending   │
└─────────────────────────────────────────────────┘
~~~

This includes:
1. **OS installation** — Ubuntu with the latest security patches
2. **Docker setup** — Docker Engine and Docker Compose
3. **Security hardening** — Firewall rules, SSH key configuration
4. **Networking** — Internal DNS, port forwarding
5. **Tooling** — Monitoring agents, log collection

Each step is executed via SSH and you can watch the progress in real-time through the **Runs** panel.

## Stage 5: Build

With the server ready, Hydron builds your application:

1. **Clone repository** (if Git source) or **pull image** (if Docker source)
2. **Build Docker images** using the configured Dockerfiles
3. **Push images** to the server
4. **Verify builds** — Ensure images are valid and contain expected artifacts

Build logs are streamed in real-time so you can monitor progress and catch any issues.

## Stage 6: Deployment

Finally, your application is deployed:

1. **Start containers** in the correct order based on dependencies
2. **Configure networking** between services
3. **Set up reverse proxy** (Nginx/Traefik) for routing
4. **Provision SSL** certificates
5. **Run health checks** to verify everything is working
6. **Configure domains** to point to the new deployment

![Deployment complete — services are running and accessible](/images/docs/chat-hydron.png)

## After deployment

Once your app is live, you can:

- **Monitor** health status and resource usage
- **View logs** in real-time from any service
- **Redeploy** with code changes
- **Scale** by upgrading server specifications
- **SSH in** for direct server access

## Architecture overview

Hydron consists of several internal services working together:

- **Frontend** (React) — The user interface you interact with
- **Backend** (Express) — API server managing business logic
- **Code Analyzer** — Service that scans and analyzes repositories
- **Code Deployer** — Service that builds Docker images and deploys them
- **DevOps Runner** — Orchestration service for server provisioning
- **LLM** (Claude) — AI engine making intelligent decisions at each stage

The AI orchestrates the entire process, making intelligent decisions at each stage based on your code and requirements.
