All Projects → kurierjs → kurier

kurierjs / kurier

Licence: MIT license
TypeScript framework to create JSON:API compliant APIs

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to kurier

tsed
📐 Ts.ED is a Node.js and TypeScript framework on top of Express to write your application with TypeScript (or ES6). It provides a lot of decorators and guideline to make your code more readable and less error-prone.
Stars: ✭ 2,350 (+7733.33%)
Mutual labels:  koa, typescript-framework
Tsed
📐 Ts.ED is a Node.js and TypeScript framework on top of Express to write your application with TypeScript (or ES6). It provides a lot of decorators and guideline to make your code more readable and less error-prone.
Stars: ✭ 1,941 (+6370%)
Mutual labels:  koa, typescript-framework
ejyy
「e家宜业」是一整套开源智慧物业解决方案,基于nodejs、typescript、koa、vue开发,包含web中台、业主小程序、员工小程序、公众号、物联网应用等,涵盖业主服务、物业运营、智能物联、数据统计等主要业务。
Stars: ✭ 561 (+1770%)
Mutual labels:  koa, knex
back-boilerplate
A boilerplate for building RESTful APIs using Node.js, PostgreSQL, koa, knex, bookshelf.
Stars: ✭ 33 (+10%)
Mutual labels:  koa, knex
koa2-rest-scaffold
Koa2 RESTful API 脚手架。
Stars: ✭ 27 (-10%)
Mutual labels:  koa
varie
A Typescript Framework For VueJS
Stars: ✭ 23 (-23.33%)
Mutual labels:  typescript-framework
ember-custom-actions
Custom API actions for Ember applications
Stars: ✭ 73 (+143.33%)
Mutual labels:  jsonapi
react-koa-universal
a boilerplate react graphql apollo css-in-js buzzword koa ssr pwa wasm throwaway app 🚮
Stars: ✭ 12 (-60%)
Mutual labels:  koa
bookshelf-json-columns
Parse JSON columns with Bookshelf.js
Stars: ✭ 64 (+113.33%)
Mutual labels:  knex
php-json-schema-model-generator
Creates (immutable) PHP model classes from JSON-Schema files including all validation rules as PHP code
Stars: ✭ 36 (+20%)
Mutual labels:  jsonapi
restria
Entria's REST API boilerplate
Stars: ✭ 25 (-16.67%)
Mutual labels:  koa
knex-tiny-logger
Zero config queries logger for knex
Stars: ✭ 24 (-20%)
Mutual labels:  knex
node-input-validator
Validation library for node.js
Stars: ✭ 74 (+146.67%)
Mutual labels:  koa
inversify-koa-utils
inversify-koa-utils is a module based on inversify-express-utils. This module has utilities for koa 2 applications development using decorators and IoC Dependency Injection (with inversify)
Stars: ✭ 27 (-10%)
Mutual labels:  koa
thinkorm
A flexible, lightweight and powerful Object-Relational Mapper for Node.js. Support TypeScript!!
Stars: ✭ 33 (+10%)
Mutual labels:  knex
laravel5-hal-json
Laravel 5 HAL+JSON API Transformer Package
Stars: ✭ 15 (-50%)
Mutual labels:  jsonapi
Movie-Paradise
A responsive movie preview web app
Stars: ✭ 19 (-36.67%)
Mutual labels:  koa
json-api-serializer
Node.js/browser framework agnostic JSON API (http://jsonapi.org/) serializer.
Stars: ✭ 141 (+370%)
Mutual labels:  jsonapi
Smart-courier-cabinet
智能快递柜小程序+nodejs koa2后端
Stars: ✭ 21 (-30%)
Mutual labels:  koa
coolliyong.github.io
javascript基础
Stars: ✭ 57 (+90%)
Mutual labels:  koa

Kurier

A TypeScript framework to create APIs following the 1.1 Spec of JSONAPI + the Operations proposal spec.

Features

  • Operation-driven API: JSONAPI is transport-layer independent, so it can be used for HTTP, WebSockets or any transport protocol of your choice.
  • Declarative style for resource definition: Every queryable object in JSONAPI is a resource, a representation of data that may come from any source, be it a database, an external API, etc. Kurier defines these resources in a declarative style.
  • CRUD database operations: Baked into Kurier, there is an operation processor which takes care of basic CRUD actions by using Knex. This allows the framework to support any database engine compatible with Knex. Also includes support for filtering fields by using common SQL operators, sorting and pagination.
  • Transport layer integrations: The framework supports JSONAPI operations via WebSockets, and it includes middlewares for Koa, Express and Vercel to automatically add HTTP endpoints for each declared resource and processor.
  • Relationships and sideloading: Resources can be related with belongsTo / hasMany helpers on their declarations. Kurier provides proper, compliant serialization to connect resources and even serve them all together on a single response.
  • Error handling: The framework includes some basic error responses to handle cases equivalent to HTTP status codes 401 (Unauthorized), 403 (Forbidden), 404 (Not Found) and 500 (Internal Server Error).
  • User/Role presence authorization: By building on top of the decorators syntax, Kurier allows you to inject user detection on specific operations or whole processors. The framework uses JSON Web Tokens as a way of verifying if a user is valid for a given operation.
  • Extensibility: Both resources and processors are open classes that you can extend to suit your use case. For example, do you need to serialize an existing, external API into JSONAPI format? Create a MyExternalApiProcessor extending from OperationProcessor and implement the necessary calls et voilà!.

Getting started

One-click way

Click right here to get started with TypeScript, a dockerized database, basic user management support, HTTP logs and more.

The second quickest possible way

Create your project using the GitHub CLI and with one of our starter packs:

# Create a TypeScript + Kurier API.
npx gh repo create my-api-with-kurier -p kurierjs/kurier-starter-pack-typescript

# Create a JavaScript + Kurier API.
npx gh repo create my-api-with-kurier -p kurierjs/kurier-starter-pack-javascript

The DIY way

Note: This example assumes a TypeScript environment with several dependencies preinstalled.

  1. Install the package with npm or yarn:

    $ npm run add kurier
  2. Create a Resource:

    import { Resource } from "kurier";
    
    export default class Author extends Resource {
      static schema = {
        attributes: {
          firstName: String,
          lastName: String,
        },
      };
    }
  3. Create an Application and inject it into your server. For example, let's say you've installed Koa in your Node application and want to expose JSONAPI via HTTP:

    import { Application, jsonApiKoa, KnexProcessor } from "kurier";
    import Koa from "koa";
    import Author from "./author";
    
    const app = new Application({
      namespace: "api",
      types: [Author],
      defaultProcessor: new KnexProcessor(/* your knex DB connection settings */)
    });
    
    const api = new Koa();
    
    api.use(jsonApiKoa(app));
    
    api.listen(3000);
  4. Run the Node app, open a browser and navigate to http://localhost:3000/api/authors. You should get an empty response like this:

    {
      "data": [],
      "included": []
    }
  5. Add some data to the "authors" table and go back to the previous URL. You'll start seeing your data!

    {
      "data": [
        {
          "id": 1,
          "type": "author",
          "attributes": {
            "firstName": "John",
            "lastName": "Katzenbach"
          }
        }
      ],
      "included": []
    }

Addons

Extend Kurier's features with these addons:

Starter packs

Jump-start your project with these preconfigured, opinionated starter packs. They all include a dockerized database, HTTP logs, linting and basic user management.

Documentation

Check out our updated docs at ReadTheDocs. There you will find more info and examples.

Contributing

We have a little contributors guide now! Take a look at it in here.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].