{"id":13761010,"url":"https://github.com/holidayextras/jsonapi-server","last_synced_at":"2025-05-15T19:09:02.237Z","repository":{"id":34504971,"uuid":"38445987","full_name":"holidayextras/jsonapi-server","owner":"holidayextras","description":"A config driven NodeJS framework implementing json:api and GraphQL","archived":false,"fork":false,"pushed_at":"2024-09-10T21:24:13.000Z","size":2082,"stargazers_count":488,"open_issues_count":95,"forks_count":113,"subscribers_count":91,"default_branch":"master","last_synced_at":"2025-05-14T17:54:42.491Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/holidayextras.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-07-02T17:08:27.000Z","updated_at":"2025-05-01T11:35:48.000Z","dependencies_parsed_at":"2024-11-20T22:48:08.886Z","dependency_job_id":"be248771-7c83-4caa-8ad7-b6d0c45ce064","html_url":"https://github.com/holidayextras/jsonapi-server","commit_stats":{"total_commits":428,"total_committers":31,"mean_commits":"13.806451612903226","dds":0.544392523364486,"last_synced_commit":"924db759157dd011e5bb5748a13229a42c3a61e6"},"previous_names":[],"tags_count":58,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holidayextras%2Fjsonapi-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holidayextras%2Fjsonapi-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holidayextras%2Fjsonapi-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holidayextras%2Fjsonapi-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/holidayextras","download_url":"https://codeload.github.com/holidayextras/jsonapi-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254404357,"owners_count":22065641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T13:01:31.946Z","updated_at":"2025-05-15T19:09:02.212Z","avatar_url":"https://github.com/holidayextras.png","language":"JavaScript","readme":"[![Build Status](https://travis-ci.org/holidayextras/jsonapi-server.svg?branch=master)](https://travis-ci.org/holidayextras/jsonapi-server)\n[![Coverage Status](https://coveralls.io/repos/github/holidayextras/jsonapi-server/badge.svg?branch=master)](https://coveralls.io/github/holidayextras/jsonapi-server?branch=master)\n[![npm version](https://badge.fury.io/js/jsonapi-server.svg)](http://badge.fury.io/js/jsonapi-server)\n[![Dependencies Status](https://david-dm.org/holidayextras/jsonapi-server.svg)](https://david-dm.org/holidayextras/jsonapi-server)\n\n# jsonapi-server\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/holidayextras/jsonapi-server.svg)](https://greenkeeper.io/)\n\nA config driven NodeJS framework implementing [`json:api`](http://jsonapi.org/) and [`GraphQL`](http://graphql.org/). You define the resources, it provides the api.\n\n### Motivation / Justification / Rationale\n\nThis framework solves the challenges of json:api and GraphQL without coupling us to any one ORM solution. Every other module out there is either tightly coupled to a database implementation, tracking an old version of the json:api spec, or is merely a helper library for a small feature. If you're building an API and your use case only involves reading and writing to a data store... well count yourself lucky. For everyone else, this framework provides the flexibility to provide a complex API without being confined to any one technology.\n\nA config driven approach to building an API enables:\n * Enforced json:api responses\n * Automatic GraphQL schema generation\n * Request validation\n * Payload validation\n * Automatic documentation generation\n * Automatic inclusions\n * Automatic routing\n * Automatic handling of relationships\n\nUltimately, the only things you as a user of this framework need to care about are:\n * What are my resources called\n * What properties do my resources have\n * For each resource, implement a `handler` for:\n   * `create`ing a resource\n   * `delete`ing a resource\n   * `search`ing for many resources\n   * `find`ing a specific resource\n   * `update`ing a specific resource\n\nWe've created `handler`s to automatically map our config over to database solutions help people get off the ground:\n * [jsonapi-store-memoryhandler](https://github.com/holidayextras/jsonapi-server/blob/master/lib/MemoryHandler.js) - an in-memory data store to enable rapid prototyping. This ships as a part of `jsonapi-server` and powers the core test suite.\n * [jsonapi-handler-chain](https://github.com/holidayextras/jsonapi-server/blob/master/lib/ChainHandler.js) - a handler to chain custom behaviour around an existing handler. This ships as a part of `jsonapi-server`. More info can be found [here](https://github.com/holidayextras/jsonapi-server/blob/master/documentation/chain-handler.md)\n * [jsonapi-store-relationaldb](https://github.com/holidayextras/jsonapi-store-relationaldb) - using `sequelize` to support PostgreSQL, MySQL, MSSQL, MariaDB and SQLite.\n * [jsonapi-store-mongodb](https://github.com/holidayextras/jsonapi-store-mongodb) - for MongoDB.\n * [jsonapi-store-elasticsearch](https://github.com/holidayextras/jsonapi-store-elasticsearch) - for Elasticsearch.\n * [jsonapi-store-dynamodb](https://github.com/holidayextras/jsonapi-server/compare/dynamodb?expand=1) - *!SIGNIFICANT WIP!* for AWS DynamoDB.\n\nWe've also written a library to ease the consumption of a json:api compliant service, if GraphQL isn't your thing:\n * [jsonapi-client](https://github.com/holidayextras/jsonapi-client) - for NodeJS and Browsers\n\n\n### Full documentation\n\n- [Suggested Project Structure](documentation/suggested-project-structure.md)\n- [Configuring jsonapi-server](documentation/configuring.md)\n- [Automatic Swagger Generation](documentation/swagger.md)\n- [Defining Resources](documentation/resources.md)\n- [Debugging](documentation/debugging.md)\n- [Foreign Key Relations](documentation/foreign-relations.md)\n- [Chaining handlers together](documentation/chain-handler.md)\n- [Custom Handlers](documentation/handlers.md)\n- [Post Processing Examples](documentation/post-processing.md)\n- [Migrating from an existing express server](documentation/api-migration.md)\n- [Application metrics](documentation/metrics.md)\n\n### The tl;dr\n\nYou can have a complete json:api server providing a `photos` resource with just this:\n```javascript\nvar jsonApi = require(\"jsonapi-server\");\n\njsonApi.setConfig({\n  port: 16006,\n  graphiql: true\n});\n\njsonApi.define({\n  resource: \"photos\",\n  handlers: new jsonApi.MemoryHandler(),\n  attributes: {\n    title: jsonApi.Joi.string(),\n    url: jsonApi.Joi.string().uri(),\n    height: jsonApi.Joi.number().min(1).max(10000).precision(0),\n    width: jsonApi.Joi.number().min(1).max(10000).precision(0)\n  }\n});\n\njsonApi.start();\n```\nYour new API will be alive at `http://localhost:16006/` and your `photos` resources will be at `http://localhost:16006/photos`. The GraphiQL interface will be available at `http://localhost:16006/`.\n\n### Show me a full example!\n\nFire up an example `json:api` server using the resources mentioned in the official spec via:\n```\n$ git clone https://github.com/holidayextras/jsonapi-server.git\n$ npm install\n$ npm start\n```\nthen browse to the JSON:API endpoints:\n```\nhttp://localhost:16006/rest/photos\n```\nor, for GraphQL:\n```\nhttp://localhost:16006/rest/\n```\nthe example implementation can be found [here](example)\n","funding_links":[],"categories":["JavaScript","📦 Legacy \u0026 Inactive Projects"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholidayextras%2Fjsonapi-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fholidayextras%2Fjsonapi-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholidayextras%2Fjsonapi-server/lists"}