0.0.40 • Published 5 years ago

sequelize-ts-boilerplate v0.0.40

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

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

0.0.40

5 years ago

0.0.39

5 years ago

0.0.37

5 years ago

0.0.36

5 years ago

0.0.35

5 years ago

0.0.34

5 years ago

0.0.33

5 years ago

0.0.32

5 years ago

0.0.31

5 years ago

0.0.3

5 years ago

0.0.26

5 years ago

0.0.25

5 years ago

0.0.24

5 years ago

0.0.23

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.19

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.1

5 years ago