{"id":13534703,"url":"https://github.com/dadi/cdn","last_synced_at":"2025-05-15T18:07:19.234Z","repository":{"id":56578187,"uuid":"42431613","full_name":"dadi/cdn","owner":"dadi","description":"CDN is a Just-in-time asset manipulation and delivery application, providing a complete content distribution/delivery solution","archived":false,"fork":false,"pushed_at":"2024-11-20T10:33:57.000Z","size":55833,"stargazers_count":218,"open_issues_count":33,"forks_count":43,"subscribers_count":19,"default_branch":"develop","last_synced_at":"2025-04-11T23:14:39.756Z","etag":null,"topics":["asset-manipulation","cdn","dadi","dadi-cdn","image-manipulation"],"latest_commit_sha":null,"homepage":"https://dadi.cloud/en/cdn","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":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-14T06:40:43.000Z","updated_at":"2025-03-03T04:58:40.000Z","dependencies_parsed_at":"2024-12-12T07:10:54.808Z","dependency_job_id":"785a5e70-469a-4ef0-a3c7-2c52366673c6","html_url":"https://github.com/dadi/cdn","commit_stats":{"total_commits":1193,"total_committers":24,"mean_commits":"49.708333333333336","dds":0.4761106454316848,"last_synced_commit":"cfe6d91305bbbc8bbb32619e3e7489a11046a224"},"previous_names":[],"tags_count":84,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fcdn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fcdn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fcdn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fcdn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dadi","download_url":"https://codeload.github.com/dadi/cdn/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248492884,"owners_count":21113163,"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":["asset-manipulation","cdn","dadi","dadi-cdn","image-manipulation"],"created_at":"2024-08-01T08:00:36.616Z","updated_at":"2025-04-11T23:14:47.204Z","avatar_url":"https://github.com/dadi.png","language":"JavaScript","funding_links":[],"categories":["CDN Integration Plugins"],"sub_categories":[],"readme":"\u003cimg src=\"https://dadi.cloud/assets/products/dadi-cdn-full.png\" alt=\"DADI CDN\" height=\"65\"/\u003e\n\n[![npm (scoped)](https://img.shields.io/npm/v/@dadi/cdn.svg?maxAge=10800\u0026style=flat-square)](https://www.npmjs.com/package/@dadi/cdn)\n[![Coverage Status](https://coveralls.io/repos/github/dadi/cdn/badge.svg?branch=develop)](https://coveralls.io/github/dadi/cdn?branch=develop)\n[![Build Status](https://travis-ci.org/dadi/cdn.svg?branch=master)](https://travis-ci.org/dadi/cdn)\n\n## DADI CDN\n\n- [Overview](#overview)\n- [Requirements](#requirements)\n- [Your First CDN Project](#your-first-cdn-project)\n- [Links](#links)\n\n## Overview\n\nDADI CDN is built on Node.JS, with support for S3 and Redis. It is a high performance, just-in-time asset manipulation and delivery layer designed as a modern content distribution solution.\n\nYou can consider a full installation of DADI CDN as being analogous to a traditional CDN (Content Distribution Network) such as Akamai or Limelight. It is designed to carry the processing and delivery load associated with image manipulation and asset delivery (CSS/JS/fonts). It acts autonomously as a layer on top of your core product.\n\nIt has full support for caching, header control, image manipulation, image compression and image format conversion; image recipes allow for SEO-friendly URLs; dynamic routing allows for media manipulation based on what is known about an individual; and an authenticated API allows for fine grained cache control in the form of content invalidation on an individual file or collective path basis.\n\nCDN 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.9.2, 6.11.1, 8.9.4)\n\n## Your first CDN project\n\n### Install dependencies\n\nEnsure you have the required dependencies installed. See the first sections in the CDN [installation](https://docs.dadi.cloud/cdn) documentation.\n\n### Install CDN\n\nAll DADI platform microservices are available from [NPM](https://www.npmjs.com/). To add _CDN_ to your project as a dependency:\n\n```bash\n$ cd my-app\n$ npm install --save @dadi/cdn\n```\n\n### Add an entry point\n\nYou'll need an entry point for your project. We'll create a file called `index.js` and later we will start the application with `node index.js`. Add the following to the new file:\n\n```js\n/**\n *  index.js\n */\nconst app = require('@dadi/cdn')\n```\n\n### Start the server\n\nCDN can be started from the command line simply by issuing the following command:\n\n```bash\n$ node index.js\n```\n\nWith the default configuration, our CDN server is available at http://localhost:8001. Visiting this URL will display a welcome message.\n\n### Configuration\n\nCDN requires a configuration file specific to the application environment. For example in the production environment it will look for a file named `config.production.json`.\n\nWhen CDN was installed, a development configuration file was created for you in a `config` folder at your application root. Full configuration documentation can be found at https://docs.dadi.cloud/cdn.\n\n### Run CDN as a service\n\nTo run your CDN application in the background as a service, install Forever and Forever Service:\n\n```bash\n$ npm install forever forever-service -g\n\n$ forever-service install -s index.js -e NODE_ENV=production cdn --start\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### Configuring an image source\n\nBefore you can serve assets or images you need to tell CDN where your files are located. Currently, CDN can serve your files from three types of source: [Amazon S3](https://docs.dadi.cloud/cdn/#amazon-s3), [a remote server](https://docs.dadi.cloud/cdn/#remote-server), and the [the local filesystem](https://docs.dadi.cloud/cdn/#local-filesystem). We'll start using the local filesystem, but see the [full documentation](https://docs.dadi.cloud/cdn/#defining-sources) for details on using the other source types.\n\nThe sample configuration file defines a local filesystem source. The `path` property is set to use an directory called `images` at the root of your application. CDN will look for your files at the location defined in this `path` property every time it handles a request.\n\n#### Example\n\n```json\n{\n  \"server\": {\n    \"host\": \"127.0.0.1\",\n    \"port\": 8001\n  },\n  \"images\": {\n    \"directory\": {\n      \"enabled\": true,\n      \"path\": \"./images\"\n    }\n  }\n}\n```\n\nWe'll use the above configuration for an example. With image files in the `images` directory we can make a request for one to view it in the browser:\n\n##### Images available\n\n```bash\n$ my-app/images  ls -la\ntotal 9464\ndrwxr-xr-x  4 root  wheel      136 13 Mar 13:02 .\ndrwxr-xr-x  4 root  wheel      136 13 Mar 13:01 ..\n-rw-r--r--  1 root  wheel     9396 13 Mar 13:02 92875.jpg\n-rw-r--r--  1 root  wheel  4832710 13 Mar 13:02 92876.jpg\n```\n\n##### Browser request\n\nhttp://127.0.0.1:8001/92875.jpg\n\n## Links\n\n- [CDN Documentation](https://docs.dadi.cloud/cdn)\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) 2019 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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdadi%2Fcdn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdadi%2Fcdn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdadi%2Fcdn/lists"}