Codiac Api Platform
TL;DR
A framework for building Typescript APIs on the NodeJs platform.
The Impetus
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.
COTN
OpenAPI
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.
Here's How
Features
IOC
- What are we going to use for this?
- Typescript-ioc https://www.npmjs.com/package/typescript-ioc
- InversifyJS http://inversify.io/
Security
- JWT authentication
- Role-based authorization
Class Mapping (via Automapper-ts)
Validation framework
Projections
- Supported at serialization, class mapping, and persistence layers.
HATEOAS support
- Conventional default projection by composition
- HAL protocol for references on properties by aggregation
Persistence
- Built in generic repo pattern with registry by entity type
- MongoDb repo
- Sql NHibernate repo
- Sql Dapper Orm repo
- EF repo?
Search Support
- EntityCriteria objects
- PropertyCriteria objects
Logging support
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
- Create Single
- Create Many
- Read
- 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
- Update Single
- Update Many
- Patch
- Patch Single
- Patch Where
- Delete
- Delete Single
- Delete Where
Coming soon...
Telemetry support
Event-driven integration model
- Extensible bus client
- Enterprise Event model
Default api contracts
(dynamic, matching endpoint's domain entity if not explicitly declared)
Documentation
Topics..