{"id":19020224,"url":"https://github.com/trailsjs/trailpack","last_synced_at":"2026-03-07T20:32:07.713Z","repository":{"id":57378807,"uuid":"46699371","full_name":"trailsjs/trailpack","owner":"trailsjs","description":":package: Trailpack Module. All Trailpacks include and inherit this module.","archived":false,"fork":false,"pushed_at":"2018-02-19T20:03:22.000Z","size":177,"stargazers_count":17,"open_issues_count":4,"forks_count":6,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-10-23T03:53:07.235Z","etag":null,"topics":["trailpack","trails"],"latest_commit_sha":null,"homepage":"","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/trailsjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-23T05:48:16.000Z","updated_at":"2023-11-03T17:12:03.000Z","dependencies_parsed_at":"2022-09-02T21:21:03.320Z","dependency_job_id":null,"html_url":"https://github.com/trailsjs/trailpack","commit_stats":null,"previous_names":[],"tags_count":56,"template":false,"template_full_name":null,"purl":"pkg:github/trailsjs/trailpack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailsjs%2Ftrailpack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailsjs%2Ftrailpack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailsjs%2Ftrailpack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailsjs%2Ftrailpack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trailsjs","download_url":"https://codeload.github.com/trailsjs/trailpack/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailsjs%2Ftrailpack/sbom","scorecard":{"id":896660,"data":{"date":"2025-08-11","repo":{"name":"github.com/trailsjs/trailpack","commit":"6f3a3358f563b2db29ee1db968c67d1dd0288e97"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.1,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":1,"reason":"Found 2/12 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 20 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-24T13:58:12.285Z","repository_id":57378807,"created_at":"2025-08-24T13:58:12.285Z","updated_at":"2025-08-24T13:58:12.285Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30229744,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T19:01:10.287Z","status":"ssl_error","status_checked_at":"2026-03-07T18:59:58.103Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["trailpack","trails"],"created_at":"2024-11-08T20:16:11.591Z","updated_at":"2026-03-07T20:32:07.692Z","avatar_url":"https://github.com/trailsjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# trailpack\n\n[![Gitter][gitter-image]][gitter-url]\n[![NPM version][npm-image]][npm-url]\n[![Build status][ci-image]][ci-url]\n[![Dependency Status][daviddm-image]][daviddm-url]\n[![Code Climate][codeclimate-image]][codeclimate-url]\n[![Follow @trailsjs on Twitter][twitter-image]][twitter-url]\n\nTrailpack Interface. Trailpacks extend the capability of the Trails\nframework. (**Application functionality** should be extended using\nServices).\n\n## Usage\n\nThis class should be extended by all trailpacks. Override the trailpack API\nmethods.\n\n```js\nconst Trailpack = require('trailpack')\n\nclass ExampleTrailpack extends Trailpack {\n\n  /**\n   * Configure the lifecycle of this trailpacks.\n   */\n  get lifecycle () {\n    return {\n      initialize: {\n\n        /**\n         * Only initialize this trailpack after trailpack-router has been\n         * initialized.\n         */\n        listen: [ 'trailpack:router:initialize' ]\n      }\n    }\n  }\n\n  validate () {\n    if (!this.app.config.example) throw new Error('config.example not set!')\n  }\n\n  configure () {\n    this.app.config.example.happy = true\n  }\n\n  async initialize () {\n    this.interval = setInterval(() =\u003e {\n      this.log.debug('happy?', this.app.config.example.happy)\n    }, 1000)\n  }\n\n  async unload () {\n    clearInterval(this.interval)\n  }\n\n  constructor (app) {\n    super(app, {\n      config: require('./config'),\n      api: require('./api'),\n      pkg: require('./package')\n    })\n  }\n\n}\n```\n\n## API\n\n### Boot Lifecycle\n\n0. [`trails:start`](https://github.com/trailsjs/trails/blob/master/index.js#L72) (event)\n1. [`validate()`](https://github.com/trailsjs/trailpack/blob/master/index.js#L54-L61)\n2. [`configure()`](https://github.com/trailsjs/trailpack/blob/master/index.js#L63-L70)\n3. [`initialize()`](https://github.com/trailsjs/trailpack/blob/master/index.js#L72-L78)\n4. [`trails:ready`](https://github.com/trailsjs/trails/blob/master/lib/trailpack.js#L38)\n\n### Properties\n\n#### `log`\nProvides convenient access to the Trails logger. (e.g. `this.log.debug('hello')`)\n\n#### `packs`\nAccess the application's loaded Trailpacks. This is a mapping of\nname -\u003e Trailpack. (e.g. `this.packs.core`)\n\n#### `on`, `once`, `emit`, `after`\nEmit/Listen for events on the Trails EventEmitter. Convenience methods for\n`this.app.on`, `this.app.once`, etc. (e.g. `this.emit('custom:event')`)\n\n### Methods\n\n#### `constructor(app, definition)`\nInstantiate the Trailpack. `definition` is an object which contains three\noptional properties: `config`, `api`, `pkg`. Trailpack configuration is merged\ninto the application configuration.\n\n#### `validate()`\nValidate the preconditions for proper functioning of this trailpack. For\nexample, if this trailpack requires that a database is configured in\n`config/database.js`, this method should validate this. This method should incur\nno side-effects. *Do not alter any extant configuration.*\n\n#### `configure()`\nAlter/Extend the configuration (`app.config`) of the application, or\nadd new sections to the config object for the trailpack. This method \nis run before the application is loaded -- after validate, and before \ninitialize. Trails does not allow further configuration changes after\nthis lifecycle stage is complete.\n\n#### `initialize()`\nIf you need to bind any event listeners, start servers, connect to databases,\nall of that should be done in initialize. The app's configuration is guaranteed to be\nloaded and finalized before this stage.\n\n#### `unload()`\nCleaup any resources/daemons started by this Trailpack. Used by [trailpack-autoreload](https://github.com/trailsjs/trailpack-autoreload)\nand other system tools to cleanly release resources in order to\nshutdown/restart the Trails application.\n\n### Types\nThe trailpack `type` is used to distinguish between Trailpacks by the role they \nperform in the application. It is also used by developer tools such as [Trailmix](https://github.com/trailsjs/trailsmix)\n\n#### `system`\nThese trailpacks provide critical framework-level functionality that most/all\nother trailpacks will depend on, such as [`core`](https://github.com/trailsjs/trailpack-core)\nand [`router`](https://github.com/trailsjs/trailpack-router).\n\n```js\nconst SystemTrailpack = require('trailpack/system')\n\nmodule.exports = class HapiTrailpack extends SystemTrailpack {\n\n}\n```\n\n#### `server`\nThese allow you to use various node.js web server frameworks with Trails, such\nas [`express`](https://github.com/trailsjs/trailpack-express4),\n[`hapi`](https://github.com/trailsjs/trailpack-hapi),\nand [`koa`](https://github.com/trailsjs/trailpack-koa). Typically, only one\nserver pack will be installed in a Trails Application.\n\n\n```js\nconst ServerTrailpack = require('trailpack/server')\n\nmodule.exports = class HapiTrailpack extends ServerTrailpack {\n\n}\n```\n\n#### `datastore`\nDatastore trailpacks provide a unified way to configure various persistence\nstores. These may be ORMs, query builders, or database drivers. Examples include\n[`knex`](https://github.com/trailsjs/trailpack-knex), [`graphql`](https://github.com/trailsjs/trailpack-graphql)\nand [`waterline`](https://github.com/trailsjs/trailpack-waterline). Typically,\nonly one datastore pack will be installed in a Trails Application.\n\n\n```js\nconst DatastoreTrailpack = require('trailpack/datastore')\n\nmodule.exports = class KnexTrailpack extends DatastoreTrailpack {\n\n}\n```\n\n#### `tool`\nEvery application needs a suite of tools for development, debugging,\nmonitoring, etc. These trailpacks integrate various modules with Trails\nto provide a richer developer experience. Some tool packs include\n[`autoreload`](https://github.com/trailsjs/trailpack-autoreload), [`webpack`](https://github.com/trailsjs/trailpack-webpack),\n[`repl`](https://github.com/trailsjs/trailpack-repl). Trails Application logic\nwill typically not rely on these trailpacks directly.\n\n\n```js\nconst ToolTrailpack = require('trailpack/tool')\n\nmodule.exports = class WebpackTrailpack extends ToolTrailpack {\n\n}\n```\n\n#### `extension`\nExtension packs exist to augment, or extend, the functionality of other\ntrailpacks or existing framework logic.\nFor example, [`footprints`](https://github.com/trailsjs/trailpack-footprints)\nprovides a standard interface between `server` and `datastore` trailpacks.\n[`realtime`](https://github.com/trailsjs/trailpack-realtime) adds additional\nfunctionality to a server. [`sails`](https://github.com/trailsjs/trailpack-sails)\nlets you plugin an entire sails project directly into a Trails Application.\n[`bootstrap`](https://github.com/trailsjs/trailpack-bootstrap) extends the Trails\nboot process so that a custom method can be run during application startup.\n\n\n```js\nconst ExtensionTrailpack = require('trailpack/extension')\n\nmodule.exports = class FootprintsTrailpack extends ExtensionTrailpack {\n\n}\n```\n\n#### `misc`\nAll trailpacks that don't fit previous types.\n\n\n```js\nconst Trailpack = require('trailpack')\n\nmodule.exports = class ExampleTrailpack extends Trailpack {\n\n}\n```\n\n### Documentation\n\n- [**Trailpack Implementation Guide**](https://trailsjs.io/doc/en/ref/trailpack)\n- [**API Reference**](https://trailsjs.io/doc/en/extend/trailpack)\n\n## Contributing\nWe love contributions! Please see our [Contribution Guide](https://github.com/trailsjs/trails/blob/master/.github/CONTRIBUTING.md)\nfor more information.\n\n## License\n[MIT](https://github.com/trailsjs/trailpack/blob/master/LICENSE)\n\n\u003cimg src=\"http://i.imgur.com/dCjNisP.png\"\u003e\n\n[npm-image]: https://img.shields.io/npm/v/trailpack.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/trailpack\n[ci-image]: https://img.shields.io/travis/trailsjs/trailpack/master.svg?style=flat-square\n[ci-url]: https://travis-ci.org/trailsjs/trailpack\n[daviddm-image]: http://img.shields.io/david/trailsjs/trailpack.svg?style=flat-square\n[daviddm-url]: https://david-dm.org/trailsjs/trailpack\n[codeclimate-image]: https://img.shields.io/codeclimate/github/trailsjs/trailpack.svg?style=flat-square\n[codeclimate-url]: https://codeclimate.com/github/trailsjs/trailpack\n[gitter-image]: http://img.shields.io/badge/+%20GITTER-JOIN%20CHAT%20%E2%86%92-1DCE73.svg?style=flat-square\n[gitter-url]: https://gitter.im/trailsjs/trails\n[twitter-image]: https://img.shields.io/twitter/follow/trailsjs.svg?style=social\n[twitter-url]: https://twitter.com/trailsjs\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrailsjs%2Ftrailpack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrailsjs%2Ftrailpack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrailsjs%2Ftrailpack/lists"}