Infrastructure Runtime + AWS Orchestration Platform
Gatehouse is a self-hosted infrastructure orchestration platform built with:
- SvelteKit
- TypeScript
- SQLite initially
- AWS SDK v3
- NGINX
- Local runtime orchestration
The platform is designed to manage:
- reverse proxy routing
- static site hosting
- internal services
- AWS Route53 DNS
- AWS S3 storage
- SSL certificates
- deployment infrastructure
- local machine runtime state
The system is NOT Kubernetes.
The system is NOT a distributed control plane.
The system is a local infrastructure runtime platform that owns and orchestrates infrastructure resources declaratively.
Gatehouse is built around:
Resources
→ Providers
→ Reconciliation
→ RuntimeThe platform is declarative.
Users define desired infrastructure state.
Providers reconcile real infrastructure into that desired state.
The database stores desired state.
Providers reconcile runtime state.
Infrastructure is generated from structured resources.
Gatehouse NEVER stores raw nginx configs.
Instead:
Resource
→ Renderer
→ Generated Runtime ConfigGenerated configs are deterministic.
Same input → same output.
Gatehouse owns its own runtime directory.
NGINX consumes Gatehouse-generated configs.
Gatehouse does NOT integrate itself into nginx system architecture.
Instead nginx includes Gatehouse runtime configs.
The system separates:
Validation
Rendering
Runtime Application
Reconciliation
PersistenceThese are independent systems.
runtime/
├── generated/
│ ├── nginx/
│ ├── certs/
│ └── state/
│
├── templates/
│ └── nginx/
│
├── bin/
│
└── install/
├── linux/
├── macos/
└── docker/NGINX includes Gatehouse-generated configs:
include /path/to/runtime/generated/nginx/*.conf;Gatehouse owns:
- generation
- rendering
- runtime files
NGINX merely consumes them.
Gatehouse is built around generic resources.
Resource
↓
Validation
↓
Provider Resolution
↓
Reconciliation
↓
Renderer
↓
Runtime ApplicationAll resources derive from:
BaseResource<TKind, TSpec>;Resources contain:
- metadata
- desired state
- runtime state
- reconciliation status
- provider ownership
Represents:
- reverse proxy routes
- static sites
api.example.com
↓
localhost:3001app.example.com
↓
/srv/sites/appRepresents:
- node services
- bun services
- docker services
- binaries
Services may later support:
- lifecycle management
- monitoring
- deployments
Represents:
- SSL certificates
- wildcard certificates
- ACM certificates
Represents:
- Route53 records
- DNS state
Represents:
- local storage
- S3 buckets
Represents:
- deployable static sites
- S3 deployment targets
- local static deployment
Providers reconcile infrastructure.
Current planned providers:
providers/
├── nginx/
├── filesystem/
├── aws/
│ ├── route53/
│ ├── s3/
│ └── acm/Each provider contains:
validate.ts
render.ts
runtime.ts
reconcile.tsEnsures resource validity.
Pure deterministic rendering.
NO IO.
Performs filesystem/system mutations.
Coordinates:
- validation
- rendering
- runtime application
The reconciliation engine resolves:
- resource kind
- provider
- dependency order
Then invokes the correct provider reconciler.
Resources may depend on other resources.
Example:
Endpoint
depends on
Certificate
depends on
DNS RecordThe reconciliation engine will eventually reconcile resources in dependency order.
Resources contain runtime state separately from desired state.
Examples:
- last reconciliation
- health
- last error
- status messages
This prevents mixing:
- desired configuration
- live runtime state
Initial database:
- SQLite
- single
resourcestable
Resources store:
- metadata
- spec
- runtime state
- provider
- status
Specs are initially stored as JSON.
Normalization may occur later.
Gatehouse is built server-first.
All infrastructure logic lives in:
src/lib/server/Frontend UI remains thin.
src/
├── lib/
│ └── server/
│ ├── core/
│ ├── db/
│ ├── providers/
│ ├── reconciliation/
│ ├── resources/
│ ├── runtime/
│ └── shell/
│
├── routes/
│
└── types/
└── ambient.d.tsAll system commands flow through:
shell/
├── exec.ts
├── sudo.ts
└── spawn.tsThis centralizes:
- process execution
- logging
- permissions
- error handling
Gatehouse installs itself.
Users should NOT:
- manually edit nginx
- manually edit sudoers
- manually create runtime dirs
Instead:
bun run installshould:
- initialize runtime
- initialize DB
- install runtime files
- configure integrations
- verify environment
Infrastructure access is tightly scoped.
The app itself should not run fully privileged.
Runtime helpers should be isolated and minimal.
The immediate goal is:
Create endpoint
↓
Persist resource
↓
Reconcile resource
↓
Generate nginx config
↓
Reload nginx
↓
Route becomes live- Route53
- S3
- ACM
- CloudFront
- nginx orchestration
- filesystem management
- service management
- static hosting
- static deployments
- S3 sync
- CloudFront invalidation
- service deployments
- health checks
- reconciliation status
- runtime diagnostics
- audit logs
Gatehouse is NOT:
- Kubernetes
- a distributed control plane
- a cluster orchestrator
- a service mesh
The platform is intentionally:
- local-first
- deterministic
- infrastructure-focused
- lightweight
Architecture phase.
Core systems defined:
- resource system
- provider system
- reconciliation architecture
- runtime ownership model
- nginx ownership model
- runtime directory structure
Next step: implement core runtime and reconciliation engine.