Skip to content

Advanced Topics

Advanced - 2+ hours

Prerequisites: Strong JavaScript/TypeScript, understanding of CRDT, real-time systems

Explore advanced features for building custom components, optimizing performance, and extending BoardAPI.

What You'll Find Here

Custom Components SDK

Build interactive board objects with shared state:

typescript
import { BoardSDK } from '@boardapi/sdk';

const board = new BoardSDK({
  componentId: 'my-component',
  boardUuid: 'abc-123'
});

// Shared state (CRDT-like)
await board.storage.set('score', 100);
board.storage.onChange('score', (value) => {
  console.log('Score updated:', value);
});

Learn More: Custom Components SDK


Performance Optimization

Techniques for large-scale deployments:

  • Board Pagination: Handle 1000+ elements
  • Lazy Loading: Load elements on viewport enter
  • WebSocket Throttling: Reduce message overhead
  • CDN Configuration: Cache static assets

Learn More: Performance Guide


Advanced Real-time Patterns

  • Conflict Resolution: Handle concurrent edits
  • Offline Support: Queue changes when disconnected
  • Custom Event Handlers: Build domain-specific logic
  • WebSocket Reconnection: Implement robust recovery

1. Educational Games

Build interactive learning experiences:

typescript
// Balloon Game Example
const balloon = board.registerComponent({
  type: 'balloon',
  props: { color: 'red', popped: false }
});

balloon.onClick(() => {
  balloon.updateProps({ popped: true });
  board.storage.increment('score', 10);
});

Full Tutorial: Balloon Game


2. Custom Data Visualization

Real-time charts and dashboards:

typescript
board.storage.onChange('sales-data', (data) => {
  renderChart(data); // Custom rendering logic
});

3. Collaborative Design Tools

Build domain-specific editors:

  • Restaurant menu builders
  • Floor plan designers
  • Circuit diagram editors

Examples: Component Examples


SDK Modules Reference

ModulePurposeComplexity
board.storageShared state (CRDT-like)Medium
board.propsComponent configurationLow
board.participantsUser presenceLow
board.lifecycleMount/unmount hooksLow
board.uiCustom UI renderingHigh
board.offlineQueue changes offlineHigh

Development Workflow

  1. Local Development

    bash
    npm install -g @boardapi/cli
    boardapi component create my-component
    boardapi component dev
  2. Testing

    bash
    boardapi component test
  3. Publishing

    bash
    boardapi component publish

Full Reference: CLI Commands


Best Practices

Component Design

  • Keep components small and focused
  • Use shared state for collaboration
  • Implement offline support for critical data
  • Test with 10+ concurrent users

Performance

  • Avoid rendering 100+ elements at once
  • Throttle WebSocket messages (max 10/sec)
  • Use pagination for large datasets
  • Implement viewport-based loading

Security

  • Validate all user inputs
  • Sanitize HTML in custom components
  • Never expose API keys in client code
  • Use host links for admin features

Next Steps

Recommended Path

Start Here:

  1. Custom Components Introduction
  2. Quick Start Tutorial
  3. SDK API Overview

Then Build:

  1. Clicker Button - Simple example
  2. Balloon Game - Interactive game
  3. Restaurant Menu - Complex UI

Finally Deploy:

  1. Production Integration
  2. Performance Optimization

Community Components

Browse components built by the community:

  • Educational: Quiz cards, flashcards, timers
  • Games: Memory match, word search, trivia
  • Tools: Kanban cards, voting buttons, polls

Coming soon: Component marketplace


Need Help?