A collection of open-source tools and libraries for building modern robotics and IoT systems. Built with TypeScript, focusing on type safety, developer experience, and real-world reliability.
A modern, TypeScript-first MQTT client library that provides a better developer experience with async iterators, shared subscriptions, and React hooks.
Key Features:
- π Modern TypeScript API with async iterators
- π‘ Shared subscriptions and queue subscriptions
- π― Wildcard topic matching with parameter extraction
- β‘ Multiple parsers (string, JSON, binary)
- π£ First-class React integration
- π Built on top of mqtt.js
import { BetterMQTT } from '@robot.com/better-mqtt'
const mqtt = await BetterMQTT.connectAsync({
host: 'localhost',
port: 1883,
clientId: 'my-robot'
})
// Subscribe with async iterator
const subscription = mqtt.subscribeString('sensors/+/status')
for await (const message of subscription) {
console.log(`Sensor ${message.params[0]}: ${message.content}`)
}
A fully type-safe, modular RPC framework powered by NATS.IO for building distributed systems and microservices.
Key Features:
- π End-to-end type safety with TypeScript and Zod
- π§© Modular architecture with procedure definitions
- π High performance with NATS work queues
- π Built-in retry logic and error handling
- π Transport agnostic design
- π Flexible middleware and authentication
import { defineProcedure } from '@robot.com/rpc/client'
export const api = {
getUser: defineProcedure({
method: 'GET',
path: 'users.$id',
paramsSchema: z.object({ id: z.string() }),
outputSchema: z.object({
id: z.string(),
name: z.string(),
email: z.string()
})
})
}
Internal build tooling for the Robot OSS monorepo, powered by tsup for fast TypeScript bundling.
Internal package publishing utilities for managing releases across the monorepo.
- Node.js 18+
- pnpm 10.12.4+ (recommended package manager)
# Clone the repository
git clone https://github.com/your-org/robot-oss.git
cd robot-oss
# Install dependencies
pnpm install
# Build all packages
pnpm build
# Run tests
pnpm test
# Format code
pnpm format
# Build specific package
pnpm --filter @robot.com/better-mqtt build
# Run tests for specific package
pnpm --filter @robot.com/rpc test
robot-oss/
βββ packages/
β βββ better-mqtt/ # MQTT client library
β βββ rpc/ # RPC framework
β βββ build-package/ # Build tooling
β βββ publish-package/ # Publishing utilities
βββ pnpm-workspace.yaml # Workspace configuration
βββ biome.json # Code formatting and linting
βββ tsconfig.json # TypeScript configuration
- Sensor Data Collection: Use Better MQTT to collect data from distributed sensors
- Robot Control: Implement command/control systems with MQTT pub/sub
- Load Balancing: Use shared subscriptions for distributed robot control
- Real-time Communication: Low-latency messaging between robot components
- Service Communication: Use the RPC framework for inter-service calls
- API Gateway: Build type-safe APIs with automatic validation
- Event Streaming: Leverage NATS for reliable message delivery
- Load Balancing: Distribute work across multiple service instances
- Real-time Dashboards: React hooks for live MQTT data visualization
- Backend APIs: Type-safe RPC endpoints with automatic validation
- WebSocket Alternatives: MQTT for real-time browser communication
- Language: TypeScript
- Package Manager: pnpm
- Build Tool: tsup
- Code Quality: Biome
- Testing: Built-in test suites
- Transport: MQTT, NATS.IO
- Validation: Zod schemas
import { BetterMQTT } from '@robot.com/better-mqtt'
class RobotController {
private mqtt: BetterMQTT
constructor() {
this.mqtt = BetterMQTT.connect({
host: 'robot-broker.local',
clientId: 'robot-controller'
})
this.setupSubscriptions()
}
private setupSubscriptions() {
// Listen for movement commands
const movementSub = this.mqtt.subscribeJson<{
direction: 'forward' | 'backward' | 'left' | 'right'
speed: number
}>('robot/movement')
// Process commands
this.processMovementCommands(movementSub)
}
private async processMovementCommands(subscription: Subscription) {
for await (const message of subscription) {
const { direction, speed } = message.content
console.log(`Moving ${direction} at speed ${speed}`)
// Execute robot movement
}
}
}
import { defineProcedure } from '@robot.com/rpc/client'
import { Registry, startRpcNatsServer } from '@robot.com/rpc/server'
// Define your API
export const robotApi = {
moveRobot: defineProcedure({
method: 'POST',
path: 'robot.move',
inputSchema: z.object({
direction: z.enum(['forward', 'backward', 'left', 'right']),
speed: z.number().min(0).max(100)
}),
outputSchema: z.object({
success: z.boolean(),
newPosition: z.object({ x: z.number(), y: z.number() })
})
})
}
// Implement the service
const registry = new Registry()
registry.impl(robotApi.moveRobot, async ({ input }) => {
// Execute robot movement
const newPosition = await executeMovement(input)
return { success: true, newPosition }
})
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Follow the existing code style (enforced by Biome)
- Add tests for new functionality
- Update documentation for API changes
- Ensure all tests pass before submitting
This project is licensed under the MIT License - see the LICENSE file for details.
- mqtt.js - Excellent MQTT client library
- NATS.IO - High-performance messaging system
- tsup - Fast TypeScript bundler
- Biome - Fast formatter and linter
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Each package has its own detailed README
Built with β€οΈ for the robotics and IoT community