Proposal: Controller Generation in Sequelize

Open
#1,360 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
express, javascript, node.js
Domain
backend, cli, web-dev

Research direction

Start by locating the existing sequelize generate:model command and its templates. Compare the proposed -c option with the current generator behavior, then determine the framework templates, configuration options, and CRUD scope required. Done means an agreed design and implementation plan for controller generation, since this issue is currently seeking preliminary discussion.

Written by the indexing model from the issue text.

Description

Proposal: Controller Generation in Sequelize

Inspired by the Rails framework, I'm considering introducing a feature in Sequelize that would allow users to generate controllers alongside models, streamlining the development process for many.

Command and Output:

The envisioned command would be:

sequelize generate:model User -c koa

If the -c flag is followed by koa, Sequelize would generate a Koa-compatible controller. Similarly, specifying other frameworks like express or fastify would generate controllers tailored for them.

Implementation Plan:

  1. Templating:

    • Create templates for popular Node.js web frameworks (e.g., Express, Koa, Fastify).
    • Allow users to specify their framework of choice during generation.
  2. Configuration Options:

    • Offer customization options for the generated controllers.
  3. Basic CRUD Logic:

    • Include essential CRUD operations in the generated controllers.

Seeking Preliminary Discussion:

Before diving into the development, I wanted to discuss this with you to gauge its feasibility and alignment with Sequelize's vision. I'm fully prepared to develop this PR, but I believe a preliminary discussion would be invaluable.

Your insights and feedback would be greatly appreciated. If this proposal aligns with Sequelize's direction, I'm eager to start working on it and contribute to the project.

Thank you for your time and consideration.

### Tasks
Dominant language
JavaScript
Stars
2.6k
Forks
524
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sequelize/cli

All issues in sequelize/cli

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.