Quick Start Guide â
Get your first Gati application running in under 5 minutes!
Prerequisites â
- Node.js 18 or higher
- pnpm (recommended) or npm
- Docker (optional, for local Kubernetes deployment)
# Check your versions
node --version # Should be v18.0.0 or higher
pnpm --version # Should be 8.0.0 or higherStep 1: Create Your Project â
Use gatic to create a new Gati application:
npx gatic create my-first-appYou'll see:
ð Creating Gati project: my-first-app
â Copying template files...
â Initializing package.json...
â Installing dependencies...
âĻ Project created successfully!
Next steps:
cd my-first-app
pnpm devThis creates a complete project structure:
my-first-app/
âââ src/
â âââ index.ts # App entry point
â âââ handlers/
â â âââ hello.ts # Example handler
â âââ modules/ # Reusable modules
âââ gati.config.ts # Gati configuration
âââ package.json
âââ tsconfig.json
âââ README.mdStep 2: Start Development Server â
cd my-first-app
pnpm devOutput:
ð Gati development server starting...
â Loaded 1 handler
â Server running at http://localhost:3000
â Hot reload enabled
Press Ctrl+C to stopStep 3: Test Your First Handler â
Open your browser or use curl:
curl http://localhost:3000/api/helloResponse:
{
"message": "Hello from Gati!",
"timestamp": "2025-11-12T10:30:00.000Z"
}Step 4: Create a New Handler â
Create src/handlers/users/[id].ts:
import type { Handler } from '@gati-framework/runtime';
export const handler: Handler = async (req, res, gctx, lctx) => {
const userId = req.params.id;
// Example: fetch user from database module
const db = gctx.modules['database'];
const user = await db?.users.findById(userId) || {
id: userId,
name: 'John Doe',
email: 'john@example.com'
};
res.json({ user });
};The handler is automatically discovered and available at /api/users/:id with hot reloading enabled.
Test it:
curl http://localhost:3000/api/users/123Response:
{
"user": {
"id": "123",
"name": "John Doe",
"email": "john@example.com"
}
}Step 5: Add Query Parameters â
Update src/handlers/users/[id].ts:
export const handler: Handler = async (req, res, gctx, lctx) => {
const userId = req.params.id;
const includeOrders = req.query.includeOrders === 'true';
const user = {
id: userId,
name: 'John Doe',
email: 'john@example.com',
...(includeOrders && {
orders: [
{ id: 1, total: 99.99 },
{ id: 2, total: 149.99 }
]
})
};
res.json({ user });
};Notice how the file automatically reloads when you save - no server restart needed!
Test with query params:
curl http://localhost:3000/api/users/123?includeOrders=trueStep 6: Build for Production â
pnpm buildThis creates an optimized production build in dist/:
â TypeScript compiled successfully
â Build output: dist/Step 7: Deploy to Local Kubernetes â
Ensure Docker is running, then:
gati deploy dev --localGati will:
- â Create a local Kubernetes cluster (kind)
- â Build Docker image
- â Deploy your application
- â Wait for rollout to complete
- â Run health checks
Output:
ð Deploying to local Kubernetes...
â kind cluster created
â Docker image built: my-first-app:latest
â Image loaded into cluster
â Namespace created: my-first-app-dev
â Deployment created
â Waiting for rollout...
â Deployment ready (1/1 pods)
â Health check passed
ð Deployment successful!
Access your app:
kubectl port-forward -n my-first-app-dev svc/my-first-app 8080:3000
Then visit: http://localhost:8080Step 8: Access Your Deployed App â
kubectl port-forward -n my-first-app-dev svc/my-first-app 8080:3000Now test:
curl http://localhost:8080/api/helloQuick Reference â
Common Commands â
# Development
pnpm dev # Start dev server with hot reload
pnpm build # Build for production
pnpm start # Start production server
# Deployment
gati deploy dev --local # Deploy to local K8s
gati deploy dev --local --port-forward # Deploy with auto port-forward
gati deploy dev --dry-run # Generate manifests only
# Testing
pnpm test # Run tests
pnpm typecheck # Type checkingFile Structure â
src/
âââ index.ts # App initialization
âââ handlers/ # API handlers (auto-discovered)
â âââ hello.ts # GET /api/hello
â âââ users.ts # GET /api/users/:id
âââ modules/ # Reusable modules
â âââ database.ts # Example: database module
âââ middleware/ # Custom middleware (optional)
âââ auth.ts # Example: auth middlewareHandler Conventions â
Handlers are automatically mapped to routes based on their filename:
| File | Route |
|---|---|
handlers/hello.ts | /api/hello |
handlers/users/[id].ts | /api/users/:id |
handlers/posts/create.ts | /api/posts/create |
handlers/posts/[id]/comments.ts | /api/posts/:id/comments |
Key Features:
- ðĨ Hot Reloading: Changes appear instantly (50-200ms)
- ⥠High Performance: 172K RPS, <6Ξs latency
- ðĶ Manifest System: Auto-generated from handlers
- ðŪ Playground: Visual debugging at
/__playground - ð Built-in Health Checks:
/healthendpoint included
Next Steps â
Learn More â
- Getting Started Guide - Comprehensive tutorial
- Handlers Guide - Deep dive into handlers
- Modules Guide - Create reusable modules
- Deployment Guide - Advanced deployment options
Explore Examples â
- Hello World - Basic example
- REST API - Full REST API example
Join the Community â
- GitHub - Source code
- Issues - Report bugs
- Discussions - Ask questions
Troubleshooting â
Port 3000 Already in Use â
# Change port in gati.config.ts
export default {
port: 3001
};Docker Not Running â
# Start Docker Desktop or Docker daemon
# On Windows: Start Docker Desktop
# On Mac: Start Docker Desktop
# On Linux: sudo systemctl start dockerBuild Errors â
# Clean and reinstall dependencies
rm -rf node_modules dist
pnpm install
pnpm buildSummary â
You've successfully:
- â Created a Gati project
- â Started the development server
- â Created API handlers
- â Built for production
- â Deployed to Kubernetes
Total time: ~5 minutes âĄ
Ready to build something awesome? Head to the Getting Started Guide for more advanced features!
Last Updated: November 25, 2025