Skip to content

uforge/ts-library-template

 
 

Repository files navigation

Upgraded-Potato

a github random name (I liked)

Description

A starter-kit template for library development using Typescript & MikroOrm. It aim's to modularize development with web-server agnostic approach, that may not always fit as a best solution (eg: using framework methods), but allow complex db structures to be modularized and encapsulate modules logics like libraries composition.

Notes

The usage of the new optional parameter cause in the line below

throw new Error(`A Database connection must be specified`, { cause: { statusCode: 500 } })

is a voluntary choice to allow a "behind the scene" communication with the web-server in use.

It has been tested using fastify within the fastify.setErrorHandler method to properly set the statusCode of the http.request

Tools

Jest - EsLInt - Prettier - Webpack - Docker

Initial steps

npm i
vi .env.test # Working defaults with docker-compose
docker-compose up -d
npm run initdb
npm test

Configurations

MikroORM debug

  • edit the global variable in src/mikro-orm.config.ts
6: const DEBUG = true

TODOs

  • : Integrate webpack
  • : Complete prod/dev configurations
  • : Add rxjs API example
  • : Create extendable API base class
  • : Add redis-json examples
  • : Remove all WIP copy/paste
  • : Integrate TypeORM examples

About

A TS library template using MikroORM

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 95.1%
  • JavaScript 4.9%