CodeForge AI is organized around a traceable application generation lifecycle.
Vue 3 renders the workbench, generation flow, artifact browser, marketplace, prompt template management, provider routing, model call audit, and admin dashboards.
Spring Boot controllers expose /api/v1 endpoints. Controllers keep request validation and delegate ownership, status, and lifecycle rules to application services.
JWT authentication resolves CurrentUser. Object reads still check owner/workspace/app/version binding even when the user is PLATFORM_ADMIN.
Workspaces scope application ownership. Apps hold display state, publication state, and currentVersionId.
generation_task stores independent prompt_template_id and prompt_template_version_id fields. requestPayloadJson is payload evidence, not the only source of truth.
Generation requests bind a concrete template version. Async dispatch, retry, compact, JSON repair, and fingerprint logic use that fixed version instead of latest fallback.
The gateway builds final outgoing model messages. Rule Mode generates deterministic local artifacts. AI_DIRECT routes to configured providers when enabled.
Model calls record provider, model, status, token counts, template identity, and prompt fingerprints. Complete prompts and secrets are not persisted for ordinary API exposure.
The generation facade creates app versions and generated file rows after model or rule output is parsed and validated.
flowchart LR
Task[generation_task] --> V1[app_version V1]
V1 --> File[generated_file]
File --> Preview[preview token]
V1 --> Repair[repair API]
Repair --> V2[app_version V2]
V1 --> Export[export package]
V2 --> Export
Export --> Market[marketplace publication pinned to versionId]
Repair creates a new version and keeps the source version unchanged. File paths are validated segment by segment and resolved inside the version root.
Preview access is token-bound to the requested versionId. The token authorizes static preview file reads without revealing storage paths.
Export packages bind marketplace, app, version, and package IDs. Download paths are normalized and constrained to the version root.
Publication records pin versionId. Preview, detail, and download paths use the same pinned version and re-check archived/unpublished state on read.
Admin pages aggregate users, apps, providers, prompt templates, model calls, and audit logs without exposing provider keys or full prompts.
Fresh MySQL uses B33__codeforge_mysql_schema.sql as the baseline migration. Incremental V1 through V34 remain immutable history for existing databases and tests.
Docker Compose provides MySQL and Redis. Windows runs backend and frontend through scripts/dev-start.ps1; Linux/macOS can use scripts/dev-start.sh, scripts/dev-status.sh, and scripts/dev-stop.sh.
No hosted public demo is included. Production deployment hardening, external object storage policy, and package signing are future work.
flowchart TB
Browser[Browser] --> Frontend[Vue 3 Frontend]
Frontend --> Api[Spring Boot API]
Api --> Security[JWT and RBAC]
Api --> Workspace[Workspace Service]
Api --> Generation[Generation Task Service]
Api --> Prompt[Prompt Template Service]
Api --> Admin[Admin Service]
Generation --> Gateway[Model Gateway]
Gateway --> Rule[Rule Provider]
Gateway --> Provider[External Provider]
Generation --> Version[App Version Service]
Version --> Storage[Local Artifact Storage]
Version --> Preview[Static Preview]
Version --> Export[Export Service]
Export --> Marketplace[Marketplace]
Api --> Mysql[(MySQL)]
Api --> Redis[(Redis)]
sequenceDiagram
participant User
participant API
participant Task
participant Prompt
participant Gateway
participant Version
participant Preview
User->>API: POST /generation-tasks
API->>Task: persist task and pinned template fields
Task->>Prompt: load templateVersionId
Task->>Gateway: build final messages
Gateway-->>Task: generated project files
Task->>Version: create app_version and generated_file rows
Task-->>API: TASK_SUCCESS with versionId
User->>API: request preview token
API->>Preview: issue token for versionId
User->>Preview: load index.html
stateDiagram-v2
[*] --> TaskCreated
TaskCreated --> VersionCreated
VersionCreated --> Previewable
Previewable --> Repaired
Repaired --> RepairedVersionCreated
VersionCreated --> Exported
RepairedVersionCreated --> Exported
Exported --> MarketplacePinned
MarketplacePinned --> Archived
Archived --> [*]