{"id":16260017,"url":"https://github.com/cludden/mycro","last_synced_at":"2025-03-19T22:31:02.950Z","repository":{"id":57306516,"uuid":"44493021","full_name":"cludden/mycro","owner":"cludden","description":null,"archived":false,"fork":false,"pushed_at":"2016-08-09T04:36:03.000Z","size":179,"stargazers_count":11,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T11:50:34.436Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/cludden.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-18T19:33:09.000Z","updated_at":"2021-01-30T18:48:18.000Z","dependencies_parsed_at":"2022-08-28T13:21:14.278Z","dependency_job_id":null,"html_url":"https://github.com/cludden/mycro","commit_stats":null,"previous_names":["cludden/restify-microservice"],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cludden%2Fmycro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cludden%2Fmycro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cludden%2Fmycro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cludden%2Fmycro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cludden","download_url":"https://codeload.github.com/cludden/mycro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244515631,"owners_count":20464923,"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-10-10T16:06:06.097Z","updated_at":"2025-03-19T22:31:02.581Z","avatar_url":"https://github.com/cludden.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# mycro\n[![Build Status](https://travis-ci.org/cludden/mycro.svg?branch=master)](https://travis-ci.org/cludden/mycro) [![Codacy Badge](https://api.codacy.com/project/badge/grade/5b759953fe0248b1a241bc8700f64e61)](https://www.codacy.com/app/chris-ludden/mycro)\n\n\na [restify.js](http://restify.com) based microservice library, inspired by [sails.js](http://sailsjs.org)  \n\n\n## Install\nWith yeoman:\n```javascript\n// install yeoman \u0026 the mycro generator globablly\nnpm install -g yo generator-mycro\n\n// create a new mycro app\nyo mycro my-app\n```\n\nThe long way:\n```javascript\nnpm install --save mycro\n```\n\n## Purpose\nTo provide a highly customizable platform for a well-organized [restify.js](http://restify.com) or [express.js](http://expressjs.com) app, using `hooks`. By default, `mycro` comes bundled with hooks for controllers, models \u0026 connections, middleware, policies, routing, services, etc. However, this module allows you to implement custom hooks extremely easily, as well as disable, override, or reorder the default hooks. More importantly, this module makes no assumption regarding which other third party libraries (ORMs, middleware, templating engines, etc) you'd like to use in your app. In fact, using `restify` is entirely optional, and can be disabled by excluding the `server` \u0026 `start` hooks or implementing your own.\n\n\n## Docs\n1. [Getting Started](/docs/getting-started.md)\n2. [Controllers](/docs/controllers.md)\n3. [Services](/docs/services.md)\n4. [Routing (Part I)](/docs/routing-01.md)\n5. [Policies](/docs/policies.md)\n6. [Routing (Part II)](/docs/routing-02.md)\n7. [Models and Connections](/docs/models-and-connections.md)\n\n\n## Configuration\n- [Server \u0026 Middleware](/docs/middleware.md)\n- [Logging](/docs/logging.md)\n\n\n## Hooks\nAt the most basic level, `mycro` is simply a serial asynchronous hook loader. By default, it comes bundled with hooks for implementing some of the most common patterns found in most `restify` apps, but you are free to include or exclude any or all of the included hooks, as well as write your own. Hooks can do anything you need them to, including but not limited to, interacting with a database, making api calls, loading third party modules, etc.\n\n## Bundled Hooks\n`mycro` comes bundled with the following hooks:\n- **server** - creates a restify server and loads specified middleware\n- **connections** - handles all database/ORM connection configuration\n- **models** - loads models at `mycro.models` and executes any post processing\n- **services** - loads services at `mycro.services`\n- **policies** - loads policies at `mycro.policies`\n- **controllers** - loads controllers at `mycro.controllers`\n- **routes** - defines routes based on the route config specified in `/app/routes.js`\n- **start** - starts the server\n\n\nTo implement your own hook configuration, define your own `config/hooks.js` file:\n\n\n*config/hooks.js*\n```javascript\nmodule.exports = [\n    'server',\n    'connections',\n    'models',\n    'services',\n    'policies',\n    require('../hooks/my-hook.js'), // custom project hook\n    'controllers',\n    'super-cool-hook', // installable hook\n    require('../hooks/my-own-routes-hook'), // custom project hook\n    'start'\n];\n```\n\n\n## Custom Hooks\nImplementing a custom hook is super easy. A hook exports a function. The function is bound to the `mycro` application instance, which allows you to manipulate any aspect of the `mycro` application. Lastly, the function accepts a single callback. Make sure to call it when the hook is complete!\n\n\n*hooks/my-hook.js*\n```javascript\nmodule.exports = function myHook(done) {\n    var mycro = this;\n    // do some stuff\n    done();\n};\n```\n\n\n## Installable Hooks \u0026 Adapters\n**Hooks**\n\n\nTo use these hooks, simply install them via `npm install --save \u003cinsert hook name here\u003e` and require them in your `config/hooks.js` file.\n\n\n- [mycro-error](https://github.com/cludden/mycro-error)\n    - Installs an error service that provides common error handling implementations\n- [mycro-json-api-ify](https://github.com/kutlerskaggs/mycro-json-api-ify)\n    - Installs a json service that exports a [json-api-ify] serializer\n- [mycro-mongoose-rest](https://github.com/cludden/mycro-mongoose-rest)\n    - Creates RESTful mongoose controllers for your mongoose models using [restify-mongoose](https://github.com/saintedlama/restify-mongoose)\n- [mycro-secrets](https://github.com/cludden/mycro-secrets)\n    - A secret management hook (using [vault](https://www.vaultproject.io)) for mycro apps\n- [mycro-util-policies](https://github.com/kutllerskaggs/mycro-util-policies)\n    - Installs utility polices (if, or, not, validate) for mycro apps\n\n\n**Adapters**\n\n\n- [mycro-mongoose](https://github.com/cludden/mycro-mongoose)\n    - mongoose (MongoDB) adapter\n- [mycro-sequelize](https://github.com/cludden/mycro-sequelize)\n    - sequelize (PostgreSQL, MySQL, MSSQL, SQLite) adapter\n- [mycro-vogels](https://github.com/cludden/mycro-vogels)\n    - vogels (DynamoDB) adapter.\n\n\n## Testing\nrun all tests  \n```javascript\nnpm test\n```\n\nrun coverage\n```javascript\ngrunt coverage\n```\n\n\n## Contributing\n1. [Fork it](https://github.com/cludden/mycro/fork)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n\n## License\nCopyright (c) 2016 Chris Ludden.\nLicensed under the [MIT license](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcludden%2Fmycro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcludden%2Fmycro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcludden%2Fmycro/lists"}