Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ But first: config files, deployment setup, secret management, debugging infrastr
jack removes the friction between your idea and a live URL.

```bash
bunx @getjack/jack new my-app # → deployed. live. done.
curl -fsSL docs.getjack.org/install.sh | bash
jack new my-app # → deployed. live. done.
```

That's it. Write code. Ship again with `jack ship`. Stay in flow.
Expand All @@ -51,15 +52,14 @@ That's it. Write code. Ship again with `jack ship`. Stay in flow.
## Quick Start

```bash
# One command to create and deploy
bunx @getjack/jack new my-app
# Install (CLI + MCP for your AI editor)
curl -fsSL docs.getjack.org/install.sh | bash

# Or install globally
bun add -g @getjack/jack
# Create and deploy
jack new my-app
```

You'll need [Bun](https://bun.sh) and a Cloudflare account (free tier works).
Or try without installing: `npx -y @getjack/jack new my-app`

---

Expand Down
23 changes: 8 additions & 15 deletions apps/binding-proxy-worker/src/handlers/ai.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MeteringService } from "../metering";
import { QuotaManager } from "../quota";
import type { AIUsageDataPoint, Env } from "../types";
import type { AIUsageDataPoint, Env, ProxyIdentity } from "../types";

/**
* AI Proxy Handler - receives fetch requests from user workers and forwards to real AI.
Expand All @@ -11,7 +11,7 @@ import type { AIUsageDataPoint, Env } from "../types";
* 3. Proxy checks quota, forwards to real AI, meters usage
* 4. Response streamed back to user worker
*
* Context (project_id, org_id) is passed via X-Jack-* headers.
* Identity is resolved by ProxyEntrypoint from ctx.props (set at deploy time).
*/
export class AIHandler {
private quotaManager: QuotaManager;
Expand All @@ -31,19 +31,12 @@ export class AIHandler {
/**
* Handle AI proxy request
*/
async handleRequest(request: Request, ctx: ExecutionContext): Promise<Response> {
// Extract context from headers
const projectId = request.headers.get("X-Jack-Project-ID");
const orgId = request.headers.get("X-Jack-Org-ID");

if (!projectId || !orgId) {
return Response.json(
{
error: "Missing project context headers. This proxy is for jack cloud deployments only.",
},
{ status: 400 },
);
}
async handleRequest(
request: Request,
ctx: ExecutionContext,
identity: ProxyIdentity,
): Promise<Response> {
const { projectId, orgId } = identity;

// 1. Rate limit check (burst protection - 100 req/10s per project)
const { success: rateLimitOk } = await this.rateLimiter.limit({ key: projectId });
Expand Down
Loading