A highly-scalable metadata-driven generative web application runtime
AppForge interprets natural language prompts via large language models, compiles them into a mathematically sound graphical JSON AST, and dynamically renders enterprise-grade B2B applications instantaneously directly inside the Web DOM.
- Overview
- Key Features
- Architecture
- Architecture by Component
- Repository Structure
- Tech Stack
- Why These Technologies?
- Core Application Flows
- Data Flow
- Database Architecture
- Authentication & Authorization
- Configuration (Env)
- Local Development
- Docker Deployment
- CI/CD & Testing
- Security & Error Handling
- Observability
- Debugging Guide
- Known Limitations (TODOs)
Traditional web applications require developers to hardcode layouts, map databases, and bind REST endpoints together manually. AppForge removes this friction by utilizing a real-time Generative Pipeline capable of compiling a robust application runtime in under 1.2s using Llama-3.3-70B. It is designed for enterprise prototyping—allowing non-technical users to build and securely deploy fully structural React dashboards instantly using only a textbox.
- Prompt-to-Software Copilot: The
CopilotPanelroutes raw user requests to an AI LLM, instantly returning a structured JSON DOM. - Serverless Semantic Caching: Prevents hallucination overhead and massive LLM generation latencies by instantly serving repeated prompts via Upstash Redis.
- Dynamic Postgres Sync Engine: AppForge intercepts the generated UI AST and dynamically executes runtime DDL (
CREATE TABLE/ALTER) on a Supabase database instance to provision identical backend architecture on the fly. - Background Event Brokerage: Every publish action instantly fires asynchronous fire-and-forget payloads into Upstash Kafka for decoupled business intelligence analytics.
- Production-grade Global Edge Routing: Clerk auth middleware secures the entire platform across 300+ Edge nodes, dynamically locking out unauthenticated bots from modifying global states.
- Smart Quota Sandboxing: Guests natively experience the system instantly up to a localized maximum ceiling before being seamlessly captured into the Authentication funnel.
| Application Dashboard | AI Copilot Workspace |
|---|---|
![]() |
![]() |
At a high level, AppForge operates within a hybrid SSR (Server-Side Rendered) matrix leveraging the Next.js Edge runtime, Supabase Data proxies, and an Event-Driven architecture cluster.
┌──────────────────────┐
│ AppForge Client │
│ (Copilot / Builder) │
└─────────┬────────────┘
Ask AI / Save │
(HTTP / Next.js RPC) │
▼
┌──────────────────────┐
│ Next.js App Router │
│ (Server Actions & API)│
│ + Clerk Middleware │
└────┬──────┬──────┬───┘
Event Pub │ │ Cache│ Auth / RPC
┌────────────┘ │ └────────────┐
▼ ▼ ▼
┌──────────────────┐ ┌────────────────┐ ┌───────────────────┐
│ Upstash Kafka │ │ Upstash Redis │ │ Supabase Postgres │
│ (Topic Streams) │ │ (Semantic Mem) │ │ (Schema + Apps) │
└──────────────────┘ └────────┬───────┘ └───────────────────┘
│
┌─────────┴────────┐
│ LLM Providers │
│ (Groq / Gemini) │
└──────────────────┘
- Responsibility: Ingest incoming user intents, securely rate-limit their IP, intercept against the Semantic Cache, and broker prompt executions out to the external GPU provider.
- Dependencies:
@ai-sdk/groq,@ai-sdk/google,@upstash/redis,@upstash/ratelimit. - Inputs: Natural Language text chunks.
- Outputs: Strictly bounded Text-stream representing stringified nested Zod JSON Arrays.
- Failure Modes: Explicit hardware fallbacks (Fail Groq -> Fail Gemini Key 1 -> Fail Gemini Key 2 -> Graceful UI Exception Error message).
- Responsibility: Recursively scrape the nested JSON metadata component tree on save/publish to automatically create respective Postgres
tablesnatively reflecting the UI layout fields. - Dependencies:
@supabase/ssr,lib/insforge-server. - Important Implementation Details: Uses
execute_app_ddlvia Supabase RPC to securely execute runtime data-definition languages while shielding the central registry tables from malicious DROPs or mutations.
- Responsibility: Fire-and-forget payload drops triggered upon structural commits.
- Dependencies:
@upstash/kafka. - Failure Modes: Deliberate "Try/Catch with Empty Throw." Downstream Kafka anomalies will never break the primary HTTP transaction loop on the user facing client.
appforge/
├── .github/workflows/ # CI/CD Pipeline (Docker/TypeScript verification)
├── actions/ # Server Actions (Next.js RPC mutations)
│ ├── apps.ts # Core persistence layer for drafts / publishing
│ └── schema.ts # Core database sync logic parsing AST to SQL
├── app/ # Next.js 15 App Router Endpoints
│ ├── api/copilot/ # Edge-deployed Serverless AI Streams
│ ├── builder/ # Dynamic Canvas Editor workspace
│ ├── dashboard/ # User account registry
│ └── templates/ # Base static layouts for new projects
├── components/ # React UI Primitives & Registry Components
│ ├── builder/ # Core complex UI blocks (ConfigEditor, CopilotPanel)
│ ├── dashboard/ # AppGrid, App deletion flows
│ └── ui/ # Shadcn granular micro-components
├── lib/ # Singletons and Client Instantiators (Upstash, Supabase)
├── registry/ # Central Web Component Engine definitions (JSON -> React)
├── sql/ # Raw Database DDL definitions
├── middleware.ts # Root Clerk Auth Edge intercepts for Vercel
├── docker-compose.yml # Container configuration
├── Dockerfile # Multi-stage optimized application container
└── next.config.ts # Contains Sentry tunneling definitions
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | React 19 / Next 15 | Implements server-side streamed application components and hybrid Server Actions. |
| Styling | Tailwind 4 / Shadcn | Deterministic un-bloated functional styling framework. |
| Backend | Next.js App Router | Edge-capable API runtime. |
| Database | Supabase (PostgreSQL) | Stores central application JSON configurations and handles Dynamic App instances. |
| Authentication | Clerk B2B | Provides JWT-mediated state control natively wired directly into Next.js middleware. |
| Queue | Upstash Kafka | Low-latency serverless event brokering for analytical webhooks. |
| Cache/RateLimit | Upstash Redis | Hard prevents API exhaustion and speeds up identical query latencies globally. |
| Generative AI | AI SDK Core | Standardized multi-model fallback streaming execution (Groq, Gemini). |
| Observability | Sentry | Full cycle Next.js Error Monitoring locally and globally. |
| Infrastructure | Vercel / Docker | Highly distributed edge platforms + container isolation. |
- Next.js & Server Actions: Completely eliminates the need to build, maintain, and type RESTful boilerplate controllers. Enables seamless frontend/backend component state transitions.
- Upstash Serverless vs Redis Cloud: Since Vercel executes serverlessly natively on edge regions, maintaining a dedicated socket against traditional Redis drains connection pools identically into a freeze. Upstash connects cleanly via standardized HTTP REST interfaces.
- Groq vs OpenAI: AppForge processes enormous dual-prompt AST generation logic. Groq runs Llama 3 models on LPUs outputting
~700 tokens per second, drastically dropping generation latency under the UI hydration barrier.
- Client Side Validation State (Zustand): Currently state seems heavily constrained to React Contexts and local
useStateprops, avoiding heavy global Redux/Zustand payloads since Next.js inherently handles server-side transitions via RSC.
User presses "Ask AI" via CopilotPanel
↓
/api/copilot API Route extracts Prompt
↓
Upstash Ratelimit evaluated using 'x-forwarded-for' (IP Address)
↓
Cache Lookup via Upstash Redis (`copilot_cache:<prompt>`)
↓ (If Miss)
AI SDK issues system prompt to Groq (LPU)
↓
Result is appended back directly into Redis (TTL 7days)
↓
ReadableStream passes raw text into CopilotPanel
↓
Regex strips filler Markdown; JSON parses into valid JSON
↓
UI Registry maps JSON blocks visually into Shadcn elements instantly.
- Entry: Data enters through natural language input in
CopilotPanel.tsxor raw JSON manipulation in theConfigEditor.tsx. - Transformation: Client-side validation is rigorously processed through the
registry/*tree to ensure dynamic layouts correctly match required prop boundaries. - Persistence:
handleSavetriggers a Next.js Server Action (saveAppConfig), injecting the raw AST tree strictly into the Supabase Postgresapps(config)table. - Database DDL Orchestrator: On saving or publishing, the payload undergoes secondary loop analysis where identical SQL relations are physically constructed via
execute_app_ddlto handle the app's structural storage.
- Technology: PostgreSQL (managed by Supabase).
- Core Entities:
apps: Primary mapping ofid,name,config(JSONB) andpublished_config(JSONB). Indexed internally via Clerk-compliant stringuser_id.app_schemas: Relational map referencing the custom tables built dynamically during AST injection viasyncAppSchema.validation_logs: Standard error pipeline sink checking application component syntax validity per save.
- Transactions & RLS:
- Row Level Security (RLS) is strictly enforced upon the DB layer.
- However, in production, we actively bypass native token inspection directly injecting the
SUPABASE_SERVICE_ROLE_KEYinsidecreateInsforgeServer(), shifting the exact Identity & Security authority physically onto the Next.js Server Action logic (via Clerkauth()), which guarantees safe decoupled multi-tenant capabilities.
- Initialization: DB initialization instructions exist explicitly under
sql/schema.sqlandsql/rpc_ddl.sql.
Authentication is natively enforced using Clerk.
- Mechanism: Short-lived JWT Session logic brokered directly onto browser cookies.
- Root Middleware:
middleware.tsruns directly on the Vercel Edge. Unauthenticated users are hard-bounced back to the identity provider logic on all system modifications unless matched against thecreateRouteMatcherpublic list (/builder/demo, etc). - Graceful Quota Locking: Guests attempting sandbox usage are structurally blocked at 2 interactions (monitored globally via heavily decoupled localStorage + Server Rate Limiting parameters).
| Variable | Required | Example | Description |
|---|---|---|---|
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY |
Yes | pk_test_... |
Public frontend client verifier required by Clerk SDK |
CLERK_SECRET_KEY |
Yes | sk_test_... |
Private token verifier required by Clerk Backend Context |
NEXT_PUBLIC_INSFORGE_URL |
Yes | https://xxxx.supabase.co |
Endpoint connection strings to your specific Postgres Instance |
NEXT_PUBLIC_INSFORGE_ANON_KEY |
Yes | eyJhbG.. |
Limited Postgres Anonymous interaction token |
SUPABASE_SERVICE_ROLE_KEY |
Yes | eyJhbG.. |
SuperAdmin Role bypassing internal Postgres Policies remotely |
GROQ_API_KEY |
Yes | gsk_xxxx |
Model connection keys serving primary LPU text inferences. |
GEMINI_API_KEY |
Yes | AIza... |
Tier 1 failover key explicitly triggered when Groq rate limits. |
GEMINI_API_KEY_2 |
Optional | AIza... |
Tier 2 failover key ensuring zero-downtime structural capacity. |
UPSTASH_REDIS_REST_URL |
Yes | https://xx.upstash.io |
Connection URL for REST API Serverless KV fetching. |
UPSTASH_REDIS_REST_TOKEN |
Yes | AXXX... |
Security token allowing API validation to the DB cache tier. |
UPSTASH_KAFKA_REST_URL |
Yes | https://xx.upstash.io |
Connection URL serving background telemetry logic. |
UPSTASH_KAFKA_REST_USERNAME |
Yes | default |
Security cluster identifier verifying event payloads. |
UPSTASH_KAFKA_REST_PASSWORD |
Yes | XXXX... |
Security hash authorizing push topics. |
NEXT_PUBLIC_SENTRY_DSN |
Optional | https://xx@sentry.io/xx |
Application telemetry monitoring pipeline sink configurations |
ADMIN_BYPASS_KEY |
Optional | super_secret_string |
Testing parameter to circumnavigate explicit production server checks. |
(All secrets are kept secure within .env.local locally and mapped securely out into the Vercel variables GUI in prod.)
AppForge assumes you possess a compatible runtime environment comprising Node.js 18+.
# 1. Pull the codebase
git clone https://github.com/vpn-cli/appforge.git
cd appforge
# 2. Extract dependencies
npm install --legacy-peer-deps
# 3. Apply your keys (Create .env.local via duplicating the configuration section rules)
touch .env.local
# 4. Initiate the runtime sandbox
npm run devEnsure you physically initialize the Supabase architecture first:
- Copy the contents of
sql/schema.sqlcompletely into your Supabase SQL Editor and execute. - Ensure you initialize the
execute_app_ddlstructural abstraction viasql/rpc_ddl.sql.
AppForge is functionally agnostic between standard bare-metal execution and Next.js static cluster generations.
# Local Live Editing Mode (localhost:3000)
npm run dev
# Explicit Production Emulation Build (Compiles SSR statically)
npm run build
npm run startAppForge includes a rigorously verified Next.js multi-stage Docker build pipeline suitable strictly for container orchestration logic if Vercel Edge topologies are not preferred.
# Generate the multi-stage image statically
docker build -t appforge/app:latest .
# Deploy the node standalone application
docker run -p 3000:3000 --env-file .env.local appforge/app:latestThe underlying Dockerfile implements the output: "standalone" trace-builder reducing the default heavy Node modules payload heavily.
Known Limitation (Docker): Edge runtime API routes (app/api/copilot/route.ts) function equivalently under docker, however executing it completely baremetal within Node may sacrifice some localized Vercel networking optimizations.
CI Provider: GitHub Actions (.github/workflows/production.yml)
The enterprise pipeline heavily restricts branches. It is comprised strictly of dual-jobs resolving concurrently only to .yml triggered branches:
- Linting and Source Verification: Compiles a headless
npx tsc --noEmitand applies expliciteslint --fixconstraints ensuring perfect structural typings. - Container Build Verification: Forces validation that
appforge:latestcorrectly bootssleep 10processes within isolation cleanly.
(No traditional component/unit testing platforms (Mocha/Jest) are currently coupled to the runtime flow natively. Typescript compilation checks are utilized as the sole deterministic integration logic).
- Service Account Context Boundaries: No Postgres interaction runs directly from the front-end unless explicit Row Level Security explicitly ignores the
INSERT. The application explicitly isolates database actions into Edge-routed RPC calls executing behindSUPABASE_SERVICE_ROLE_KEY, meaning that 99.9% of security logic intercepts natively against Clerk's Next.js authorization barrier. - Graceful Fault Lines: Malformed AI JSON logic natively injects right into React logic. To prevent full application White Screen deaths, component elements generated inside the canvas run internally trapped inside isolated native Custom React
ErrorBoundaries.
- Sentry Integration: Comprehensive real-time runtime monitoring is strictly integrated using
@sentry/nextjs. Next.js traces are securely wrapped throughoutinstrumentation.tsglobally, monitoring exception pipelines symmetrically on Server APIs, client edges, and standard SSR render flows. - Sentry Tunnel Router:
next.config.tsincorporates heavily un-detectabletunnelRoute: /monitoringoverrides pushing localized errors straight through standard HTTP pipes specifically subverting overzealous ad-blockers inside browser DOMs.
- Cause: Clerk Edge tokens mismatching Next.js Server actions caching.
- Verify: Ensure
middleware.tsis named correctly in the root folder. Use the explicit/builder/demoexception withincreateRouteMatcherto guarantee routing matches accurately.
- Cause: Upstash Rate Limit lockouts overriding normal operations.
- Verify: Open browser networking tools; look specifically at identical
429 Too Many RequestsAPI sink boundaries triggered insideCopilotPanel.tsx.
- Cause: Disconnecting or modifying
execute_app_ddllogic structurally blocks remote runtime instantiators. - Verify: Audit
sql/schema.sqland runSELECT * FROM app_schemasusing the Supabase remote debug query UI.
- TODO / Verify (React Testing Layer): There is currently no active e2e testing interface. Adding
Playwrightto strictly verify DOM layout alignment output from generic JSON structures would guarantee a vastly more secure build layer. - TODO / Verify: AI Provider Failover Logic is extremely simplistic. Migrating to a complex load-balancer tracking API quota exhaustions heavily per key natively rather than sequential cascading fallbacks.
- Functional Limitation (Publishing): Guests cannot natively host simulated domains in full isolation. They require immediate
auth.protect()transitions.
This project executes under proprietary distribution configurations natively unless fully stated otherwise.
(Project requires explicit Vercel usage terms assuming Next.js standalone execution logic if utilized commercially).

