Pluggability is an important tenet for Praxis. For this reason there are many different extensibility points that can be used:
before/after bootstrap stages (env, lib, app, etc.)
before/after/around request stages (load, validate....)
error handler (new)
middleware (new)
custom request class (partially-implemented)
new data types (through Attributor types), including custom doc generation
new JS templates to render custom types for the standard doc browser
configuration loading, validating, coercing and singleton storage
But in addition, we want to:
extend that pluggability into the of the design API.
plus package all of the typical pieces into a plugin "abstraction" so that making use of all these functions by third parties can be streamlined as much as possible, rather than having to manage many different hooks individually.
To that effect, we have developed a base plugin concept that can be easily extended to greatly enhance a Praxis app, in a controlled yet deep-code manner. The idea behind this Plugin "packaging" is to start bringing typical "plugins" into Praxis that many apps can easily start using and providing their right configuration (if necessary).
Examples of such plugins can be: Database adapters, ORMs, authentication modules, authorization modules, common loggers, you name it...
In particular, plugins can easily extend the hook points by:
Injecting custom DSL to resource and action definitions. i.e., for an authorization plugin you may want a "required_roles x, y, z..." syntax in your resource or action definitions. As a corollary, these plugins can also:
generate/enhance the corresponding custom API docs to reflect their additions. i.e., a new section in the JSON doc for the resource definition that describes the roles. Plus (in the near future)
even provide custom JS template snippets for the standard doc browser to show such things in the web-page when reviewing docs.
Inject custom methods to the request object, as a generic and thread-safe way to pass information throughout the request lifecycle. i.e., the authentication plugin might set the current_user value early in the request lifecycle, so that other plugins can use it later on.
Add before/after/around hooks to any or all of the existing controllers of the app, to perform whatever necessary actions. i.e., lookup and verify a user from a signed session, and set it to the "current_user" method of the request.
Currently planned plugins include:
authentication
authorization
ORM support, specifically sequel and praxis-mapper
statistics/notifications for both high-level metrics and fine-grained request details.
better logging
There’s preliminary versions of the documentation for the error handler, middleware support, and plugins in a up in a gist (https://gist.github.com/careo/e744484bdd0ba165b015) while the plugins are in progress.
I’d appreciate any suggestions, feedback, or whatever you want to throw at me. Specifically on any key use cases we’re totally missing, or something you think we’re doing that’s totally stupid.
-Dane
--
You received this message because you are subscribed to the Google Groups "praxis-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to praxis-developm...@googlegroups.com.
To post to this group, send email to praxis-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/praxis-development/CA%2B77RR8y795NR0YfBgrc89-rZ8oNWamtq-3_ASFzVTOswJ6ECA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.