> ## 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.

# Overview

> Scheduling library powered by constraint programming (CP-SAT)

Define your team, shifts, coverage, and rules. dabke turns them into an optimized schedule.

## Why dabke?

Staff scheduling with constraint programming is dominated by Python ([OR-Tools](https://developers.google.com/optimization)) and Java ([Timefold](https://timefold.ai/)). If you're building in TypeScript, your options have been: call a Python service and figure out the model yourself, or write scheduling heuristics by hand.

dabke gives you a **TypeScript-native API** for expressing scheduling problems declaratively (employees, shifts, coverage requirements, and rules) and compiles them into a CP-SAT model solved by OR-Tools. You describe *what* you need, not *how* to solve it.

## Key features

* **Declarative rules**: express constraints like "max 8 hours/day" or "11 hours rest between shifts" as config, not code
* **Semantic time**: define named periods ("lunch\_rush", "closing") that vary by day of week
* **Soft and hard constraints**: some rules are mandatory, others are preferences the solver optimizes for
* **Scoped rules**: apply constraints globally, per person, per role, per skill, or during specific time periods
* **Validation**: detailed reporting on coverage gaps and rule violations before and after solving

## How it works

```
Your config → ModelBuilder → CP-SAT model → Solver → Schedule
```

1. **Define** employees, shift patterns, coverage requirements, and rules
2. **Compile** with `ModelBuilder` into a constraint model
3. **Solve** by sending the model to a CP-SAT solver service
4. **Parse** the solver response into shift assignments

The solver runs as a separate service (Docker container). dabke handles the model construction and result parsing in TypeScript.

## Install

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

The solver is available as a Docker image:

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