Step-by-step guides to help you master SchoBase, from basic setup to advanced industrial integrations and real-time analytics.
Install SchoBase, define your first schema, and write your first time series data.
Create a React dashboard with live data updates using SchoBase subscriptions.
Integrate industrial OPC UA servers and ingest data automatically into SchoBase.
Learn to perform downsampling, calculate moving averages, and detect anomalies.
Track 6-axis robot telemetry data and build predictive maintenance alerts.
Implement TLS encryption, RBAC, audit logging, and compliance requirements.
This tutorial will walk you through installing SchoBase, defining your first schema, and writing time series data.
Install the SchoBase SDK using your preferred package manager:
npm install schobase zodCreate a schema for your time series data using Zod validators:
import { defineSchema } from 'schobase'
import { z } from 'zod'
const schema = defineSchema({
tables: {
temperatures: {
validator: z.object({
sensorId: z.string(),
timestamp: z.date(),
temperature: z.number().min(-40).max(125),
location: z.string(),
}),
timeIndex: 'timestamp',
indexes: ['sensorId', 'location'],
},
},
})Create a client instance with your credentials:
import { createClient } from 'schobase'
const client = createClient({
endpoint: process.env.SCHOBASE_ENDPOINT,
apiKey: process.env.SCHOBASE_API_KEY,
schema,
})Write a temperature reading to the database:
await client.temperatures.write({
sensorId: 'temp-sensor-01',
timestamp: new Date(),
temperature: 23.5,
location: 'warehouse-a',
})
console.log('Data written successfully!')Retrieve data with type-safe queries:
const readings = await client.temperatures
.query()
.where('sensorId', '==', 'temp-sensor-01')
.timeRange({
start: new Date(Date.now() - 3600000), // Last hour
end: new Date(),
})
.orderBy('timestamp', 'desc')
.limit(10)
.execute()
console.log('Recent readings:', readings)Congratulations!
You've successfully set up SchoBase and written your first time series data. Check out the other tutorials to learn more advanced features.
Build a React dashboard with live data updates using SchoBase real-time subscriptions.
This tutorial assumes you've completed the Getting Started tutorial and have a working SchoBase client.
import { useEffect, useState } from 'react'
import { client } from './schobase'
function TemperatureDashboard() {
const [readings, setReadings] = useState([])
useEffect(() => {
const unsubscribe = client.temperatures
.subscribe()
.where('location', '==', 'warehouse-a')
.onUpdate((reading) => {
setReadings((prev) => [...prev.slice(-99), reading])
})
return unsubscribe
}, [])
return (
<div>
<LineChart data={readings} />
<MetricsGrid readings={readings} />
</div>
)
}Learn how to connect to industrial OPC UA servers and automatically ingest data into SchoBase.
import { OpcUaAdapter } from 'schobase'
const opcua = new OpcUaAdapter({
endpoint: 'opc.tcp://plc-01.factory.local:4840',
securityMode: 'SignAndEncrypt',
securityPolicy: 'Basic256Sha256',
credentials: {
username: process.env.OPCUA_USER,
password: process.env.OPCUA_PASSWORD,
},
})
// Subscribe to multiple nodes
await opcua.subscribe([
{ nodeId: 'ns=2;s=Temperature', samplingInterval: 1000 },
{ nodeId: 'ns=2;s=Pressure', samplingInterval: 1000 },
{ nodeId: 'ns=2;s=FlowRate', samplingInterval: 500 },
])Pro Tip: Use the SignAndEncrypt security mode for production deployments to ensure data integrity and confidentiality.
Join our community to get support, share your progress, and learn from other developers.