🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

sequelize-ts-boilerplate

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sequelize-ts-boilerplate

A REST API scaffolding tool designed to scale and easily generate CRUD endpoints based on database schema design

0.0.40
latest
npm
Version published
Weekly downloads
40
29.03%
Maintainers
1
Weekly downloads
 
Created
Source

sequelize-ts-boilerplate

A REST API / Data-Access-Layer scaffolding tool designed to scale and easily generate CRUD endpoints based on database schema. npm install -g sequelize-ts-boilerplate

sequelize-ts-boilerplate your-config.json

JSON configuration file your-config.json will default to config.json if not present as arg.

npm install --> tsc --> npm run dev

If you are looking for an enterprise framework, nest is highly recommended. Angular and Java Spring developers will feel at home. This tool is specifically designed to scaffold a routes -> controllers -> services -> daos project architecture using Sequelize, Typescript, and Sequelize-Typescript ORM while trying to maintain a Node.js feel.

Implementation

config.json file:

{
   "ENV": "dev",  // make name of ENV a property in DATABASE_CONNECTION_SETTINGS
   "DATABASE_CONNECTION_SETINGS": {
       "dev": {
           "host": "your-host-url",
           "db": "your-db-name",
           "username": "your-username",
           "password": "your-password",
           "dialect": "mysql | mssql",
           "port": "3306"    
       }
   },
   "ORM_GENERATE": {
       "caseSensitiveProps": [],
       "skipTables": [],
       "manyToManyIdentifiers": ["map"],
       "lookup": {   // creates transient properties for CONSTANT | ENUM style table
           "tableName": "Lookup",
           "identifier": "lkp",
           "sliceOut": "Oid"
       },
       "pkIdentifier": "id",
       "path": {
           "ormWrapper": "optional/path/to/generated/orm/wrapper/file.ts",
           "daos": "optional/path/to/generated/daos/folder",
           "services": "optional/path/to/generated/services/folder",
           "interface": "optional/path/to/generated/interface/file.ts"
       }
   },
   "CRUD_GENERATE": {
       "shouldGenerate": true,
       "framework": "express",
       "ignoreTables": []
   }
}

Folders generated:

  • Controllers
  • Services
  • DAOS

Files generated:

  • all Node framework plumbing
  • interfaces file containing all database entities (for use on front-end)
  • ORM wrapper (provides namespace, intellisense, etc for accessing DAOS)
  • Controller and Service files will not be overwritten on subsequent generations. DAOS will be regenerated every time.

TODO

  • Better docs and readme!
  • Support other Node.js frameworks - Hapi, Koa, etc. (currently only Express)
  • Support other SQL dialects (currently, the data-access layer only supports SQL Server and MySQL)
  • Various opt-in packages - i.e Auth, ACL, more complex CRUD endpoints, better support handling complex data table relationships (many:many), etc
  • CLI tool
  • Better package.json generation

A quick note: this was made quickly and without tests. I am happy to continue contributing and fixing issues, however, I enjoy doing things other than coding in my free time as well :)... contributions welcome.

Github: https://github.com/dlemburg/sequelize-ts-boilerplate

Keywords

node

FAQs

Package last updated on 11 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts