M1 Programming Language

First of the M-Series

Designed for microservices and embedded systems with ultra-fast performance and minimal footprint.

// M1 Hello World Microservice
service HelloWorld {
    // Define the service endpoint
    endpoint "/hello" {
        // Handle GET requests
        method GET {
            // Return a simple response
            return {
                "message": "Hello, World!",
                "timestamp": now()
            };
        }
    }
    
    // Start the service on port 8080
    start(8080);
}

Key Features

Microservice-First

Built from the ground up for microservices architecture with native service discovery and communication.

Ultra-Fast Startup

Services start in under 10ms, making M1 perfect for serverless and on-demand computing.

Tiny Footprint

The entire M1 runtime is less than 500KB, with minimal memory usage starting at just 2MB.

Built-in API Gateway

Includes a lightweight API gateway for routing, load balancing, and service composition.

Security-Focused

Built-in security features including TLS, authentication, and authorization with minimal configuration.

Service Mesh Integration

Seamless integration with popular service mesh solutions like Istio, Linkerd, and Consul.

Microservices Made Simple

M1 makes building microservices easier than ever with a declarative syntax and built-in features for service discovery, communication, and deployment.

  • Declarative service definitions
  • Automatic service discovery
  • Built-in health checks and circuit breakers
  • Native support for REST, GraphQL, and gRPC
  • Integrated metrics and tracing

M1 services can be deployed anywhere - from containers to serverless platforms to edge devices - with consistent behavior and minimal configuration.

// User Service in M1
service UserService {
    // Define data model
    model User {
        id: string;
        name: string;
        email: string;
        created_at: timestamp;
    }
    
    // Database connection
    db = connect("postgres://localhost:5432/users");
    
    // Define endpoints
    endpoint "/users" {
        // Get all users
        method GET {
            let users = db.query("SELECT * FROM users");
            return users;
        }
        
        // Create a new user
        method POST {
            let user = request.body as User;
            user.id = uuid();
            user.created_at = now();
            
            db.execute("INSERT INTO users VALUES ($1, $2, $3, $4)",
                user.id, user.name, user.email, user.created_at);
            
            return {
                "status": "success",
                "user": user
            };
        }
    }
    
    // Get user by ID
    endpoint "/users/:id" {
        method GET {
            let id = request.params.id;
            let user = db.queryOne("SELECT * FROM users WHERE id = $1", id);
            
            if (user == null) {
                response.status = 404;
                return {
                    "status": "error",
                    "message": "User not found"
                };
            }
            
            return user;
        }
    }
    
    // Start the service
    start(8081);
}
// Embedded temperature sensor in M1
device TempSensor {
    // Configure GPIO pins
    pin sensor = GPIO(4);
    pin led = GPIO(17, OUTPUT);
    
    // Initialize I2C for the sensor
    i2c = I2C(1, 0x48);
    
    // Read temperature every second
    timer(1000) {
        // Read raw value from sensor
        let raw = i2c.readWord(0x00);
        
        // Convert to Celsius
        let temp = raw * 0.0625;
        
        // Turn on LED if temperature is too high
        if (temp > 30.0) {
            led.high();
        } else {
            led.low();
        }
        
        // Log the temperature
        log("Temperature: " + temp + "°C");
        
        // Send to MQTT broker if connected
        if (mqtt.isConnected()) {
            mqtt.publish("sensors/temperature", {
                "value": temp,
                "unit": "celsius",
                "timestamp": now()
            });
        }
    }
    
    // Connect to MQTT broker
    mqtt = MQTT.connect("mqtt://broker.example.com");
    
    // Start the device
    start();
}

Perfect for Embedded Systems

M1 is designed to run on resource-constrained devices with minimal overhead, making it ideal for IoT, edge computing, and embedded systems.

  • Direct hardware access with safety guarantees
  • Built-in support for common protocols (I2C, SPI, UART)
  • Native MQTT and CoAP integration
  • Efficient binary serialization
  • Deterministic memory usage with no garbage collection

M1's embedded runtime can be as small as 100KB, allowing it to run on microcontrollers with limited resources while still providing a modern programming experience.

Get Started with M1

M1 is currently in early preview. Download the preview version or build from source.

Windows

64-bit installer

Download

macOS

Universal binary

Download

Linux

x86_64 package

Download

Source Code

Build from source

GitHub