mxchinegod / digits-api-main

digits-api-main is the authentication, preprocessing, and tertiary API bridge in the Digits service mesh.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


digits-api-main is the authentication, preprocessing, and tertiary API bridge in the Digits service mesh.


๐Ÿ“ Code Properties โœจ start with why contributions welcome HitCount License: CC BY-NC 4.0

The below stack is minimal but also differentiates the main API from the rest of Digits services
๐Ÿ“ Library โš™ Purpose ๐Ÿ“Ž Version
NodeJS Base 16.18.0
express-jwt Authentication Middleware 7.7.7
mongoose DB Client 6.7.0
express Session Middleware 4.18.2
You will want to know about each of these in depth by the above order.

๐ŸŽฌ Environment โœจ

config.js should be created from config.example.js
  • apiHost is an array with services you can and should add to.
  • Secret is the secret which is used to encrypt all user sessions into tokens.
  • EXPIRES is the valid session length, if passed users will need to reauthenticate.
  • dbUrl is your mongo instance, including protocol and port. You should only need to adjust host in most situations.
The API will crash and behave unexpectedly without a valid mongoose connection.

npm i

๐Ÿ“œ Provided Scripts โœจ

Digits AI provides some useful scripts to help you quick start.
Scripts provided in package.json. It's safe to modify or add additional scripts, but here are the defaults:

๐Ÿ’ก start

npm start

๐Ÿฐ Service Mesh API โœจ

digits-api-main is responsible for a lot, but the API model is simple.
  • ๐Ÿ” Authentication/Sessions [ express/express-jwt ]
    • Authentication occurs RESTfully with jwt tokens. There is a secret
  • ๐Ÿ”Œ Interfacing [ http ]
    • All API routing is done through http requests. It's possible sockets play a role one day.
  • ๐Ÿฉบ Monitoring [ http ]
    • This API intrinsically reports to DigitsUI, but it also reports the health of other APIs. This contextualizes digits-api-main's role succintly.
  • ๐Ÿ—„ DB [ mongoose ]
    • All models are highly fluid and will accept most JSON as valid. This is by design as features are evaluated. Field validation will occur at a later date.
  • ๐Ÿงฎ Preprocessing [ node ]
    • While not all data can/should be preprocessed by digits-api-main, a lot is. That puts it realistically in the role of a preprocessor. While all nodes technically work with dataframes and such, a lot of the focus in downstream responses ends up being data.

๐Ÿ’Ž Goals โœจ

immediate
  • Initialize beautiful README.md
  • Describe service API role
  • Add husky pre-commit
  • Create mesh diagram
  • Explain preprocessor philosophy
  • Clean up quota logic, make it middleware
long-term
  • Create Stripe customer API
  • Docker images
  • Kubernetes deployment

๐Ÿ™‹ Contribution

Proper commit message format is required for automated changelog generation. Examples:
[<emoji>] [revert: ?]<type>[(scope)?]: <message>

๐Ÿ’ฅ feat(compiler): add 'comments' option
๐Ÿ› fix(compiler): fix some bug
๐Ÿ“ docs(compiler): add some docs
๐ŸŒท UI(compiler): better styles
๐Ÿฐ chore(compiler): Made some changes to the scaffolding
๐ŸŒ locale(compiler): Made a small contribution to internationalization

Other commit types: refactor, perf, workflow, build, CI, typos, tests, types, wip, release, dep

About

digits-api-main is the authentication, preprocessing, and tertiary API bridge in the Digits service mesh.


Languages

Language:JavaScript 98.3%Language:Dockerfile 1.7%