How olwooz/schnode works
Project Type and Purpose
• Schnode is a full-stack web application (front-end heavy) built with Next.js and TypeScript.
• Its purpose is to let end users visually construct UIs by dragging and dropping prebuilt components, configure them, preview the result, and export/import designs as JSON.
Main Components
a. Next.js Application
• Next.js server & router (SSR/SSG/endpoints)
• App directory (src/app/*) with layout.tsx, page.tsx
b. React Client Providers
• DeviceProvider & ClientDeviceProvider (device detection)
• DndProvider (react-dnd context)
• ThemeProvider (light/dark mode via Tailwind & shadcn/ui)
c. Component Library & Renderer
• UI Primitives (components/ui/*) – alert, button, table, etc.
• Motion Primitives (components/motion-primitives/*) – animations
• Renderer (components/renderer/*) – renders dropped components on canvas
d. Layout & Canvas
• AppDock (toolbar for export, import, preview, theme toggle)
• Canvas (drop zone, responsive, mobile notice)
• ConfigPanel (controls for style, binding, property panels)
e. State Management
• Jotai atoms (src/atoms/*) – global state for mode, tutorial, bindings, isMobile, etc.
• Custom hooks (src/hooks/*) – useBindings, useDraggable, useTogglePreviewMode, useLoadTableData, etc.
f. Data Integration
• API calls (via useLoadTableData hook) to external endpoints for table data
• Export/import JSON (components/layout/AppDock/Export.tsx & Import.tsx)
g. Utilities & Constants
• Constants (src/constants/*) – component types, binding events, canvas sizes
• Utils (src/utils & src/lib/utils.ts) – layout-io, canvas math, object/string helpers, table validation
h. Testing & CI/CD
• Playwright tests (tests/*) for e2e coverage
• Lighthouse CI (GitHub Actions workflows: .github/workflows/lighthouse.yml)
Relationships & Data Flows
• User → Drag-and-drop → DndProvider → Atom state → Canvas Renderer → UI update
• ConfigPanel → Atom state → Renderer reconfiguration
• API endpoint → useLoadTableData → Atom/Local state → Table component
• AppDock Export → Serialize atom state → Download JSON
• AppDock Import → Parse JSON → Populate atom state → Re-render Canvas
• Next.js server feeding the initial HTML/JS bundle to the browser, then React hydration and client-side routing.
Architectural Patterns
• Provider Pattern: multiple React context providers wrap the app (Device, Dnd, Theme).
• Atomic Design / Domain-Driven Segmentation:
• atoms/hook layers for state
• components organized by feature (ui primitives, renderer, draggable, layout, motion)
• Separation of Concerns:
• Presentation components vs. domain logic (hooks, utils) vs. configuration (constants, types)
Relevant Technologies
• Next.js (App Router, SSR/SSG)
• React & ReactDOM (client rendering)
• Jotai (state management)
• react-dnd (drag & drop)
• Tailwind CSS + shadcn/ui (styling & UI primitives)
• motion-primitives (animations)
• Playwright (end-to-end testing)
• Lighthouse CI & GitHub Actions (performance monitoring)