How webstudio-is/webstudio works
Main Components
• Frontend UI Applications – The “apps” directory (e.g. apps/builder, apps/dashboard, apps/canvas, etc.) represents the client-side interface. The builder’s UI (with components for authentication, project sharing, editing designs, asset management, and live preview) is a core visual component.
• Backend Services – Backend routes and servers are interwoven across the “apps” and “packages” folders. Look for service files under apps (like routes, services, auth and sync endpoints) and packages (e.g. authorization-token, postgrest, prisma-client, project, domain) which handle business logic, authentication, data sessions, and database operations.
• API & Data Layer – Modules under packages such as “prisma-client”, “postgrest”, “domain”, “dashboard”, “trpc-interface” indicate clear separation of data handling and API endpoints. These provide REST/TRPC interfaces for accessing the database and application resources.
• Asset & Media Management – Packages like “asset-uploader”, “image”, “css-engine”, “css-data” manage file uploads, image optimization, CSS processing, and design token transformation.
• AI & Automation – The “packages/ai” folder shows that there are functionalities for AI-driven chain responses (e.g. copywriting, command detection, template generation) which are an important part of the platform.
• CLI & SDK Tools – Several packages (cli, sdk, react-sdk, template, tsconfig, generate-arg-types) are used for developer tooling, scaffolding, and integration with external workflows.
• Infrastructure & DevOps – Directories such as “.devcontainer”, “.github”, “docker-compose.yml”, “vercel.json”, and numerous CI workflow YAML files indicate integration with containerization, testing, CI/CD, and deployment infrastructure.
Relationships and Interactions
• The Frontend (Builder UI, Dashboard, Canvas, etc.) communicates with the Backend APIs (via REST/TRPC endpoints) to retrieve user data, project information, assets, and design tokens.
• The Backend services – implemented with database clients (Prisma) and business logic modules – sit behind authentication (authorization-token, session, csfr, etc.) and serve requests made from the UI.
• Asset and media management modules interact with file storage solutions (via S3 or filesystem-based clients) to upload, retrieve, and optimize images and other assets.
• The AI modules work as independent services or microservices that interact with the core application—processing client requests, generating templates, and handling operations like style editing or copy changes.
• The CLI and SDK components are used by developers to generate and manage projects, glue together build tasks, and facilitate testing and deployment. They integrate with core platform services.
Architectural Patterns and Design Principles
• Modularity & Separation of Concerns: The monorepo structure clearly segments functionality (UI, API, asset management, CLI tools, etc.) into separate packages.
• Microservices/Multi-layered Architecture: Although they reside in one repository, the design suggests a service-oriented architecture where independent modules (authentication, assets, AI, etc.) interact via clearly defined APIs.
• Reusability & Componentization: A comprehensive design system and shared utility packages emphasize reuse, which is visible in many “packages/sdk-components…” and design-system folders.
• DevOps & CI/CD Integration: Embedded Docker and GitHub Actions configurations indicate that environment setup, testing, build pipelines, and deployment are important parts of the overall architecture.
Essential Elements
• Clear labels for each component (e.g., “Builder UI”, “Dashboard”, “API Gateway”, “Database/Prisma Client”, “Asset Uploader”, “AI Engine”, “CLI Tools”).
Final Advice
• Drill down into critical modules—especially the Builder application (with features like authentication, live editing, and asset management) and the backend API (with database connectivity, business logic, and TRPC interfaces).
• Since Webstudio is both a development platform and a visual builder, emphasize interactions between the visual editor, the code generation/templating modules, and backend processing.