# Request paths

> A push, a pull request merge, and a mirror, step by step.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://git.docs.sypnia.com/architecture/request-paths/

For agents: Push over HTTPS: CloudFront → Sypnia layer auth (Sypnia token/syp_git_ token → engine user) → Forgejo smart HTTP → pre-receive hook calls Sypnia layer (protection rules, size limits) → objects written → post-receive event → SQS → Case: trailer reader, Run trigger, webhooks, mirror job. SSH: NLB → Forgejo SSH server (key lookup via Sypnia layer) → same hooks. Merge: API → rules check (approvals, required statuses) → engine merge → events. Mirror: job pushes refs to GitHub with the App's installation token; conflicts handled per mirroring rules.

## A push

1. **HTTPS** goes through CloudFront to Sypnia's layer, which checks the token (your session's, or an HTTPS token) and passes the request to the engine as you. **SSH** goes through a load balancer to the engine's SSH server, which asks our layer whose key it is.
2. Before accepting, a **pre-receive hook** asks our layer: is this branch protected? is the push too big?
3. The engine writes the objects.
4. A **post-receive event** goes to the queue; workers read the `Case:` trailers, ask Run for a preview, send webhooks and update mirrors.

## Merging a pull request

The API checks the branch rules (approvals, required checks, linear history), asks the engine to merge, and emits the same events as a push.

## A mirror

A job pushes the changed refs to GitHub with the Sypnia GitHub App's short-lived installation token. Nothing comes back from GitHub: a ref changed there is overwritten by the next update ([Mirroring](https://git.docs.sypnia.com/migrate/mirroring)).
