Skip to content

Latest commit

 

History

History
68 lines (49 loc) · 3.18 KB

File metadata and controls

68 lines (49 loc) · 3.18 KB

Replit.md

Overview

This is a Laser Control Bridge application that provides a web interface for controlling laser engravers/cutters. The system bridges LightBurn software to GRBL-based laser controllers via serial communication, with support for air assist GPIO control on Raspberry Pi. The web dashboard allows real-time laser control, G-code generation from text/fonts, macro management, and configuration of serial/TCP/GPIO settings.

User Preferences

Preferred communication style: Simple, everyday language.

System Architecture

Frontend Architecture

  • Framework: React 18 with TypeScript
  • Routing: Wouter (lightweight client-side routing)
  • State Management: TanStack React Query for server state
  • UI Components: shadcn/ui component library built on Radix UI primitives
  • Styling: Tailwind CSS with CSS variables for theming (industrial dark/light theme)
  • Build Tool: Vite with HMR support

Backend Architecture

  • Framework: Express.js with TypeScript
  • Pattern: RESTful API endpoints defined in shared route schemas
  • Validation: Zod schemas shared between client and server for type-safe API contracts
  • File Storage: Local filesystem for uploaded fonts and G-code files
  • Configuration: INI file-based storage for bridge settings (config.ini)

Data Layer

  • ORM: Drizzle ORM configured for PostgreSQL
  • Schema Location: shared/schema.ts contains Zod schemas for validation
  • Database: PostgreSQL (requires DATABASE_URL environment variable)

Hardware Bridge (Python)

  • Purpose: lightburn_bridge.py runs on Raspberry Pi to bridge TCP connections to serial GRBL controller
  • GPIO Control: WiringPi for air assist relay control
  • Configuration: Reads from config.ini for serial port, baudrate, GPIO pins

Key Design Decisions

  1. Shared Schema Pattern: Zod schemas in shared/ are used for both frontend form validation and backend request validation, ensuring type safety across the stack.

  2. API Contract Structure: Routes defined in shared/routes.ts with method, path, input schema, and response schemas - enabling typed API calls.

  3. Hybrid Storage: Configuration uses INI files (for compatibility with Python bridge), while file uploads use local filesystem.

  4. Component Library: shadcn/ui provides accessible, customizable components without heavy dependencies.

External Dependencies

Database

  • PostgreSQL: Primary database, connection via DATABASE_URL environment variable
  • Drizzle Kit: Database migrations stored in ./migrations

Third-Party Services

  • opentype.js: Font parsing for text-to-G-code conversion
  • No external APIs: Application runs fully self-contained

Hardware Requirements (for Pi deployment)

  • Serial connection to GRBL controller (default: /dev/ttyUSB0)
  • WiringPi GPIO library for air assist control
  • Python dependencies: serial, wiringpi, configparser

Key NPM Packages

  • @tanstack/react-query: Server state management
  • drizzle-orm / drizzle-zod: Database ORM with Zod integration
  • express: HTTP server
  • zod: Runtime type validation
  • react-hook-form / @hookform/resolvers: Form handling with Zod validation