Skip to content

Setup

Installation and setup is straightforward if you’re using the compiler.

Want to use this with your favourite bundler? See Bundlers and Runtimes for current guidance. That flow avoids writing compiled files directly into your source directory.

  1. Install the package:

    Terminal window
    bun add @sqts/core
  2. Create a sqts.config.ts file in your project root:

    import { defineConfig } from "@sqts/core/config";
    export default defineConfig({
    executor: {
    module: "@sqts/core/adapters/bun-sqlite", // or path/to/my/adapter.ts
    }
    });
  3. Start writing .sqts files and run sqts compile.

If you need another database adapter, you can use the list of built-in ones (see sidebar), or write your own. See Custom Adapters for more details.

By default, the compiler emits a types file for your models based on your migrations. If you don’t want this, SQTS can fall back on inline types per operation:

import { defineConfig } from "@sqts/core/config";
export default defineConfig({
executor: {
module: "@sqts/core/adapters/bun-sqlite",
},
compiler: {
modelTypes: false
}
});