Visual programming platform for building management systems with IoT device integration. Live Preview
Current Phase: 6/8 (Persistence & Integration) - See PROJECT_STATUS.md for detailed progress tracking.
- β Phases 1-5 Complete: Core visual programming infrastructure
- π§ Phase 6 In Progress: Database persistence, project management, edge refinements
- π Phase 7 Planned: Real BACnet device discovery and integration
- π Phase 8 Deferred: Multi-supervisor management
We welcome contributions! This project is in active development and there are many areas where help is needed:
- BACnet Integration: Real device discovery and protocol expertise
- Testing: End-to-end scenarios and performance testing
- Documentation: User guides and API documentation
- UI/UX: Canvas improvements and mobile responsiveness
See CONTRIBUTING.md for detailed contribution guidelines.
This is a PNPM monorepo with two main applications and a shared schema package:
- π¨ Designer App (
apps/designer/) - Next.js 15.5 visual programming interface - π§ IoT Supervisor App (
apps/iot-supervisor-app/) - FastAPI runtime for IoT devices - π BMS Schemas (
packages/bms-schemas/) - Shared schema validation (Zod β JSON Schema β Pydantic)
- Node.js β₯18.0.0
- PNPM β₯9.0.0
- Python β₯3.11
# Install all dependencies
pnpm install
# Generate schemas (first time setup)
pnpm run schema:generate# Start both apps in development mode
pnpm run dev
# Or start individually:
pnpm --filter designer run dev # Designer on http://localhost:3000
pnpm --filter iot-supervisor-app start-serve # IoT Supervisor on http://localhost:8080- Edit schemas in
packages/bms-schemas/src/ - Run tests to validate changes:
pnpm --filter bms-schemas test - Generate outputs for both apps:
pnpm run schema:generate - Test integration in both Designer and IoT Supervisor apps
packages/bms-schemas/src/
βββ version.ts # Schema versioning system
βββ common/
β βββ position.ts # PositionSchema + tests
β βββ position.spec.ts
βββ nodes/
β βββ types.ts # NodeTypeSchema + tests
β βββ types.spec.ts
β βββ flow-node.ts # FlowNodeSchema + tests
β βββ flow-node.spec.ts
βββ __tests__/
βββ integration.spec.ts # Cross-schema tests
- Create new schema file in appropriate directory (
src/common/orsrc/nodes/) - Create corresponding
.spec.tstest file - Add export to
src/index.ts - Update generation scripts if needed
- Run
pnpm run schema:generateto update outputs
# Development
pnpm run dev # Start all apps in development
pnpm run build # Build all apps
pnpm run test # Run all tests
pnpm run lint # Lint all code
pnpm run clean # Clean all build outputs
# Schema Management
pnpm run schema:generate # Generate schemas for all apps
# Code Formatting (Python)
pnpm run python:format # Format Python code with black
pnpm run python:lint # Lint Python code with ruff
pnpm run python:test # Run Python testscd apps/designer
npm run dev # Development server (http://localhost:3000)
npm run build # Production build
npm run start # Start production server
npm run lint # ESLint
npm run test # Jest + React Testing Library-
Local development (SQLite file):
- Uses
better-sqlite3withapps/designer/designer.dbwhenTURSO_DATABASE_URLis not set. - Run migrations locally:
pnpm --filter designer db:migrate
- Start app:
pnpm --filter designer dev
- Uses
-
Remote (Turso/libSQL, e.g. Vercel):
- Set env vars in your shell (or CI) when running migrations:
TURSO_DATABASE_URL='libsql://<your-db>.turso.io'TURSO_AUTH_TOKEN='<token>'(if your DB requires it)
- Run migrations against Turso:
TURSO_DATABASE_URL='β¦' TURSO_AUTH_TOKEN='β¦' pnpm --filter designer db:migrate
- On Vercel, add the same env vars in Project Settings β Environment Variables. At runtime the app autoβdetects Turso and uses
@libsql/clientwith Drizzle. - Migrations are not run at runtime in serverless. Run the command above locally (before deploy) or in your CI of choice.
- Set env vars in your shell (or CI) when running migrations:
-
Notes:
- The repository methods are async and work with both drivers.
- Keep API routes on the Node.js runtime (do not set
export const runtime = 'edge'). - The first migration seeds two example projects; youβll see them after running migrations.
cd apps/iot-supervisor-app
# π§ Initial Setup (run once)
./install.sh # Creates venv, installs dependencies
source .venv/bin/activate # For bash/zsh
# OR for fish shell:
source .venv/bin/activate.fish # For fish shell
# CLI Commands (after installation):
iot-supervisor-app start-serve # Start FastAPI server only
iot-supervisor-app start-execution # Start execution engine only
iot-supervisor-app start-all # Start both server and execution
iot-supervisor-app health # Health check
iot-supervisor-app version # Show version info
# Alternative: Direct Python commands (no venv needed):
python src/cli.py start-serve # Start FastAPI server only
python src/cli.py start-execution # Start execution engine only
python src/cli.py start-all # Start both server and execution
python src/cli.py health # Health check
python src/cli.py version # Show version info
# Development & Testing
pytest tests/ # Run tests
black . # Format code
ruff check . # Lint code
ruff check . --fix # Auto-fix linting issuescd packages/bms-schemas
# Testing
npm test # Run all schema tests
npm run test:watch # Watch mode testing
npm run test:coverage # Coverage report
npm run test:integration # E2E schema integration test
# Schema Generation
npm run generate # Complete pipeline
npm run generate:json # Generate JSON Schema only
npm run generate:python # Generate Pydantic only
npm run build:ts # Compile TypeScript only
# Maintenance
npm run clean # Clean all generated files# All tests
pnpm run test
# Per package
pnpm --filter designer test # React component tests
pnpm --filter bms-schemas test # Schema validation tests
pnpm --filter iot-supervisor-app pytest tests/ # Python API tests# Schema integration (requires IoT Supervisor running on port 8081)
pnpm --filter bms-schemas run test:integration# 1. Test schema generation
cd packages/bms-schemas
npm run clean
npm run build # Should pass all tests + generate outputs
# 2. Verify outputs exist
ls typescript/ # Should have organized JS/TS files
ls python/ # Should have flow_node.py + index.py
ls json-schema/ # Should have flow-node.json# 1. Start Designer app
cd apps/designer
npm run dev # http://localhost:3000
# 2. Verify schema integration
# - Visit http://localhost:3000
# - Check "Schema Integration Test" component displays correctly
# - Should show green "β
Valid" status# 1. Setup IoT Supervisor (if not already done)
cd apps/iot-supervisor-app
./install.sh # Creates venv and installs dependencies
source .venv/bin/activate # Or .venv/bin/activate.fish for fish shell
# 2. Start IoT Supervisor
iot-supervisor-app start-serve --port 8081
# 3. Test API endpoints
curl http://localhost:8081/health
curl http://localhost:8081/api/schema/node-types
# 4. Test schema validation
curl -X POST http://localhost:8081/api/config/deploy \
-H "Content-Type: application/json" \
-d '[{"id":"test","type":"input.sensor","position":{"x":100,"y":200},"data":{}}]'# 1. Start both apps
# Terminal 1: apps/designer - npm run dev (port 3000)
# Terminal 2: apps/iot-supervisor-app - source .venv/bin/activate && iot-supervisor-app start-serve --port 8081
# 2. Run integration test
cd packages/bms-schemas
npm run test:integration # Should pass all 3 test phasesbms-supervisor-controller/
βββ package.json # Root workspace config
βββ pnpm-workspace.yaml # PNPM workspace definition
βββ .npmrc # PNPM configuration
βββ apps/
β βββ designer/ # Next.js visual programming interface
β βββ iot-supervisor-app/ # FastAPI IoT runtime
β βββ simulator/ # (Empty - reserved for future)
βββ packages/
βββ bms-schemas/ # Shared schema package
βββ src/ # Source Zod schemas (multi-file)
βββ typescript/ # Generated TypeScript output
βββ python/ # Generated Pydantic models
βββ json-schema/ # Generated JSON Schema
βββ integration-tests/ # E2E schema tests
- Start development:
pnpm run dev - Make schema changes: Edit files in
packages/bms-schemas/src/ - Test schemas:
pnpm --filter bms-schemas test - Regenerate outputs:
pnpm run schema:generate - Verify integration: Both apps should reflect changes automatically
- Designer changes: Edit React components in
apps/designer/src/ - IoT Supervisor changes: Edit FastAPI endpoints in
apps/iot-supervisor-app/ - Schema changes: Add/modify schemas in
packages/bms-schemas/src/ - Always run tests:
pnpm run testbefore committing
Schema generation fails:
cd packages/bms-schemas
npm run clean && npm run buildImport errors in apps:
# Rebuild schema package
pnpm run schema:generateTest failures:
# Check individual test suites
pnpm --filter bms-schemas test
pnpm --filter designer testTypeScript errors:
# Clean and rebuild everything
pnpm run clean
pnpm install
pnpm run schema:generate
pnpm run build# One-time setup (after initial installation)
pnpm run setup:hooks # Install pre-commit and git hooks
# Update hooks periodically
pnpm run hooks:update # Update hook versionsWhat the hooks do:
- Python: Black (format), Ruff (lint), type checking
- TypeScript: Prettier (format), ESLint (lint)
- Common: Remove trailing whitespace, fix line endings, validate YAML/JSON
- Schema: Verify schema tests pass when schemas are modified
Manual testing:
pnpm run hooks:run # Run hooks on all files- Frontend: Next.js 15.5, TypeScript, Tailwind CSS v4, React Flow, Zustand
- Backend: FastAPI, Typer, uvicorn, BACnet (BAC0, bacpypes)
- Schema: Zod (source), JSON Schema (intermediate), Pydantic (Python)
- Testing: Jest, React Testing Library, pytest
- Build: PNPM workspaces, TypeScript, tsx, datamodel-code-generator
- Code Quality: Prettier, ESLint, Black, Ruff, pre-commit hooks
This project is licensed under the AGPL-3.0 License. See the root LICENSE file and docs/LICENSE.md for third-party notices and details.
- Project Status - Current development phase and progress
- Contributing Guide - How to contribute to the project
- License - AGPL-3.0 License and third-party notices
- Coding Standards - Development standards and practices