JCC Express

Sequelize

Introduction

JCC Express MVC supports Sequelize as an alternative ORM path through DatabaseServiceProvider and SequelizeDriver.

When enabled, the framework resolves a Sequelize connection and aliases it as:

  • database.connection
  • sequelize

Enable Sequelize

Set env/config to use Sequelize:

env

app/Config/database.ts already contains the expected sequelize block:

TypeScript

Required packages

Install Sequelize and a SQL driver package:

Bash

For PostgreSQL or SQLite, install the matching dialect package(s).


Do not manually create model files for this flow. Use ArtisanNode:

Bash

SequelizeDriver auto-loads models from app/Models, so generated model files are discovered at connect time.


Sequelize model example

In Sequelize mode, model files in app/Models should follow Sequelize's Model.init(...) pattern:

TypeScript

What the driver does on connect

From SequelizeDriver:

  • creates Sequelize instance with your config
  • calls authenticate()
  • auto-loads model files from app/Models
  • runs sequelize.sync(config.sync)
  • optionally drops tables when dropTables is enabled

Access the Sequelize connection

To get the Sequelize instance:

TypeScript

The connection is registered as a singleton by DatabaseServiceProvider.


Notes

  • Sequelize setup is selected by DB_ORM=sequelize.
  • Model loading scans app/Models for .ts / .js files.
  • Keep sync.force / dropTables disabled in production unless intentionally resetting schema.

Summary

  • Set DB_ORM=sequelize.
  • Configure app/Config/database.ts -> sequelize.
  • Install required npm packages.
  • Generate models with bun artisanNode make:model User.
  • Resolve connection via app.resolve("sequelize").