What is Nitric?
Nitric is a cloud-agnostic serverless framework that lets you build applications without locking into AWS, GCP, or Azure. Define your resources in code — deploy to any cloud with a single command.
Quick Start
npm install -g @nitric/cli
nitric new my-app ts-starter
cd my-app
npm install
nitric start
Define APIs
import { api } from "@nitric/sdk";
const mainApi = api("main");
mainApi.get("/users/:id", async (ctx) => {
const { id } = ctx.req.params;
const user = await getUser(id);
ctx.res.json(user);
});
mainApi.post("/users", async (ctx) => {
const body = ctx.req.json();
const user = await createUser(body);
ctx.res.status = 201;
ctx.res.json(user);
});
mainApi.delete("/users/:id", async (ctx) => {
await deleteUser(ctx.req.params.id);
ctx.res.status = 204;
});
Key-Value Storage
import { kv } from "@nitric/sdk";
const profiles = kv("profiles").allow("get", "set", "delete");
// Set value
await profiles.set("user-123", {
name: "Alice",
email: "alice@example.com",
plan: "pro",
});
// Get value
const user = await profiles.get("user-123");
console.log(user.name); // "Alice"
// Delete value
await profiles.delete("user-123");
Buckets (File Storage)
import { bucket } from "@nitric/sdk";
const uploads = bucket("uploads").allow("read", "write", "delete");
// Write file
await uploads.file("reports/q1-2026.pdf").write(pdfBuffer);
// Read file
const data = await uploads.file("reports/q1-2026.pdf").read();
// Generate signed URL (for client uploads)
const url = await uploads.file("user-avatar.jpg").getUploadUrl();
Topics (Pub/Sub)
import { topic } from "@nitric/sdk";
const orderEvents = topic("orders").allow("publish");
// Publish
await orderEvents.publish({
type: "order.created",
orderId: "ord_789",
total: 149.99,
});
// Subscribe
topic("orders").subscribe(async (ctx) => {
const event = ctx.req.json();
console.log(`New order: ${event.orderId}`);
await sendConfirmationEmail(event);
});
Schedules
import { schedule } from "@nitric/sdk";
schedule("daily-report").every("1 day", async () => {
const metrics = await gatherMetrics();
await sendReport(metrics);
});
schedule("cleanup").every("6 hours", async () => {
await cleanExpiredSessions();
});
Secrets
import { secret } from "@nitric/sdk";
const apiKey = secret("stripe-key").allow("access");
const stripeKey = await apiKey.latest().access();
console.log(stripeKey.asString());
Deploy to Any Cloud
# nitric.yaml
name: my-app
services:
- match: services/*.ts
start: npx tsx $SERVICE_PATH
# Deploy to AWS
nitric up --provider aws
# Deploy to GCP
nitric up --provider gcp
# Deploy to Azure
nitric up --provider azure
Same code, any cloud. Switch providers without changing application code.
Nitric vs Other Frameworks
| Feature | Nitric | SST | Serverless Framework |
|---|---|---|---|
| Cloud-agnostic | Yes | AWS only | AWS/Azure |
| Language | TS/Python/Go/Java | TS | YAML + any |
| Local dev | Built-in emulator | Live AWS | Offline plugin |
| Resources in code | Yes | Yes | YAML |
Need cloud-agnostic serverless architecture?
📧 spinov001@gmail.com
🔧 My tools on Apify Store
Cloud-agnostic or cloud-native — what's your approach? Comment!
Top comments (0)