|
|
преди 4 месеца | |
|---|---|---|
| cmake | преди 6 месеца | |
| config | преди 6 месеца | |
| docs | преди 6 месеца | |
| lib | преди 6 месеца | |
| nodes | преди 6 месеца | |
| proto | преди 6 месеца | |
| src | преди 6 месеца | |
| systemd | преди 6 месеца | |
| webui | преди 6 месеца | |
| .gitignore | преди 6 месеца | |
| CLAUDE.md | преди 6 месеца | |
| CMakeLists.txt | преди 6 месеца | |
| README.md | преди 4 месеца |
A powerful workflow automation and execution platform built with a modern microservices architecture.
SmartBotic is a distributed system for creating, managing, and executing complex workflows. It features a high-performance C++20 backend with gRPC communication, an in-memory database with persistence, and a modern React/TypeScript frontend for workflow design.
SmartBotic consists of three microservices:
┌─────────────────┐
│ WebUI │ React/TypeScript Frontend
│ (Port 3000) │ Workflow Editor, Dashboard
└────────┬────────┘
│ HTTP/WS
↓
┌─────────────────┐
│ WebServer │ HTTP REST API, WebSocket
│ (Port 8090) │ JWT Auth, Runner Registry
└────┬───────┬────┘
│ │ gRPC
↓ ↓
┌─────────┐ ┌──────────┐
│Database │ │ Runner(s)│ Workflow Execution
│(Pt 9010)│ │(Pt 9011) │ QuickJS Engine
└─────────┘ └──────────┘
Database Service (src/database/)
WebServer Service (src/webserver/)
Runner Service (src/runner/)
# Create build directory
mkdir build && cd build
# Debug build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make -j$(nproc)
# Release build (optimized)
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j$(nproc)
# With Address Sanitizer (for debugging memory issues)
cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=ON ..
make -j$(nproc)
Binaries will be created in the build/ directory:
smartbotic-databasesmartbotic-webserversmartbotic-runnercd webui
# Install dependencies
npm install
# Development server (port 3000, proxies API to localhost:8090)
npm run dev
# Production build
npm run build
# Lint
npm run lint
The production build outputs to webui/dist/ and is served by the WebServer service.
Services must be started in order due to dependencies:
# 1. Start Database service (must be first)
./build/smartbotic-database
# 2. Start WebServer (depends on Database)
./build/smartbotic-webserver
# 3. Start Runner(s) (depends on Database and WebServer)
./build/smartbotic-runner
# Start all services
systemctl --user start smartbotic.target
# Check status
systemctl --user status smartbotic-*
# View logs
journalctl --user -u smartbotic-* -f
# Stop all services
systemctl --user stop smartbotic.target
Unit files are provided in the systemd/ directory.
adminadmin⚠️ Change these credentials in production!
Services load JSON configuration files from the config/ directory:
database.json - Storage settings, WAL/snapshot intervalswebserver.json - HTTP port, JWT settings, CORS, runner load balancingrunner.json - Runner ID, max concurrent executions, node hot reloadConfiguration supports environment variable substitution using ${VAR_NAME:default} syntax.
config/webserver.json{
"httpPort": 8090,
"grpcPort": 9002,
"databaseAddress": "localhost:9010",
"jwtSecret": "${JWT_SECRET:your-secret-key-change-in-production}",
"jwtExpiration": 3600,
"staticFilesPath": "./webui/dist"
}
Workflow nodes are JavaScript modules located in the nodes/ directory. Each node defines:
See docs/nodes.md for a complete guide on creating nodes.
// nodes/my-node.js
module.exports = {
configSchema: {
type: "object",
properties: {
message: { type: "string", default: "Hello" }
}
},
inputSchema: {
type: "object",
properties: {
name: { type: "string" }
}
},
outputSchema: {
type: "object",
properties: {
greeting: { type: "string" }
}
},
execute: async (config, input, context) => {
return {
greeting: `${config.message}, ${input.name}!`
};
}
};
After creating nodes in nodes/, migrate them to the running database:
# 1. Get JWT token
TOKEN=$(curl -s http://localhost:8090/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"username": "admin", "password": "admin"}' | jq -r '.accessToken')
# 2. Migrate nodes
curl -X POST http://localhost:8090/api/v1/nodes/migrate \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"nodesPath": "./nodes"}'
# 3. Verify
curl http://localhost:8090/api/v1/nodes \
-H "Authorization: Bearer $TOKEN"
Runners automatically receive updates via gRPC streaming - no restart required!
# Login
curl -X POST http://localhost:8090/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"username": "admin", "password": "admin"}'
# List workflows
curl http://localhost:8090/api/v1/workflows \
-H "Authorization: Bearer $TOKEN"
# Create workflow
curl -X POST http://localhost:8090/api/v1/workflows \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "My Workflow",
"description": "Test workflow",
"definition": {...}
}'
# Execute workflow
curl -X POST http://localhost:8090/api/v1/workflows/{id}/execute \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"input": {}}'
Connect to ws://localhost:8090/api/v1/ws?token={JWT_TOKEN} for real-time updates:
const ws = new WebSocket(`ws://localhost:8090/api/v1/ws?token=${token}`);
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log('Update:', data);
};
smartbotic/
├── build/ # Build output directory
├── cmake/ # CMake modules
├── config/ # Runtime configuration files
├── docs/ # Documentation
│ └── nodes.md # Node development guide
├── lib/ # Shared C++ libraries
│ ├── common/ # Utilities (UUID, time, string)
│ ├── config/ # Configuration loader
│ ├── credentials/ # Credential management
│ ├── crypto/ # Encryption (AES-GCM)
│ ├── logging/ # Logging wrapper
│ └── storage/ # Database client
├── nodes/ # Workflow node definitions (JS)
├── proto/ # Protocol Buffer definitions
├── src/ # Microservice implementations
│ ├── database/ # Database service
│ ├── runner/ # Runner service
│ └── webserver/ # WebServer service
├── systemd/ # systemd unit files
├── webui/ # React frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Page components
│ │ ├── stores/ # Zustand state management
│ │ └── types/ # TypeScript types
│ └── dist/ # Production build output
├── CLAUDE.md # AI assistant guidance
└── CMakeLists.txt # Root CMake configuration
-Wall -Wextra -Wpedantic# C++ (if tests are configured)
cd build
ctest
# Frontend
cd webui
npm run lint
git checkout -b feature/amazing-feature)git commit -m 'feat: add amazing feature')git push origin feature/amazing-feature)Follow conventional commits:
feat: - New featurefix: - Bug fixdocs: - Documentation changesrefactor: - Code refactoringtest: - Adding testschore: - Maintenance tasksrm -rf build && mkdir build && cd build && cmake ..webui/vite.config.ts proxy configuration⚠️ Production Checklist:
[License information not specified - please add LICENSE file]
For issues, questions, or contributions, please use the project's issue tracker.
Built with ❤️ using C++20, React, and modern cloud-native practices.