1001Ferramentas
🌊Dev

Sequelize Init Generator

Generates the Sequelize ORM config/config.js with development, test and production environments, all on the postgres dialect. Copy it and adjust the credentials.



  

Sequelize config with three environments

sequelize-cli expects one configuration block per environment, and if you only run sequelize init once a year the shape slips away: which keys are snake_case, where DATABASE_URL belongs in production, what actually differs between development and test. This page hands you that skeleton with all three blocks written out and pointed at a local Postgres.

There are no inputs. The text is fixed, it renders as soon as the page opens, and the button simply reprints it. Look at how the environments differ: development and test spell out username, password, database and host, while production uses use_env_variable with 'DATABASE_URL', telling Sequelize to read the whole connection string from that variable instead of separate fields.

One thing trips people up: the content is module.exports, so it has to be a .js file, and sequelize-cli looks for config/config.json by default. Either add a .sequelizerc pointing at config/config.js or pass --config on the command line. The dialect is hardcoded to postgres, so edit all three blocks for MySQL or SQLite. Managed databases usually need dialectOptions with ssl too. It is all assembled client side.

Frequently asked questions

Can I pick MySQL or SQLite in the tool?
No, the dialect always comes out as postgres. Switching means editing one word in each of the three blocks and installing the matching driver.
Why does the production block have no username or password?
It relies on use_env_variable, so Sequelize reads the full URL from DATABASE_URL. That is how most hosting platforms hand you a database.
Do I need a .sequelizerc file?
You do, because this output is a JS module. Without it, sequelize-cli keeps looking for config/config.json and your migrations find no configuration at all.

Related Tools