π Gati β Product Requirements Document (PRD) β
Version: 0.1 (Draft)
Project Name: Gati (meaning "motion" or "progress" in Sanskrit)
Project Type: Solo-Led Open Source Framework
Author: Krishna Paul
Date: 2025-11-08
1. π Executive Summary β
Gati is an open-source JavaScript/TypeScript framework designed to enable developers to create infinitely scalable, cloud-native, modular applications, while abstracting the pains of infrastructure and versioning.
With Gati, developers focus only on business logic. The platform automatically handles:
- Kubernetes deployment
- Distributed scaling
- Versioned APIs (semantic & timestamp-based)
- Multi-cloud deploys (AWS, GCP, Azure)
- CDN + SSL provisioning
- Live control panel and API Playground
- Typed SDK generation for client-side apps
Gati = "Backend without backend hassle".
2. π― Goals & Objectives β
| Goal | Description |
|---|---|
| β Empower developers | Focus only on handlers, modules, effects |
| β Provide future-proof APIs | Auto semantic + timestamp versioning |
| β Scale seamlessly | Kubernetes-native with auto scaling & routing |
| β Support multi-region | Integrated CDN + global deployment plugins |
| β Type-safe clients | Auto generate SDKs from handler signatures |
| β Built-in monitoring | Admin UI with logs, metrics, live topology |
| β Polyglot extensibility | Support modules from NPM, Docker (Rust/Go/Python), local files |
| β Hot-loadable architecture | Zero-downtime module swapping and version updates |
3. π§± Architecture Overview β
Client
β
CDN + Auto SSL
β
App Core (version resolver, router)
β
Route Manager (global context, runtime scaling)
β
Handlers β Modules β Databases or Effect Queue β WorkersApp Core: Global router that handles version resolution and client metadata.Route Manager: Container-per-domain managing business logic entrypoints and scaling.Handler: Pluggable functions implementing HTTP routes.Module: Stateless, composable logic (reusable across handlers).Effect Worker: Long-running and retryable tasks.
4. π§ Core Features β
4.1 Handlers & Modules β
Handler example:
export const route = 'POST /payments/:id/capture';
export async function handler(req, res, gctx, lctx) {
const ok = await gctx.modules.ledger.reserve(req.params.id, req.body.amount);
if (!ok) {
res.status = 409;
return res.json({ error: 'ReservationFailed' });
}
await gctx.effects.enqueue('capturePayment', { id: req.params.id });
res.status = 202;
res.body = { state: 'capturing' };
}req,res: Passed through pipeline (mutable)gctx: Global context for DB, modules, effects, queuelctx: Local context (per handler and request)
4.2 Versioned API Routing β
Auto-diffs handlers to assign semantic version bump
Deployment stores snapshot with timestamp
Client header:
X-API-Version: 2025-11-09T10:00:00Z
If version missing β return options with available versions.
4.3 Cloud Deployment Plugins β
Built-in:
@gati/cloud-aws,@gati/cloud-gcp,@gati/cloud-azureHandles:
- Kubernetes deploy
- Per-region service scaling
- CDN (CloudFront, Cloud CDN, Azure Front Door)
- Auto SSL via ACM or Letβs Encrypt
Custom provider example:
provider: custom
cdnScript: ./scripts/cdn.sh
deployScript: ./scripts/deploy.sh4.4 Control Panel β
Mounted at:
/_controlIncludes:
- Deployment graph
- Status and live tracing
- Logs & metrics (from Loki, Prometheus)
- Rollback, scaling, config editor
Auth:
- Passkey (WebAuthn)
- TOTP (RFC 6238)
4.5 API Playground β
Route explorer with:
- Pre/post scripts using isolated VM
- WebSockets testing
- Supports bearer auth and session reuse
- Exportable as integration test flows
4.6 CLI & Code Generator β
Commands:
gati dev
gati build
gati deploy [env]
gati generate # typed clientgenerates β
.gati/generated/client.tsβ typed clients, version aware.gati/generated/context.tsβ local/global context types/sdk/appname-<semver>.tgzβ publishable package
5. π§ͺ Developer Workflow Example β
1. Write handler in /src/handlers/payments/capture.ts
2. Link modules & effects in route manager
3. Run `gati dev` and test locally
4. Commit, merge β CI runs `gati build && gati deploy prod`
5. Use generated SDK in frontend: `npm i @gati/payments-client`
6. Inspect version & topology in GUI `/control`6. π‘ Technical Stack β
| Layer | Stack |
|---|---|
| Runtime | Node.js 20, Fastify, TypeScript |
| PaaS | Kubernetes (AKS, EKS, GKE) |
| Deployment | GitHub Actions / Argo CD |
| CDN | CloudFront, Cloudflare, etc |
| Observability | OpenTelemetry, Loki, Prometheus |
| Queues | SQS, Pub/Sub, Azure Queue |
7. π§ Technical Milestones β
| Milestone | Scope | Status |
|---|---|---|
| M1 | Handler/Module runtime with CLI | β Complete |
| M2 | Kubernetes deploy + AWS plugin | β³ Pending |
| M3 | Version diff analyzer | β³ Pending |
| M4 | Control Panel (limited) + Logs | β³ Pending |
| M5 | SDK codegen + Playground | β³ Pending |
| M6 | CDN + SSL automation | β³ Pending |
| M7 | Effects + async jobs | β³ Pending |
| M8 | Dynamic Module System & Extensibility | β³ Pending |
M8 Highlights:
- π Multi-source modules: NPM, Docker (Rust/Go/Python), local files
- β»οΈ Hot-reload with zero downtime
- π Polyglot support via containerized modules
- π¦ Module marketplace ecosystem
- π Per-component autoscaling
8. π§ KPIs for Success β
| KPI | Target | Layer/Phase |
|---|---|---|
| Dev setup time | β€5 min | M1 |
| No-downtime deploy | Every version | M2-M3 |
| Auto-generated types | <50ms per type | M5 / Phase 2 |
| Validator performance | 2-5Γ faster vs Zod | Phase 2 |
| Route lookup | <0.5ms | Phase 3 |
| Handler invocation | <1ms overhead | Phase 3 |
| Middleware chain | <5ms total | Phase 4 |
| E2E request p50 | <30ms | Phase 6 |
| E2E request p95 | <100ms | Phase 6 |
| E2E request p99 | <300ms | Phase 6 |
| Analyzer incremental | <100ms | Phase 2 |
| Startup (100 routes + DB) | <500ms | Phase 6 |
| Regional failover | β€30s | M6 |
| Logs/metrics coverage | 100% | M4 / Phase 6 |
| Benchmark regression rate | <5% of PRs flagged | Phase 6 onward |
Performance SLOs:
- Availability: 99.95%
- Request Success Rate: 99.9%
- p50 Latency: <30ms
- p95 Latency: <100ms
- p99 Latency: <300ms
See Also:
- Performance Guide - Complete latency budgets
- Benchmarking Guide - Benchmark specifications
- Milestones - Phased delivery plan
9. π― Performance-First Architecture β
10-Layer Model β
Gati is built on a performance-first, layered architecture with specific latency budgets per layer:
| Layer | Responsibility | Target Latency |
|---|---|---|
| 1. Developer Tooling | File watching, hot reload, analyzer | <100ms incremental |
| 2. File-Based Router | Route discovery, param extraction | <0.5ms lookup |
| 3. Gati Analyzer | AST parsing, type extraction, GType | <50ms single file |
| 4. Artifact Generators | Validators, .d.ts, DB schemas | <50ms per type |
| 5. Protocol Gateways | HTTP, WebSocket, RPC adapters | 0.5-2ms |
| 6. Middleware Chain | Auth, CORS, rate limit, tracing | <5ms total |
| 7. Context Builder | gctx + lctx β ctx merge | <0.2ms |
| 8. Handler Engine | Invocation, validation, errors | <1ms overhead |
| 9. DB Client | Query builder, type safety | <2ms overhead |
| 10. External Systems | Postgres, Redis, S3 | 5-100+ ms (network) |
Critical Path (Layers 2, 5-9): Combined overhead target <10ms excluding database network I/O.
Benchmarking Infrastructure β
Gati includes comprehensive benchmarking:
- 6 Micro-benchmark Suites: Validator, routing, middleware, startup, analyzer, RPS
- Baseline Management: Automated regression detection
- CI Integration: Nightly benchmarks + PR performance guards
- Load Testing: Artillery and k6 examples included
10. π Out of Scope (for now) β
- RPC runtime (future addition)
- Multi-language module DSL
- Auth server as a product
- Built-in identity federation
10. π License β
- License: MIT (planned)
- Contributions: Open to issues, discussions, plugins
11. β Next Steps β
- Scaffold project structure
- Implement handler runtime and CLI
- Build and test AWS deployment plugin
- Create roadmap docs and contribution guide
Welcome to the journey β Gati is motion in code.