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);
}
Get Started with M1
M1 is currently in early preview. Download the preview version or build from source.