{"id":23366707,"url":"https://github.com/d8corp/innet","last_synced_at":"2025-04-07T23:15:42.693Z","repository":{"id":57274210,"uuid":"325038669","full_name":"d8corp/innet","owner":"d8corp","description":"A JavaScript library for innet ecosystem","archived":false,"fork":false,"pushed_at":"2023-06-30T22:16:06.000Z","size":9347,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T18:54:11.096Z","etag":null,"topics":["javascript","library"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/innet","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/d8corp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-12-28T14:48:56.000Z","updated_at":"2023-05-08T07:48:10.000Z","dependencies_parsed_at":"2022-09-17T10:12:48.169Z","dependency_job_id":null,"html_url":"https://github.com/d8corp/innet","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Finnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Finnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Finnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Finnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d8corp","download_url":"https://codeload.github.com/d8corp/innet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247744328,"owners_count":20988783,"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":["javascript","library"],"created_at":"2024-12-21T14:17:21.421Z","updated_at":"2025-04-07T23:15:42.669Z","avatar_url":"https://github.com/d8corp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/d8corp/innet\"\u003e\n    \u003cimg width=\"200\" height=\"200\" src=\"https://raw.githubusercontent.com/d8corp/innet/main/logo.svg\" alt=\"innet logo by Mikhail Lysikov\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003einnet\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003eCANT inc. application build ecosystem.\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/innet\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/innet.svg\" alt=\"innet npm\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://bundlephobia.com/result?p=innet\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/bundlephobia/minzip/innet\" alt=\"innet minzipped size\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmtrends.com/innet\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dm/innet.svg\" alt=\"innet minzipped size\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/d8corp/innet/blob/master/LICENSE\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/l/innet\" alt=\"innet license\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://changelogs.xyz/innet\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Changelog-⋮-brightgreen\" alt=\"innet minzipped size\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://d8corp.github.io/innet/coverage/lcov-report\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://github.com/d8corp/innet/actions/workflows/tests.yml/badge.svg\" alt=\"innet test coverage\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\n## Abstract\nThe main mission is simplifying and standardizing application development.\n\n`innet` includes all the best features of famous libraries and frameworks.\n`innet` looks like all you've seen but at the same time it's completely different.\n`innet` is an ecosystem for JavaScript, but the same time it's just a function.\nThis is an out-of-the-box solution, at least, going to be.\n`innet` provides you any tools you need to build any JavaScript application:\n\n- [x] API Server\n- [x] Web Site\n- [ ] Browser Plugin\n- [ ] Native Application\n\n### JSX Everywhere\n`JSX` provides you the maximum experience of aligning the code.\n`innet` includes `JSX` by default.\nCheck [@innet/jsx](https://www.npmjs.com/package/@innet/jsx) to get more.\n\n\u003e **YOU CAN USE `JSX` ON THE SERVER SIDE!**\n\n### Split By Plugins\nInclude only code you need, whole functional splits by plugins you can connect (disconnect) separately.\nFrom `refs`, `portals`, `context`, `life cycle`, `state management` on frontend side\nto `router`, `components`, `proxy`, `async`, `html` on server side and more.\n\n\u003e **YOU CAN USE SAME PLUGINS ON BOTH SIDES!**\n\n### Components\nThe component approach is a powerful technology, that `innet` supports.\nYou can reuse a piece of an application, and that's awesome.\n\n\u003e **YOU CAN USE SAME COMPONENTS ON BOTH SIDES!**\n\nThere are a lot of features you can see below, welcome!\n\n[![stars](https://img.shields.io/github/stars/d8corp/innet?style=social)](https://github.com/d8corp/innet/stargazers)\n[![watchers](https://img.shields.io/github/watchers/d8corp/innet?style=social)](https://github.com/d8corp/innet/watchers)\n\n## Install\nnpm\n```bash\nnpm i innet\n```\nyarn\n```bash\nyarn add innet\n```\n\n## Usage\n\u003e You can start learning of `innet` from [@innet/dom](https://www.npmjs.com/package/@innet/dom), for the front-end side,\n\u003e or [@innet/server](https://www.npmjs.com/package/@innet/server) for the back-end.\n\n`innet` is a function which expects 2 required arguments.\nThe first one is an application and the second one is a handler of the application.\nLike you can say **what** to do and **how**.\n```typescript\nimport innet from 'innet'\n\nimport app from './app' // what to do\nimport handler from './handler' // how to do\n\ninnet(app, handler)\n```\n\n`app` can be `any` type, but `handler` should be a `Handler`.\nYou can create the handler with `createHandler` function.\n```typescript\nimport { createHandler } from 'innet'\n\nexport default createHandler([])\n```\n\nBy default, the handler does nothing, but you can set any functionality by plugins.\n\n```typescript\nconst sum = () =\u003e ([a, b]) =\u003e {\n  console.log(a + b)\n}\n// sum is a plugin\n\nconst plugins = [\n  sum,\n]\n\nconst handler = createHandler(plugins)\n\ninnet([1, 2], handler)\n// 3\n```\n\n### Plugins\nA plugin is a function which runs during a handler creation and returns `HandlerPlugin`.\n\nFor example, here is a logger plugin.\n\n```typescript\nimport { HandlerPlugin, NEXT, useApp } from 'innet'\n\nfunction logger(): HandlerPlugin {\n  console.log('logger: initialisation')\n\n  return () =\u003e {\n    console.log('logger: app', useApp())\n\n    return NEXT\n  }\n}\n```\n\n`HandlerPlugin` is a function that can use 2 hooks: `useApp` and `useHandler`.\n\nAs another example, let's look at the plugin of `async` which allows promises handling.\n\n```typescript\nimport innet, { HandlerPlugin, NEXT, useApp, useHandler } from 'innet'\n\nfunction async(): HandlerPlugin {\n  return () =\u003e {\n    const app = useApp()\n\n    if (!(app instanceof Promise)) return NEXT\n\n    const handler = useHandler()\n\n    app.then(data =\u003e innet(data, handler))\n  }\n}\n```\n\nLet's try those plugins\n```typescript\nconst app = new Promise(resolve =\u003e resolve('test'))\n\nconst handler = createHandler([\n  logger,\n  async,\n])\n// \u003e 'logger: initialisation'\n\ninnet(app, handler)\n// \u003e 'logger: app', Promise\n\nawait app\n// \u003e 'logger: app', 'test'\n```\n\nThe order of the plugins is important.\n\n```typescript\nconst app = new Promise(resolve =\u003e resolve('test'))\n\nconst handler = createHandler([\n  async, // change order\n  logger,\n])\n// \u003e 'logger: initialisation'\n\ninnet(app, handler)\n// nothing happens\n\nawait app\n// \u003e 'logger: app', 'test'\n```\n\n### Extend a handler\nYou can extend a handler with `createHandler`,\njust provide the previous handler to the second argument.\n\n```typescript\nconst handler1 = createHandler([\n  async,\n  sum,\n])\n\nconst handler2 = createHandler([\n  logger,\n], handler1)\n```\n\nCheck out [@innet/utils](https://www.npmjs.com/package/@innet/utils),\nthere you can find the most general plugins and utils.\n\n## Issues\nIf you find a bug or have a suggestion, please file an issue on [GitHub](https://github.com/d8corp/innet/issues).\n\n[![issues](https://img.shields.io/github/issues-raw/d8corp/innet)](https://github.com/d8corp/innet/issues)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd8corp%2Finnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd8corp%2Finnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd8corp%2Finnet/lists"}