Skip to content

Latest commit

 

History

History
99 lines (69 loc) · 3.96 KB

README.md

File metadata and controls

99 lines (69 loc) · 3.96 KB


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