How afnanlabs/afnkit-core works
Afnkit is a typed, Express-inspired HTTP framework built on Node.js HTTP. An application created through the public factory accepts middleware and method-specific routes, listens for requests, and dispatches each request through ordered middleware and matching route handlers to a response. Error handlers and terminal handling produce deliberate error responses. The graph focuses on the TypeScript implementation; the chapter directories are tutorial references, not runtime subsystems. Relationships reflect the sampled source and README; unsampled details are not expanded.
Main entry points: application.ts Application · router.ts Router · layer.ts Handler Layer · final-handler.ts Final Handler
Components 13
Application API
- express Factory
src/index.ts - Application
src/application/application.ts - Middleware Setup
src/middleware/init.ts
Request Dispatch
- Router
src/router/router.ts - Route Handlers
src/router/route.ts - Handler Layer
src/router/layer.ts
HTTP Extensions
- Request Extensions
src/request/request.ts - Response Helpers
src/response/response.ts
Error Handling
- Error Middleware
src/router/layer.ts - HttpError
src/errors/http-error.ts - Final Handler
src/errors/final-handler.ts
Other components
- Application Developer
- Node HTTP Server
Connections 17
- Application Developer → express Factory: creates app
README.md - express Factory → Application: creates
src/index.ts - Application Developer → Application: registers routes
README.md - Application → Router: registers and dispatches
src/application/application.ts - Application → Middleware Setup: installs
src/application/application.ts - Application → Request Extensions: extends prototype
src/application/application.ts - Application → Response Helpers: extends prototype
src/application/application.ts - Application → Node HTTP Server: creates server
src/application/application.ts - Node HTTP Server → Application: passes requests
src/application/application.ts - Router → Route Handlers: dispatches matching
src/router/router.ts - Router → Handler Layer: runs layers
src/router/router.ts - Route Handlers → Handler Layer: dispatches handlers
src/router/route.ts - Handler Layer → Error Middleware: runs error handlers
src/router/layer.ts - Router → Final Handler: finishes unmatched
src/router/router.ts - Router → HttpError: signals method mismatch
src/router/router.ts - Final Handler → HttpError: formats status
src/errors/final-handler.ts - Error Middleware → Final Handler: forwards errors