Skip to content

About

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

StackForge 🏗️

StackForge turns a plain-English product idea into a structured full-stack project blueprint: stack, folder layout, data model, API routes, frontend pages, infra plan, review notes, and optional generated source files. Specialized LLM stages each produce one part, and the web dashboard streams their progress live over Server-Sent Events.


Architecture at a glance

apps/web  ──/api──▶  apps/api ──▶ packages/agents ──▶ LLMProvider (OpenRouter | NVIDIA | mock)
 (Vite/React)        (Express,     runOrchestrator
                      job store,    └ WorkflowEngine (ordering, state)
                      SSE)            └ AgentStepExecutor (one stage)
                                   packages/shared: zod schemas + types used everywhere
  • Pipeline: planner → schema → api → frontend → devops → reviewer → codegen. Feature-add prompts run the first five stages, and setting enableCodeGeneration: false drops codegen.
  • AgentStepExecutor: the interface for running one stage. The default ProviderStepExecutor calls the LLM. Tests can pass their own executor to runOrchestrator.
  • Job store: jobs live in memory with a TTL (200 jobs max, evicted 1 hour after finishing). Each job records currentStage and, when a stage fails, a structured failure (stage, stepId, message). Jobs do not survive a restart.

Requirements

  • Bun 1.3+ (runtime, package manager, test runner)
  • Git

The stack is TypeScript (strict mode), Express, React + Vite, Zod, and Turborepo.


Setup

git clone https://github.com/7vignesh/stackforge.git
cd stackforge
bun install
cp apps/api/.env.example apps/api/.env   # optional: add OpenRouter keys

With no API keys set, the API uses the deterministic mock provider (STACKFORGE_PROVIDER=auto).

Run locally

bun run api:dev                      # API on http://localhost:3001
cd apps/web && bun run dev           # web on http://localhost:5173 (proxies /api to :3001)
bun run dev                          # or start every package's dev task through Turbo

To stream a run in the terminal, start the API and then run:

bun run scripts/demo.ts
bun run scripts/demo.ts --prompt "Build a CRM for real estate agents with PostgreSQL"

Test, typecheck, build

bun run typecheck   # tsc --noEmit in every package
bun run test        # bun test in apps/api and packages/agents
bun run build       # tsc for packages and api, vite build for web

CI (.github/workflows/ci.yml) runs these three commands on every push to main and on every pull request. No API keys are needed for any of them.

Repository layout

apps/
  api/          Express API: generate, jobs, SSE stream, download, GitHub push, add-feature
  web/          Vite + React dashboard (deployed to Vercel)
packages/
  agents/       Pipeline, WorkflowEngine, AgentStepExecutor, providers, cache, skills
  shared/       Zod schemas and types (requests, jobs, SSE events, blueprint)
  ui/           Shared React UI primitives
scripts/
  demo.ts       Terminal SSE demo client

⚙️ OpenRouter Runtime Configuration

Set these variables in apps/api/.env:

STACKFORGE_PROVIDER=openrouter
OPENROUTER_API_KEY=your_key_here   # or OPENROUTER_API_KEY_1/_2/_3 for key rotation
OPENROUTER_ENDPOINT=https://openrouter.ai/api/v1/chat/completions
OPENROUTER_APP_NAME=stackforge-api
OPENROUTER_APP_URL=http://localhost:3001

STACKFORGE_PROVIDER supports:

  • openrouter: forces real LLM execution (requires OPENROUTER_API_KEY)
  • mock: forces deterministic offline agent responses
  • omitted/auto: uses openrouter when API key is present, otherwise mock

Runtime/provider health is exposed at:

  • GET /api/runtime

📉 Token Tuning Guide

Per-agent tuning lives in packages/agents/src/config/agent.configs.ts.

  • maxInputTokens: hard input cap used by optimizer compression.
  • maxOutputTokens: maximum completion tokens requested from provider.
  • minOutputTokens: minimum output budget required after compression.
  • tokenBudget: total budget target used to derive dynamic output caps.
  • compressionLevel: default compression aggressiveness (low / medium / high).
  • budgetOverflowRetries: number of extra compression passes before fail-fast.

Suggested workflow:

  1. Run 3–5 representative prompts.
  2. Inspect per-agent SSE agent_completed telemetry.
  3. Lower maxInputTokens or raise compressionLevel for agents with high inputTokens.
  4. Lower maxOutputTokens for agents with consistently low outputTokens.
  5. Raise minOutputTokens only if quality drops from over-compression.
  6. Adjust tokenBudget to set overall cost/quality tradeoff for the entire orchestration.

Roadmap

  • v1 (this release): a 7-stage blueprint pipeline, the AgentStepExecutor boundary, step-level failure reporting, and an in-memory job store.
  • Phase 2: the loop engine (packages/loop-core and apps/mcp on the feat/loop-engine branch) is intentionally kept out of v1. It will be extracted into its own repository. main has no dependency on it.

About

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages