|
|
1 ماه پیش | |
|---|---|---|
| cmake | 4 ماه پیش | |
| config | 1 ماه پیش | |
| docs | 1 ماه پیش | |
| lib | 1 ماه پیش | |
| nodes | 1 ماه پیش | |
| packaging | 1 ماه پیش | |
| proto | 4 ماه پیش | |
| src | 1 ماه پیش | |
| systemd | 1 ماه پیش | |
| tasks | 4 ماه پیش | |
| webui | 4 ماه پیش | |
| .gitignore | 1 ماه پیش | |
| CLAUDE.md | 1 ماه پیش | |
| CMakeLists.txt | 4 ماه پیش | |
| README.md | 1 ماه پیش | |
| VERSION | 4 ماه پیش | |
| package-lock.json | 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 9004)│ │(Pt 9011) │ QuickJS Engine
│ external│ └──────────┘
└─────────┘
Database (external - not built from this repo)
smartbotic-database daemon, developed at
ssh://git@git.smartbotics.ai:10022/fszontagh/smartbotic-database.gitsmartbotic-database;
this repo links against its libsmartbotic-db-client-dev package/etc/smartbotic-database/config.jsonWebServer 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-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 the external database daemon (must be first)
sudo systemctl start 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:
webserver.json - HTTP port, JWT settings, CORS, runner load balancing, database_addressrunner.json - Runner ID, max concurrent executions, node hot reload, database_addressThe database daemon is configured separately at /etc/smartbotic-database/config.json,
which is owned by the upstream smartbotic-database package.
Configuration supports environment variable substitution using ${VAR_NAME:default} syntax.
Both service configs expose the same two database settings, so the host, port and namespace are configurable everywhere without editing a file:
| Key | Default | Env override | Purpose |
|---|---|---|---|
database_address |
localhost:9004 |
DATABASE_ADDRESS |
Host and port of the smartbotic-database daemon |
database_project |
smartbotic-automation |
DATABASE_PROJECT |
Multi-tenant namespace within that daemon |
A single smartbotic-database instance is designed to serve multiple projects.
database_project selects which namespace this deployment owns - the client sends
every collection as <project>:<collection>, so two projects sharing one daemon
never see each other's collections. Leave it at smartbotic-automation unless you
are running more than one independent SmartBotic deployment against the same
database, in which case give each one a distinct value.
Do not set
database_projecttodefault: that is the shared back-compat namespace, where unrelated projects would collide.
config/webserver.json{
"http_port": 8090,
"node_sync_port": 9012,
"credential_service_port": 9013,
"static_files_path": "${WEBUI_PATH:./webui/dist}",
"database_address": "${DATABASE_ADDRESS:localhost:9004}",
"database_project": "${DATABASE_PROJECT:smartbotic-automation}",
"auth": {
"jwt_secret": "${JWT_SECRET:dev-secret-change-in-production}",
"access_token_lifetime_sec": 900,
"refresh_token_lifetime_sec": 604800
}
}
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 taskssystemctl status smartbotic-database)rm -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.