dorm 0.4.0


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:


License Dub downloads Integration Tests

A sophisticated D ORM using rorm-lib as a backend.

Works standalone using multi-threading or with vibe-core.

The following databases are currently supported:

  • SQLite 3
  • MariaDB 10.5 - 10.9
  • Postgres 11 - 15


Take a look at rorm-orm/docs or just use the deployed documentation:

Auto-generated source code documentation is available on


dub add dorm

When first compiling, DORM will automatically download pre-compiled library binaries into the package location when it hasn't been downloaded yet. You can also manually put the librorm.a (Posix) or rorm.lib (Windows) file into the DUB package to not make it download anything.

You can use dub run dorm to run the supporting CLI tool, which will be downloaded at the same time. rorm-cli is used for creating migrations, which you check-in into your project source and to apply migrations both on development machines as well as on production machines.


For a more detailed walkthrough see

module models;


mixin RegisterModels;

class User : Model
	@Id long id;

	string username;

	string password;

	SysTime createdAt;

	bool isAdmin;

	@constructValue!(() => Clock.currTime + 24.hours)
	SysTime tempPasswordTime;
import models;

import faked, std.datetime.systime, std.random, std.stdio;

import dorm.api.db;

mixin SetupDormRuntime;

void main() {
	struct UserSelection {
		long id;
		string username;
		SysTime createdAt;

	auto appConfig = parseTomlConfig!BareConfiguration("database.toml");
	auto db = DormDB(appConfig.database);

	auto f = new Faker_de(uniform!int);

	foreach (i; 0 .. 2) {
		struct UserInsert {
			string username;
			string password;
			bool isAdmin;

		UserInsert user;
		user.username = f.nameName;
		user.password = "123456";

	auto oldestUsers =!UserSelection
		.condition(u => u.not.isAdmin)
		.orderBy(u => u.createdAt.asc)

	writeln("Oldest 5 Users:");
	foreach (i, user; oldestUsers) {
		writefln!"#%d %s\tcreated at %s"(i + 1, user.username, user.createdAt);

		// delete first user
		if (i == 0)

For a more detailed walkthrough see


Before contribution, see the development guidelines.

Sub packages:
dorm:build-models, dorm:init-exec
mir-toml, vibe-core, mir-ion
0.4.0 2023-Feb-21
0.3.1 2022-Dec-01
0.3.0 2022-Dec-01
0.2.0 2022-Nov-30
0.1.0 2022-Nov-24
Show all 9 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 82 downloads total

Short URL: