FORGE
Stop Assembling. Start Building.
You didn't sign up to be a distributed systems engineer. You signed up to build products.
Yet here you are, wiring up Redis for caching, Kafka for events, BullMQ for jobs, a separate cron daemon, and praying they all stay in sync. Your docker-compose.yml has more services than your app has features.
FORGE compiles your entire backend into one binary: API, jobs, crons, workflows, real-time subscriptions. The only dependency? PostgreSQL. That's it.
|
&&
forge dev runs Docker Compose with PostgreSQL, backend, and frontend. Use forge dev down --clear to reset everything.
The Problem
Modern backend development has become infrastructure theater:
Your Typical Stack What You Actually Need
─────────────────── ────────────────────────
API Server (Express/FastAPI) Handle HTTP requests
Redis Remember things temporarily
Kafka/RabbitMQ Process things later
BullMQ/Celery Run background jobs
Cron daemon Do things on schedule
WebSocket server Push updates to clients
Prometheus + Grafana Know what's happening
Seven systems. Seven failure points. Seven things to deploy, monitor, and debug at 3 AM.
PostgreSQL already does all of this. SKIP LOCKED for job queues. LISTEN/NOTIFY for pub/sub. Advisory locks for coordination. You just need a framework that uses them properly.
What FORGE Actually Does
1. Queries and Mutations (Your API)
pub async
pub async
These become /_api/rpc/get_user and /_api/rpc/create_user automatically. A fully typed TypeScript client is generated. No routing. No fetch wrappers. No manual type definitions.
Mutations run inside a database transaction. The dispatch_job call above doesn't fire immediately. It gets buffered and inserted atomically when the transaction commits. If the mutation fails, the job never gets created. No orphaned jobs, no missing side effects.
2. Background Jobs (Things That Take Time)
pub async
Jobs are persisted in PostgreSQL, survive restarts, retry with backoff, and report progress in real-time. No Redis. No separate worker process.
3. Scheduled Tasks (Cron Without the Daemon)
// 9 AM daily
pub async
Cron scheduling with timezone support, catch-up for missed runs, and structured logging. Runs in the same process.
4. Durable Workflows (Multi-Step Processes That Don't Break)
// Bump when changing step order. In-flight workflows keep their original version.
pub async
Deploy new code, restart servers, scale up or down. The workflow picks up right where it left off. Sleep for 45 days, and it just works. Compensation (rollback) runs automatically if later steps fail. This is durable execution without running a separate orchestration cluster.
5. Real-Time Subscriptions (Live Data, No Extra Work)
<script lang="ts">
import { subscribe } from '$lib/forge';
// This auto-updates when data changes. Any client, anywhere.
const users = subscribe('list_users', {});
</script>
{#each $users.data ?? [] as user}
<div>{user.email}</div>
{/each}
Under the hood: Compile-time SQL parsing extracts all table dependencies (including JOINs and subqueries) → PostgreSQL triggers fire NOTIFY on changes → FORGE re-runs affected queries → SSE pushes diffs to clients.
No manual cache invalidation. No pub/sub wiring. Just reactive queries.
6. Webhooks (Receive External Events)
pub async
Signature validation, idempotency tracking, and job dispatch in one handler. Supports HMAC and RSA signatures.
7. MCP Tools (Give AI Agents Access)
pub async
Expose any function as an MCP tool. LLM agents can call your backend with the same auth, rate limiting, and validation as regular API calls. One macro, same business logic.
The Architecture
┌──────────────────────────────────────────────────┐
│ forge run │
├─────────────┬─────────────┬─────────────┤
│ Gateway │ Workers │ Scheduler │
│ (HTTP/SSE) │ (Jobs) │ (Cron) │
└──────┬──────┴──────┬──────┴──────┬──────┘
│ │ │
└─────────────┴──────┬──────┘
│
┌──────▼──────┐
│ PostgreSQL │
└─────────────┘
One process. Multiple subsystems handle different concerns:
- Gateway: HTTP/SSE server (built on Axum)
- Workers: Pull jobs from PostgreSQL using
SKIP LOCKED - Scheduler: Leader-elected cron runner (advisory locks prevent duplicate runs)
- Daemons: Long-running singleton processes with leader election
Scale horizontally by running multiple instances. They coordinate through PostgreSQL. No service mesh, no gossip protocol, no Redis cluster.
Crate Layout
forge → Public API, Forge::builder(), prelude, CLI
├── forge-runtime → Gateway, function router, job worker, workflow executor, cron scheduler
│ ├── forge-core → Types, traits, error types, contexts, schema definitions
│ └── forge-macros → #[query], #[mutation], #[job], #[workflow], #[cron]
└── forge-codegen → TypeScript/Svelte client generator
Type Safety, End to End
FORGE generates TypeScript types from your Rust models:
// Rust: your source of truth
// TypeScript: generated automatically
export interface User {
id: string;
email: string;
role: UserRole;
created_at: string;
}
export type UserRole = 'Admin' | 'Member' | 'Guest';
// API client is also generated
import { api } from '$lib/forge';
const user = await api.get_user({ id: '...' }); // Fully typed
If your Rust code compiles, your frontend types are correct. This eliminates an entire class of "worked in dev, broke in prod" bugs.
Why Not Just Use...
| FORGE | Supabase | Firebase | PocketBase | |
|---|---|---|---|---|
| Background Jobs | Built-in | External | Cloud Functions | ❌ |
| Durable Workflows | Built-in | ❌ | ❌ | ❌ |
| Cron Scheduling | Built-in | External | Cloud Scheduler | ❌ |
| Query Caching | Built-in | ❌ | ❌ | ❌ |
| Rate Limiting | Built-in | ❌ | ❌ | ❌ |
| Real-time | Built-in | Built-in | Built-in | ❌ |
| Webhooks | Built-in | ❌ | Cloud Functions | ❌ |
| MCP Tools | Built-in | ❌ | ❌ | ❌ |
| Full Type Safety | Rust → TS | Partial | ❌ | ❌ |
| Self-Hosted | One binary | Complex | ❌ | One binary |
| Vendor Lock-in | None | Low | High | None |
| Database | PostgreSQL | PostgreSQL | Firestore | SQLite |
vs. Temporal/Inngest: FORGE workflows run in-process with no separate orchestration service, but you lose some features. If you need child workflows, signals, or advanced versioning, use Temporal. If you need durable multi-step processes without the ops overhead, FORGE handles that.
vs. Node.js + BullMQ + etc.: FORGE trades ecosystem breadth for operational simplicity. You get fewer npm packages but also fewer 3 AM pages about Redis running out of memory.
Getting Started
# Install
|
# Or: cargo install forgex
# Create and run
# → Frontend at http://localhost:5173
# → Backend at http://localhost:8080
# → PostgreSQL at localhost:5432
forge dev runs Docker Compose with PostgreSQL, a cargo-watch backend, and a Vite frontend. All three services start together and stop with Ctrl+C.
The --demo flag scaffolds a working app with examples of queries, mutations, jobs, crons, and workflows. Or use --minimal for a clean slate.
Scaffold new components without writing boilerplate:
forge generate syncs TypeScript types from your Rust models. forge check validates config, migrations, function signatures, and frontend setup.
Deployment
The release binary embeds the frontend build and the Forge runtime. One file to deploy. Point it at a PostgreSQL instance and it runs.
Check out the examples for working apps you can run with docker compose up.
Who's This For
FORGE is opinionated. It's designed for:
- Solo developers and small teams building SaaS products who don't want to manage infrastructure
- Teams who value reliability: no null pointer exceptions, no "undefined is not a function", errors caught at compile time
- Anyone tired of gluing together 7 different services for basic backend functionality
Probably not the right fit if:
- You have a dedicated platform team and need fine-grained control over each component
- You're building for millions of concurrent users (FORGE targets ~100k MAU comfortably)
- You need deep integration with cloud-native services (Lambda, DynamoDB, Pub/Sub)
Project Maturity
FORGE is pre-1.0. Expect breaking changes between releases. Not ready for production yet. Good for side projects, internal tools, and kicking the tires.
Breaking changes are documented in CHANGELOG.md. Pin your version if you need stability. Once the core API settles, we will cut 1.0 and commit to semver.
License
MIT. Do whatever you want.