{"id":22799990,"url":"https://github.com/dadi/api","last_synced_at":"2025-04-05T03:03:09.732Z","repository":{"id":48634114,"uuid":"48236666","full_name":"dadi/api","owner":"dadi","description":"A high-performance RESTful API layer designed in support of API-first development and COPE. Connects your content to the world","archived":false,"fork":false,"pushed_at":"2024-08-07T13:09:14.000Z","size":11861,"stargazers_count":181,"open_issues_count":40,"forks_count":27,"subscribers_count":27,"default_branch":"develop","last_synced_at":"2025-03-29T02:02:34.703Z","etag":null,"topics":["api","cms","dadi","dadi-api","headless"],"latest_commit_sha":null,"homepage":"https://dadi.cloud/en/api/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dadi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-12-18T13:25:14.000Z","updated_at":"2025-03-18T17:04:32.000Z","dependencies_parsed_at":"2024-06-18T20:10:47.730Z","dependency_job_id":"0b644013-1fc6-4e73-9179-8bacddb9abd2","html_url":"https://github.com/dadi/api","commit_stats":{"total_commits":1868,"total_committers":32,"mean_commits":58.375,"dds":0.4919700214132763,"last_synced_commit":"7f1f407ae0e82b85fb7cf776ace5d05d59b3813d"},"previous_names":[],"tags_count":141,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dadi","download_url":"https://codeload.github.com/dadi/api/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246598200,"owners_count":20802975,"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":["api","cms","dadi","dadi-api","headless"],"created_at":"2024-12-12T07:10:43.389Z","updated_at":"2025-04-05T03:03:09.706Z","avatar_url":"https://github.com/dadi.png","language":"JavaScript","readme":"\u003cimg src=\"https://dadi.cloud/assets/products/dadi-api-full.png\" alt=\"DADI API\" height=\"65\"/\u003e\n\n[![npm (scoped)](https://img.shields.io/npm/v/@dadi/api.svg?maxAge=10800\u0026style=flat-square)](https://www.npmjs.com/package/@dadi/api)\n[![coverage](https://img.shields.io/badge/coverage-89%25-yellow.svg?style=flat)](https://github.com/dadi/api)\n[![Build Status](https://travis-ci.org/dadi/api.svg?branch=master)](https://travis-ci.org/dadi/api)\n[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/)\n\n## DADI API\n\n- [Overview](#overview)\n- [Requirements](#requirements)\n- [Your First API Project](#your-first-api-project)\n- [Links](#links)\n\n## Overview\n\nDADI API is built on Node.JS. It is a high performance RESTful API layer designed in support of API-first development and the principle of COPE. It can use virtually any database engine, such as [MongoDB](https://github.com/dadi/api-mongodb), [CouchDB](https://github.com/dadi/api-couchdb), [RethinkDB](https://github.com/dadi/api-rethinkdb) or simply a [JSON filestore](https://github.com/dadi/api-filestore).\n\nYou can consider it as the data layer within a platform (including the data model). It is designed to be plugged into a templating layer (such as [DADI Web](https://dadi.cloud/en/web)), a mobile application or to be used with any other data consumer.\n\nCalls to a DADI API can contain your business/domain logic (the part of a platform that encodes the real-world business rules that determine how data is created, displayed, stored and changed). It has full support for searching, filtering, limiting, sorting, offsetting, input validation and data aggregation (through support for MongoDB's aggregation pipeline).\n\nIt has built-in support for oAuth2, includes full collection-level ACL, can connect to multiple databases out of the box, provides native document versioning at collection level, supports static endpoints, includes automatic indexing, has a caching layer and can be run in a clustered configuration.\n\nDADI API provides a starting point that's further advanced than a framework. It allows you to get a complete data layer up and running in minutes.\n\nIt is part of DADI, a suite of components covering the full development stack, built for performance and scale.\n\n## Requirements\n\n- **[Node.js](https://www.nodejs.org/)** (supported versions: 6.11.x, 8.9.x)\n- A [data connector module](https://www.npmjs.com/search?q=keywords:dadi-api-connector)\n\n## Your first API project\n\n### Install API\n\nThe quickest way to get started with _API_ is to use [DADI CLI](https://github.com/dadi/cli). See [Creating an API](https://docs.dadi.cloud/api#creating-an-api) for full installation details.\n\n### Configuration\n\nAPI starts with some sensible defaults, so it's not necessary to understand all the configuration options available when first running the application.\n\nConfiguration is handled using JSON files specific to the application environment. For example in the production environment a file named `config.production.json` will be used. Configuration files must be placed in a `config` folder in your application root, for example `config/config.production.json`. The default start up environment is `development`, using the configuration file at `config/config.development.json`.\n\nThe bare minimum required for running the API is a `server` block. With only a `server` block, default values are used for all other properties.\n\n**Sample configuration**\n\n```json\n{\n  \"server\": {\n    \"host\": \"127.0.0.1\",\n    \"port\": 3000\n  }\n}\n```\n\n### Start the server\n\nAPI can be started from the command line simply by issuing the following command:\n\n```bash\n$ npm start\n```\n\n#### Test the connection\n\nWith the default configuration, our API server is available at http://localhost:3000. If you've modified the configuration file's `server` block, your API will be available at the address and port you've chosen. Use cURL to check the server is running, if the connection can be made you will receive the following \"Unauthorised\" message.\n\n```bash\n$ curl http://localhost:3000\n```\n\n```json\n{\"statusCode\": 401}\n```\n\n#### Check the response headers\n\n```bash\n$ curl -I http://localhost:3000\n```\n\n```json\nHTTP/1.1 401 Unauthorized\ncontent-type: application/json\ncontent-length: 18\nDate: Thu, 20 Apr 2017 23:42:25 GMT\nConnection: keep-alive\n```\n\n### Authentication\n\nThe HTTP 401 response received in the previous step shows that the server is running. To start using the REST endpoints you'll need a user account so you can obtain access tokens for interacting with the API.\n\nUser accounts provide an authentication layer for API. Each user account has a _**clientId**_ and a _**secret**_. These are used to obtain access tokens for interacting with the API. See the [Authentication](https://docs.dadi.cloud/api#authentication) section of the API documentation for full details.\n\n#### Creating the first user\n\n[CLI](https://github.com/dadi/api) contains an interactive \"Client Record Generator\" to help you create user accounts. Run the following command in the directory where you installed _API_:\n\n```bash\ncd my-new-api\ndadi api clients:add\n```\n\nIf you need to create user accounts in other environments (for example following a deployment to a live server), add the environment to the following command:\n\n```bash\n$ NODE_ENV=production npm explore @dadi/api -- npm run create-client\n```\n\n### Run API as a service\n\nTo run your API application in the background as a service, install Forever and Forever Service:\n\n```bash\n$ npm install forever forever-service -g\n\n$ sudo forever-service install -s index.js -e \"NODE_ENV=production\" api --start\n```\n\nYou can now interact with the `api` service using the following commands:\n\n```bash\n$ [sudo] service api start\n$ [sudo] service api stop\n$ [sudo] service api status\n$ [sudo] service api restart\n```\n\n\u003e Note: the environment variable `NODE_ENV=production` must be set to the required configuration version matching the configuration files available in the `config` directory.\n\n## Tests\n\nTo run the tests after cloning the repository, run the following command:\n\n```\n$ npm test\n```\n\n\u003e NOTE: API installs version 4.0.1 of Mocha and uses this when calling `npm test`. If you have Mocha installed globally and want to simply run `mocha`, if using version 4 or above, add `--exit` to the command so it becomes `mocha --exit`\n\n## Links\n\n- [API Documentation](https://docs.dadi.cloud/api/)\n\n## Contributors\n\nDADI API is based on an original idea by Joseph Denne. It is developed and maintained by the engineering team at DADI ([https://dadi.cloud](https://dadi.cloud))\n\n- Adam K Dean \u003cakd@dadi.co\u003e\n- Arthur Mingard \u003cam@dadi.co\u003e\n- David Longworth \u003cdl@dadi.co\u003e\n- Eduardo Bouças \u003ceb@dadi.co\u003e\n- Francesco Iannuzzelli \u003cfi@dadi.co\u003e\n- James Lambie \u003cjl@dadi.co\u003e\n- Joe Wagner\n- Joseph Denne \u003cjd@dadi.co\u003e\n- Kevin Sowers \u003ckevin.sowers223@gmail.com\u003e\n- Robert Stanford \u003crs@dadi.co\u003e\n- Viktor Fero \u003cvf@dadi.co\u003e\n\n## Licence\n\nDADI is a data centric development and delivery stack, built specifically in support of the principles of API first and COPE.\n\nCopyright notice\u003cbr /\u003e\n(C) 2018 DADI+ Limited \u003csupport@dadi.cloud\u003e\u003cbr /\u003e\nAll rights reserved\n\nThis product is part of DADI.\u003cbr /\u003e\nDADI is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version (\"the GPL\").\n\n**If you wish to use DADI outside the scope of the GPL, please\ncontact us at info@dadi.co for details of alternative licence\narrangements.**\n\n**This product may be distributed alongside other components\navailable under different licences (which may not be GPL). See\nthose components themselves, or the documentation accompanying\nthem, to determine what licences are applicable.**\n\nDADI is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nThe GNU General Public License (GPL) is available at\nhttp://www.gnu.org/licenses/gpl-3.0.en.html.\u003cbr /\u003e\nA copy can be found in the file GPL.md distributed with\nthese files.\n\nThis copyright notice MUST APPEAR in all copies of the product!\n","funding_links":[],"categories":["📦 Legacy \u0026 Inactive Projects"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdadi%2Fapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdadi%2Fapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdadi%2Fapi/lists"}