Code Canva is a collaborative coding workspace designed for teams to build, review, and run code together in a browser-based environment. The project combines a modern Next.js frontend with AI-powered coding assistance, collaborative editing patterns, and a scalable backend architecture for multi-user workspaces.
This application aims to provide:
- Collaborative code editing with real-time workspace awareness
- Team-based project organization and permission management
- AI-powered code completion, explanation, and execution support
- A developer-friendly interface inspired by modern coding platforms
- Flexible data models for workspaces, files, comments, presence, and version history
βββββββββββββββββββββββββ
β USERS β
β β
β Browser A Browser B β
βββββββββββββ¬ββββββββββββ
β
HTTPS / WebSocket
β
βΌ
βββββββββββββββββββββββββββββββββββββββ
β NEXT.JS FRONTEND β
β β
β ββββββββββββ βββββββββββββββββ β
β βMonaco β βFile Explorer β β
β βEditor β βWorkspace UI β β
β ββββββββββββ βββββββββββββββββ β
β β
β Chat β Video β Terminal β Presence β
βββββββββββββββββ¬ββββββββββββββββββββββ
β
ββββββββββββ΄βββββββββββ
β β
REST WebSocket
HTTP Socket.IO
β β
βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββ
β Next.JS SERVER β
β β
β ββββββββββββββββββββββββββββββββββββββ β
β β MIDDLEWARE LAYER β β
β β β β
β β Auth β CORS β Rate Limit β Zod β β
β β Error Handler β Logger β RBAC β β
β ββββββββββββββββββββ¬ββββββββββββββββββ β
β β β
β ββββββββββββββββββββΌββββββββββββββββββ β
β β API ROUTES β β
β β β β
β β /auth β β
β β /users β β
β β /workspaces β β
β β /files β β
β β /comments β β
β β /versions β β
β β /execution β β
β ββββββββββββββββββββ¬ββββββββββββββββββ β
β β β
β ββββββββββββββββββββΌββββββββββββββββββ β
β β CONTROLLERS β β
β β β β
β β AuthController β β
β β WorkspaceController β β
β β FileController β β
β β ExecutionController β β
β ββββββββββββββββββββ¬ββββββββββββββββββ β
β β β
β ββββββββββββββββββββΌββββββββββββββββββ β
β β SERVICES β β
β β β β
β β AuthService β β
β β WorkspaceService β β
β β FileService β β
β β CollaborationService β β
β β ExecutionService β β
β β VersionService β β
β βββββββββββββββββ¬βββββββββββββββββββββ β
β β β
β βββββββββββββββββΌβββββββββββββββββββββ β
β β SOCKET.IO LAYER β β
β β β β
β β workspace:join β β
β β editor:update β β
β β cursor:update β β
β β presence:update β β
β β chat:message β β
β β video:signal β β
β βββββββββββββββββ¬βββββββββββββββββββββ β
ββββββββββββββββββββΌβββββββββββββββββββββββ
β
ββββββββββββββββββββΌβββββββββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββ ββββββββββββββββββ βββββββββββββββββ
β PostgreSQL β β Redis β β Object Store β
β β β β β S3 β
β Users β β Presence β β β
β Workspaces β β Pub/Sub β β Project files β
β Members β β Socket adapter β β Assets β
β Files β β Sessions β β Snapshots β
β Versions β β Rate limiting β β β
β Messages β β β βββββββββββββββββ
βββββββββββββββββ ββββββββββββββββββ
β
β
βΌ
ββββββββββββββββββββββββββ
β COLLABORATION ENGINE β
β β
β Yjs / CRDT β
β β
β Shared Documents β
β Conflict Resolution β
β Document Sync β
ββββββββββββββ¬ββββββββββββ
β
βΌ
ββββββββββββββββββββββββββ
β EXECUTION SERVICE β
β β
β Queue / Worker β
β β
β Docker β
β ββββββββββββββββ β
β β Java β β
β β JavaScript β β
β β Python β β
β β C/C++ β β
β ββββββββββββββββ β
β β
β CPU / RAM / Timeout β
β Isolation β
ββββββββββββββββββββββββββ
code-canva/
βββ README.md # Project overview, setup steps, and architecture docs
βββ components.json # shadcn/ui configuration and component registry
βββ docs/ # Design notes and product blueprint
β βββ blueprint.md # Product/feature blueprint and architecture ideas
βββ prisma/ # Database and Prisma-related files
β βββ schema.prisma # Prisma schema for application data models
β βββ migrations/ # SQL migration history for the database
β βββ ...
βββ public/ # Static assets served by Next.js (images, icons, etc.)
βββ src/ # Main application source code
β βββ ai/ # AI assistant features and Genkit flow logic
β β βββ dev.ts # Local AI/dev tooling setup
β β βββ genkit.ts # Genkit configuration and initialization
β β βββ flows/ # AI workflows for coding assistance
β β βββ code-completion-suggestions.ts # Suggests code completions
β β βββ code-execution.ts # Runs or prepares code execution logic
β β βββ code-explanation-on-hover.ts # Explains code when hovered over
β βββ app/ # Next.js App Router pages and API routes
β β βββ api/ # Server-side API endpoints
β β β βββ invites/ # Invite flows and invitations API
β β β βββ teams/ # Team-related API routes
β β β βββ webhooks/ # Webhook handlers for external events
β β βββ canvas/ # Collaborative coding workspace page
β β β βββ layout.tsx # Canvas-specific layout wrapper
β β β βββ page.tsx # Main editor/canvas experience
β β βββ contact/ # Public contact page
β β β βββ page.tsx # Contact page UI
β β βββ globals.css # Global styling and theme layers
β β βββ layout.tsx # Root app layout and shell
β β βββ page.tsx # Landing/home page
β β βββ teams/ # Team management and team pages
β β βββ create/ # Team creation flow
β β βββ [teamId]/ # Team-specific dashboard/page routes
β βββ components/ # Reusable UI components for the app
β β βββ editor/ # Editor-related UI components
β β β βββ code-editor.tsx # Monaco-based code editor component
β β βββ Footer/ # Footer UI section
β β β βββ Footer.tsx # Website footer markup
β β βββ HeroSection/ # Marketing/landing banner section
β β β βββ HeroSection.tsx # Hero section UI
β β βββ OurServices/ # Services/features section
β β β βββ OurServices.tsx # Services display component
β β βββ Roadmap/ # Product roadmap UI
β β β βββ Roadmap.tsx # Roadmap timeline section
β β βββ Testimonals/ # Testimonial section
β β β βββ Testimonials.tsx # Customer testimonial cards
β β βββ layout/ # App shell: header, sidebar, nav
β β β βββ app-header-content.tsx # Header content area logic
β β β βββ app-sidebar.tsx # Main sidebar navigation
β β β βββ header.tsx # Top header component
β β β βββ NavbarWrapper.tsx # Navbar wrapper for layout behavior
β β β βββ user-nav.tsx # User profile menu and actions
β β βββ notifications/ # Notification center UI
β β β βββ notification-center.tsx # In-app notifications panel
β β βββ ui/ # Reusable shadcn/ui primitives
β β β βββ ...shadcn/ui components # Buttons, cards, dialogs, inputs, etc.
β β βββ logo.tsx # Brand/logo component
β β βββ theme-provider.tsx # Theme context for Dark/Light mode
β β βββ theme-toggle.tsx # Theme switch control
β βββ generated/ # Generated Prisma client files
β β βββ prisma/ # Auto-generated Prisma models and types
β β βββ ...generated Prisma client files
β βββ hooks/ # Reusable React hooks
β β βββ use-mobile.tsx # Detects mobile viewport state
β β βββ use-toast.ts # Toast notification helper hook
β βββ lib/ # Shared utilities and app libraries
β β βββ placeholder-images.json # Placeholder media dataset
β β βββ prisma.ts # Prisma client singleton
β β βββ utils.ts # Common helper functions
β βββ middleware.ts # Next.js middleware logic (auth, routing, security)
β βββ proxy.ts # Proxy layer or request forwarding logic
β βββ schemaValidation/ # Input validation schemas
β βββ authSchemaValidation.ts # Validation rules for auth-related requests
βββ next-env.d.ts # Next.js TypeScript environment declarations
βββ next.config.ts # Next.js framework configuration
βββ package.json # Project scripts and dependencies
βββ postcss.config.mjs # PostCSS processing configuration
βββ prisma.config.ts # Prisma runtime configuration
βββ tailwind.config.ts # Tailwind CSS configuration
βββ tsconfig.json # TypeScript compiler settings
βββ .gitignore # Git ignore rules
βββ .env.example or .env.local # Environment variables (if present in your setup)
- Next.js with App Router
- TypeScript
- Tailwind CSS
- Prisma ORM
- PostgreSQL
- Monaco Editor
- Genkit AI flows
- shadcn/ui component library
- Clerk for authentication workflows
- Redis for real-time collaboration support
The database is designed around shared workspaces, collaborative files, users, presence, messages, and version tracking.
users (
id UUID PRIMARY KEY,
username TEXT UNIQUE NOT NULL,
email TEXT UNIQUE NOT NULL,
password_hash TEXT,
avatar_url TEXT,
created_at TIMESTAMP DEFAULT now()
)
workspaces (
id UUID PRIMARY KEY,
name TEXT NOT NULL,
owner_id UUID REFERENCES users(id),
is_public BOOLEAN DEFAULT false,
created_at TIMESTAMP DEFAULT now()
)
workspace_members (
workspace_id UUID REFERENCES workspaces(id),
user_id UUID REFERENCES users(id),
role TEXT CHECK (role IN ('owner', 'editor', 'viewer')),
joined_at TIMESTAMP DEFAULT now(),
PRIMARY KEY (workspace_id, user_id)
)
nodes (
id UUID PRIMARY KEY,
workspace_id UUID REFERENCES workspaces(id),
parent_id UUID REFERENCES nodes(id),
name TEXT NOT NULL,
type TEXT CHECK (type IN ('file', 'folder')),
language TEXT,
created_by UUID REFERENCES users(id),
created_at TIMESTAMP DEFAULT now()
)
file_documents (
file_id UUID PRIMARY KEY REFERENCES nodes(id),
content TEXT,
crdt_state BYTEA,
updated_at TIMESTAMP DEFAULT now()
)
file_versions (
id UUID PRIMARY KEY,
file_id UUID REFERENCES nodes(id),
content TEXT,
created_by UUID REFERENCES users(id),
created_at TIMESTAMP DEFAULT now()
)
workspace_presence (
workspace_id UUID,
user_id UUID,
status TEXT,
cursor_position JSONB,
last_seen TIMESTAMP,
PRIMARY KEY (workspace_id, user_id)
)
comments (
id UUID PRIMARY KEY,
file_id UUID REFERENCES nodes(id),
user_id UUID REFERENCES users(id),
content TEXT,
line_number INT,
created_at TIMESTAMP DEFAULT now()
)
workspace_messages (
id UUID PRIMARY KEY,
workspace_id UUID REFERENCES workspaces(id),
user_id UUID REFERENCES users(id),
content TEXT,
created_at TIMESTAMP DEFAULT now()
)usersstores account and profile information.workspacesrepresents a collaborative project space.workspace_membersmanages access and permissions for each user in a workspace.nodessupports file and folder hierarchy inside a workspace.file_documentskeeps the live document state and snapshot content.file_versionsstores change history for revisions and auditing.workspace_presencetracks online status and editor cursor state.commentsadds contextual feedback tied to a file and line number.workspace_messagesstores team chat messages within a workspace.
Install dependencies:
npm installGenerate Prisma client and prepare the database:
npx prisma generateRun the development server:
npm run devThe app will be available locally through the configured Next.js port.
Code Canva is intended to become a browser-based collaborative coding platform with features similar to a modern remote IDE, including:
- multi-user editing
- workspace-level collaboration
- AI support for coding tasks
- version history and file snapshots
- execution environments for code compilation and testing
This repository is currently structured as a modern Next.js application foundation for collaborative coding workflows. Additional backend services, real-time collaboration infrastructure, execution workers, and production deployment configuration can be layered on top of the existing front-end and Prisma foundation.