Codiac Api Platform
A framework for building Typescript APIs on the NodeJs platform.
I need a fast, easy to manage, scalable, extensible, container-ready API platform that isnt going to chew up all my time implementing things that arent unique. And brought a versatile Object Oriented patterned approach to the Typescript/node stack.
Domain Driven Design
Extensible: Injectable and configurable, with multiple layers at which to modify behaviors, from tweak a config setting, to overriding existing behaviors, to injecting a custom library, to wholesale custom coding an entire endpoint.
Intuitive: BDFD, fluent, extensible, common practices
Lazy: (aka: efficient, productive) Smart defaults allow COTN (Code Only The Nuance) development.
Testable: Full decoupling and extensibility. Endpoint definitions are not dependent on the platform and can therefore be instantiated, mocked, and executed without an http request. Validation constraints, repos, loggers, and class mappers can be run out of the context of an endpoint, all with mocked dependencies.
- What are we going to use for this?
- Typescript-ioc https://www.npmjs.com/package/typescript-ioc
- InversifyJS http://inversify.io/
- JWT authentication
- Role-based authorization
Class Mapping (via Automapper-ts)
- Supported at serialization, class mapping, and persistence layers.
- Conventional default projection by composition
- HAL protocol for references on properties by aggregation
- Built in generic repo pattern with registry by entity type
- MongoDb repo
- Sql NHibernate repo
- Sql Dapper Orm repo
- EF repo?
- EntityCriteria objects
- PropertyCriteria objects
Extensible Pipeline Pattern
Bootstrap in your own custom request handling plugins
Conventional CRUD Endpoints
This is essentially a plugin
Include Route convention, response codes, request contract, response envelope.
- Create Single
- Create Many
- Read one by Id (ie: spec for one)
- Read by Criteria (provide optimized "count", aka: include ability to specify meta only - no output)
- Exists by Id (ie: spec for one)
- Exists by Criteria
- Update Single
- Update Many
- Patch Single
- Patch Where
- Delete Single
- Delete Where
Event-driven integration model
- Extensible bus client
- Enterprise Event model
Default api contracts
(dynamic, matching endpoint's domain entity if not explicitly declared)