Skip to main content

dabke

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) and Java (Timefold). 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

npm install dabke
The solver is available as a Docker image:
docker run -p 8080:8080 christianklotz/dabke-solver:latest