LiveCodes Contribution Guide

March 29, 2026 ยท View on GitHub

This directory contains comprehensive documentation for contributors working on the LiveCodes codebase. Each document covers a specific system or aspect of the application.

New to contributing? Start with the beginner-friendly introduction, including setup instructions, pull request guidelines, and code of conduct.

Quick Start

  1. Read the Architecture Overview first to understand the high-level design
  2. Review the Build System to understand how the project is built
  3. Check the Code Style section below for coding conventions

Documentation Index

Core Systems

DocumentDescription
architecture.mdxHigh-level architecture overview with diagrams of all major systems
compiler-system.mdxLanguage compilation pipeline, worker architecture, and import resolution
config-system.mdxConfiguration management, validation, and URL parameter handling
storage-system.mdxClient-side storage using IndexedDB and localStorage

Editor & UI

DocumentDescription
editor-system.mdxMulti-editor support (Monaco, CodeMirror, CodeJar) and themes
ui-design-system.mdxUI components, styling, theming, and responsive design
tools-pane-system.mdxConsole, compiled code viewer, and test runner
notifications-system.mdToast notification system

Language Support

DocumentDescription
language-support-system.mdxLanguage specifications, processors, and utilities
adding-languages.mdxStep-by-step guide to add new language support
type-loader-system.mdxTypeScript type acquisition for IntelliSense

Features

DocumentDescription
import-system.mdxImport from GitHub, GitLab, files, URLs, and more
export-system.mdxExport to JSON, ZIP, HTML, CodePen, JSFiddle, GitHub Gist
result-page.mdxResult iframe generation and sandbox creation
code-formatting-system.mdxPrettier integration and custom formatters

Services & Infrastructure

DocumentDescription
services-system.mdxExternal services: auth, share, CDN resolution, CORS proxy
build-system.mdxBuild scripts, outputs, and development workflow

Internationalization

DocumentDescription
i18n.mdxTranslation workflow, Lokalise integration, and script reference

SDK

DocumentDescription
sdk.mdxSDK architecture, framework wrappers, and API communication

Testing & Development

DocumentDescription
storybook.mdxStorybook setup for SDK component testing

Release

DocumentDescription
release.mdxRelease workflow and version management

Code Style

LiveCodes follows specific coding conventions documented in AGENTS.md at the repository root. Key points:

Formatting (Prettier)

  • Semicolons: always
  • Single quotes
  • Trailing commas: all
  • Print width: 100

Imports

Use import type for type-only imports:

import type { Config, Language } from '../models';
import { someFunction } from '../utils';

Naming Conventions

  • Files/directories: kebab-case (build-config.ts)
  • Functions/variables: camelCase (createEventsManager)
  • Types/interfaces: PascalCase (CompileResult)
  • No enums: use string union types

Functions and Exports

  • Arrow function constants preferred
  • Named exports only (no default exports)
  • No classes in application code
  • Use factory functions (createXxx())
  • One variable per statement

Testing

Tests are co-located in __tests__/ directories:

import { debounce } from '..';

describe('utils', () => {
  test('debounce', async () => {
    expect(num).toBe(1);
  });
});

Running Tests

npm run test              # Run all tests (typecheck + lint + unit)
npm run test:unit         # Run Jest unit tests only
npm run test:unit -- --testPathPattern="compiler"  # Run specific tests
npm run e2e               # Run Playwright e2e tests
npm run typecheck:app     # TypeScript type check
npm run lint:eslint       # ESLint check
npm run fix               # Auto-fix all linting issues

Development Workflow

npm run start             # Dev server with watch (http://127.0.0.1:8080)
npm run build             # Full production build
npm run docs              # Start documentation server (http://localhost:3000/docs)
npm run storybook         # Start storybook (http://localhost:6006)

Architecture Overview

flowchart TD
    subgraph "Core"
        A[core.ts<br/>Main Application]
        B[config/<br/>Configuration]
        C[storage/<br/>Persistence]
        D[events/<br/>Event System]
    end

    subgraph "Editors"
        E[monaco.ts]
        F[codemirror.ts]
        G[codejar.ts]
    end

    subgraph "Compilation"
        H[compiler/<br/>Worker-based]
        I[languages/<br/>Language Specs]
        J[formatter/<br/>Prettier + Custom]
    end

    subgraph "UI"
        K[UI/<br/>App Controllers]
        L[html/<br/>Templates]
        M[toolspane/<br/>Console/Tests]
    end

    subgraph "Services"
        N[auth.ts]
        O[share.ts]
        P[modules.ts]
        Q[sandbox.ts]
    end

    A --> B & C & D
    A --> E & F & G
    A --> H
    H --> I
    A --> J
    A --> K
    K --> L
    A --> M
    A --> N & O & P & Q

Key Design Principles

  1. Client-side only - All compilation happens in the browser
  2. Worker-based compilation - Heavy work off main thread
  3. Lazy loading - Compilers and editors loaded on demand
  4. Modular architecture - Factory functions, no classes
  5. Type safety - Strict TypeScript with explicit types

Getting Help