> ## Documentation Index
> Fetch the complete documentation index at: https://docs.erna.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Create your first schedule in under 5 minutes

This guide walks through creating a basic schedule: two employees, two shifts, one day.

## Prerequisites

* Node.js 20+
* Docker (for the solver)

## 1. Install dabke

```bash theme={null}
npm install dabke
```

## 2. Start the solver

```bash theme={null}
docker run -p 8080:8080 christianklotz/dabke-solver:latest
```

## 3. Create a schedule

```typescript theme={null}
import { ModelBuilder, HttpSolverClient, parseSolverResponse } from "dabke";

// Define the scheduling problem
const builder = new ModelBuilder({
  employees: [
    { id: "alice", roleIds: ["server"] },
    { id: "bob", roleIds: ["server"] },
  ],
  shiftPatterns: [
    { id: "morning", startTime: { hours: 8 }, endTime: { hours: 16 } },
    { id: "evening", startTime: { hours: 16 }, endTime: { hours: 23 } },
  ],
  coverage: [
    {
      day: "2026-02-09",
      startTime: { hours: 8 },
      endTime: { hours: 16 },
      roleIds: ["server"],
      targetCount: 1,
      priority: "MANDATORY",
    },
    {
      day: "2026-02-09",
      startTime: { hours: 16 },
      endTime: { hours: 23 },
      roleIds: ["server"],
      targetCount: 1,
      priority: "MANDATORY",
    },
  ],
  schedulingPeriod: {
    dateRange: { start: "2026-02-09", end: "2026-02-10" },
  },
  ruleConfigs: [
    { name: "max-hours-day", config: { hours: 8, priority: "MANDATORY" } },
    { name: "min-rest-between-shifts", config: { hours: 10, priority: "MANDATORY" } },
  ],
});

// Compile to a solver request
const { request, canSolve, validation } = builder.compile();

if (!canSolve) {
  console.error("Cannot solve:", validation.errors);
  process.exit(1);
}

// Solve
const solver = new HttpSolverClient(fetch, "http://localhost:8080");
const response = await solver.solve(request);
const result = parseSolverResponse(response);

console.log("Status:", result.status);
for (const assignment of result.assignments) {
  console.log(`${assignment.employeeId} → ${assignment.shiftPatternId} on ${assignment.day}`);
}
```

## What happened

1. **ModelBuilder** took your employees, shifts, coverage, and rules and compiled them into a CP-SAT constraint model
2. **HttpSolverClient** sent the model to the solver service
3. **parseSolverResponse** turned the raw solver output into typed shift assignments

The solver found an assignment where each shift has exactly one server and no employee works more than 8 hours.

## Next steps

* [Rules guide](/dabke/guides/rules): learn about the 12 built-in scheduling rules
* [Semantic time guide](/dabke/guides/semantic-time): define flexible time periods that vary by day
* [Validation guide](/dabke/guides/validation): understand coverage gaps and rule violations
