Skip to content

Installation

This page shows how to install the Dox CLI, make a new project and start the server.

Dox needs Dart 3.13 or newer.

Install the CLI

The dox CLI makes projects, runs the server and makes files. Install it with pub:

dart pub global activate dox

Check that it works:

dox version

If the shell shows "dox: command not found", the pub bin folder is not in your path. Add this line to ~/.bashrc or ~/.zshrc, then open a new terminal:

export PATH="$PATH":"$HOME/.pub-cache/bin"

Create a new project

Give dox create the name of your app, then get the packages:

dox create new_blog
cd new_blog
dart pub get

It downloads the newest release of the starter project, dox-sample. Add --version with a release tag to get one release. It also makes your .env file with a new random app key.

The starter project uses SQLite, so you do not install a database. To use Postgres or MySQL, change DB_CONNECTION and the other database keys in .env. See Database.

Add Dox to a Dart project

In a Dart project that you have, add the packages with dart pub add:

dart pub add dox_core dox_orm dox_migration
dart pub add dev:dox_builder dev:build_runner

Start the server

Start the server in dev mode:

dox s

It runs bin/server.dart and build_runner watch. It hot reloads a change in lib/app/, and it restarts the server for a change to routes, providers or config. At each start the server runs the new migrations, on the port in APP_PORT (default 3000):

curl localhost:3000/ping
pong

Add --ignore-build-runner to skip the builder, or --no-reload to stop hot reload. To start the server with no CLI, run dart run bin/server.dart.

For production, build a native binary with dox build. See Deployment.

Start the server with Docker

The starter project has a Docker setup. This starts the app, a queue worker and a Postgres database:

docker compose up -d --build

The app and the worker always use the Postgres service. The database port is open on this machine only.

To run only the database in Docker and the app with dox s, run docker compose up -d postgres. Then set DB_CONNECTION=postgres and DB_NAME=dox in .env.

Run the code generator

Dox makes code for models and DTOs with build_runner. dox s runs it. To run it alone:

dox build_runner:watch   # runs again on each file change
dox build_runner:build   # runs one time

AI agents

To give an AI coding agent the real API of each package, run dart run skills@ get after dart pub get. See AI agents.

Packages

Dox has many packages, so you add only what you need:

Package What it does
dox the CLI
dox_core HTTP server, routing, requests, responses, validation
dox_orm query builder and models
dox_migration database migrations
dox_auth Login with access tokens, JWT or sessions
dox_builder, dox_annotation code generation for models, DTOs and the container
dox_validation typed validation schemas
dox_openapi OpenAPI docs
dox_storage file storage: local, S3, Azure
dox_cache cache: memory, file, Redis
dox_cache_database cache in a database table
dox_socketio Socket.IO server
dox_queue background jobs
dox_queue_database queue in a database table
dox_scheduler scheduled tasks
dox_mailer send email
dox_view HTML views
dox_inertia Inertia.js pages
dox_http_native native HTTP server (Rust)
dox_postgres_native, dox_mysql_native native drivers for Postgres and MySQL/MariaDB

Next steps