Skip to content

smartboot/verge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

31 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Verge

CI Docker Go Version License

๐Ÿ‡บ๐Ÿ‡ธ English | ๐Ÿ‡จ๐Ÿ‡ณ ็ฎ€ไฝ“ไธญๆ–‡

A lightweight, standardized edge computing gateway solution โ€” Focused on device data acquisition and governance, minimizing hardware resource requirements.

Design Philosophy

Traditional edge gateways often integrate full-stack functionality including device access, scene linkage, rule engines, and user interfaces. This "all-in-one" design leads to:

  • High resource consumption, requiring powerful hardware
  • Frequent OTA updates, where any feature iteration may affect core stability
  • High hardware barriers, difficult to deploy on low-end devices

Verge adopts an "Application-Edge Separation" architecture: Complex business logic (scene linkage, rule engines, user interfaces) is placed in the application layer, while the edge gateway only handles core device access and data acquisition. The application layer can be deployed on cloud servers or run as a local desktop application.

Architecture

Core Advantages

Dimension Traditional Gateway Verge Gateway
Resource Usage High Ultra-Low
OTA Frequency High Near Zero
Hardware Requirements Mid-High Any Hardware
Stability Affected by App Iteration Long-term Stable

Technical Implementation

Verge is built on the driver-box framework, leveraging its mature device access capabilities.

Cloud-Edge Communication

  • SSE (Server-Sent Events) - Maintains long-polling connection with cloud for real-time command reception
  • JSON-RPC 2.0 - Standardized remote procedure call protocol

Communication Flow

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Verge  โ”‚                                          โ”‚  Cloud  โ”‚
โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜                                          โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜
     โ”‚                                                    โ”‚
     โ”‚  1. Login (Authenticate with Serial Number)        โ”‚
     โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ    โ”‚
     โ”‚                                                    โ”‚
     โ”‚  2. Return Token                                   โ”‚
     โ”‚ โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€    โ”‚
     โ”‚                                                    โ”‚
     โ”‚  3. Establish SSE Connection                       โ”‚
     โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ    โ”‚
     โ”‚                                                    โ”‚
     โ”‚  4. Periodically Report Device Shadow & Metadata   โ”‚
     โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ    โ”‚
     โ”‚                                                    โ”‚
     โ”‚  5. Send Control Commands (JSON-RPC)               โ”‚
     โ”‚ โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€    โ”‚
     โ”‚                                                    โ”‚
     โ”‚  6. Execute Device Operations, Return Results      โ”‚
     โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ    โ”‚
     โ”‚                                                    โ”‚

Supported JSON-RPC Methods

Method Description
device.control Device control (read/write device points)
devices.add Add devices
devices.delete Delete devices
devices.report Device data reporting
products.report Product information reporting
product.import Import product model
node.configChanged Configuration change notification
node.networkStatus Network status query
node.command Execute custom command

Quick Start

Requirements

  • Go 1.23+ (for source compilation)
  • Docker & Docker Compose (for containerized deployment)

Option 1: Docker Compose

Suitable for home labs and development/testing environments:

# Clone the repository
git clone https://github.com/smartboot/verge.git
cd verge

# Start services
docker-compose up -d

# View logs
docker-compose logs -f verge

Management UI: http://localhost:18080

Option 2: Binary Deployment (Recommended for Production)

Why binary deployment?

  • Once stable, the gateway rarely needs updates โ€” deploy once, run indefinitely
  • Direct execution without container overhead
  • Better suited for industrial environments

Download from Releases:

# Extract
tar -xzf verge-linux-arm64-*.tar.gz
cd verge

# Configure cloud endpoint
export ENV_VERGE_BASE_URL=http://your-server:8080

# Start
./start.sh

Option 3: Run from Source

git clone https://github.com/smartboot/verge.git
cd verge

export ENV_VERGE_BASE_URL=http://your-server:8080

go mod tidy
go run cmd/main.go

Configuration

Environment Variables

Variable Description Required
ENV_VERGE_BASE_URL Cloud management service URL Yes

Directory Structure

verge/
โ”œโ”€โ”€ cmd/main.go              # Application entry
โ”œโ”€โ”€ pkg/
โ”‚   โ”œโ”€โ”€ sse/                 # SSE connection management
โ”‚   โ”œโ”€โ”€ rpc/                 # JSON-RPC handlers
โ”‚   โ””โ”€โ”€ reporter/            # Data reporting module
โ”œโ”€โ”€ res/
โ”‚   โ”œโ”€โ”€ driver/              # Driver configs (device models, connections)
โ”‚   โ””โ”€โ”€ library/
โ”‚       โ”œโ”€โ”€ driver/          # Lua driver scripts
โ”‚       โ”œโ”€โ”€ model/           # Product model definitions
โ”‚       โ””โ”€โ”€ protocol/        # Protocol parsing scripts
โ”œโ”€โ”€ platform/                # Platform-specific startup scripts
โ”œโ”€โ”€ Dockerfile
โ””โ”€โ”€ docker-compose.yml

Extension Development

Add RPC Methods

Register in pkg/rpc/handlers.go:

var Handlers = map[string]func(Context, interface{}) error{
    "your.method": HandleYourMethod,
}

Custom Device Drivers

Add Lua scripts in res/library/driver/. Refer to driver-box documentation.

License

Apache License 2.0

About

Verge is a lightweight edge computing gateway solution. By separating the backend management functions into an independent service, the gateway focuses solely on device data collection and governance, minimizing hardware resource requirements to an extreme level. It can be deployed on any hardware.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

ย 
ย 
ย 

Contributors