How ntegrals/december works
Project type and purpose
• December is a full-stack AI-powered development environment that lets users generate, preview, edit, and export containerized Next.js apps from natural-language prompts.
• It comprises a Next.js frontend (with embedded Monaco editor and live preview), a TypeScript backend API, and orchestrates Docker containers and an LLM (OpenAI-compatible) service.
File structure
• Top-level:
• backend/ – Node.js (TypeScript) API, routes (chat, containers), services (docker, llm, file, export, package), utils, Dockerfile
• frontend/ – Next.js app (app directory), UI components (create, editor, projects), lib/backend/api.ts, config files for Bun/ESLint/Next.js, public assets
• config.ts – central config for baseUrl, apiKey, model, temperature
• start.sh – bootstraps config into backend, starts frontend on 3000 and backend on 4000
• Deployment:
• backend/src/Dockerfile – containerizes API
• uses Docker CLI to spin up ephemeral Next.js project containers for live preview and export
• Key patterns:
• API layer serving JSON and streaming LLM chat
• Micro-services style within a single backend process (services/docker.ts etc.)
• Componentized React UI, with a file manager and code editor in the browser
README
• Describes ports: frontend 3000, backend 4000
• Mentions Docker dependency and local API keys
• Highlights features: AI chat, code editor, live preview, project export
a. Main components
1. User’s Browser / Frontend (Port 3000)
– Next.js UI
– Monaco Editor + File Manager + Live Preview iframe
– Calls backend via REST/HTTP and WebSockets (for streaming chat/code)
2. Backend API Server (Port 4000)
– HTTP endpoints: /chat, /containers, /export, /package, /file
– Services:
• docker.ts – interfaces with Docker Engine via CLI or API
• llm.ts – calls external LLM provider (OpenAI et al.)
• file.ts – project file read/write
• export.ts – packages container to ZIP or tar
• package.ts – builds Next.js app inside container
3. Docker Engine
– Runs containerized Next.js apps generated by AI
– Provides live preview and project isolation
4. External LLM Service
– OpenAI-compatible API (Anthropic Sonnet-4 recommended)
5. Local File System
– Stores project source files, config, container artifacts
6. Config Store
– config.ts injected into backend to hold API keys and model settings
b. Relationships and interactions
• User → Frontend: clicks, types prompts, edits code
• Frontend → Backend:
– REST calls for chat prompts → streams LLM responses
– CRUD on project files
– Requests to build or export project
– Requests to spin up a preview container
• Backend → Docker Engine: create/start/stop containers, mount volumes
• Backend → LLM Service: send prompt, receive generated code or chat stream
• Backend → Local FS: read/write files for projects
• Frontend ← Live Preview Container: iframe or proxied HTTP to show running app
c. Architectural patterns and design principles
• Layered architecture: UI layer, API layer, service layer, infrastructure layer
• Service segregation: each domain (docker, llm, file, export) encapsulated in its own module
• Container-first deployment: every user-generated app runs in its own Docker container for isolation
• Streaming I/O: chat and code generation streamed through WebSockets or SSE
• Config-as-code: single config.ts propagated at startup
d. Technologies, frameworks, and libraries
• Frontend: Next.js 13 (“app” directory), React, TypeScript, Monaco Editor, PostCSS, ESLint, Bun (optional)
• Backend: Node.js, Express-style HTTP (via Bun or Node), TypeScript, Dockerfile, Docker Engine CLI
• LLM integration: OpenAI/Anthropic via HTTP
• Utilities: tsconfig.json, start.sh for orchestration, GitHub Actions (potential)
Final advice
• Be very detailed: include each backend service module and front-end feature group
• Flows: chat, code generation, container management, live preview, export
• Use consistent iconography for Docker, HTTP, WebSocket, file storage, and external APIs
• Important configs (e.g., config.ts) and startup script (start.sh) as part of the orchestration layer