{"id":13554512,"url":"https://github.com/enokidotsite/enoki","last_synced_at":"2025-04-03T07:31:37.273Z","repository":{"id":57125280,"uuid":"99641269","full_name":"enokidotsite/enoki","owner":"enokidotsite","description":"ultralight tools for creating p2p sites","archived":false,"fork":false,"pushed_at":"2019-02-21T06:43:24.000Z","size":141,"stargazers_count":225,"open_issues_count":2,"forks_count":21,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-02T03:51:51.232Z","etag":null,"topics":["cms","dat","p2p","vanilla"],"latest_commit_sha":null,"homepage":"http://enoki.site","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/enokidotsite.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":"2017-08-08T02:32:22.000Z","updated_at":"2024-08-07T20:24:54.000Z","dependencies_parsed_at":"2022-08-31T08:20:08.854Z","dependency_job_id":null,"html_url":"https://github.com/enokidotsite/enoki","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enokidotsite%2Fenoki","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enokidotsite%2Fenoki/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enokidotsite%2Fenoki/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enokidotsite%2Fenoki/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/enokidotsite","download_url":"https://codeload.github.com/enokidotsite/enoki/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246956479,"owners_count":20860444,"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":["cms","dat","p2p","vanilla"],"created_at":"2024-08-01T12:02:49.316Z","updated_at":"2025-04-03T07:31:37.025Z","avatar_url":"https://github.com/enokidotsite.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","p2p"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\u003ca href=\"https://enoki.site\"\u003e\u003cimg src=\"example/content/title.svg\" height=\"auto\" width=\"100%\"\u003e\u003c/a\u003e\u003c/div\u003e\n\n\u003cbr /\u003e\n\nEnoki is a powerfully simple set of tools and interfaces for creating and managing websites, single-page apps, and whatever else you can imagine. It’s as vanilla as possible, meant to get out of your way, and play nicely with traditional tooling as well as unique environments, such as the peer-to-peer [Beaker Browser](https://beakerbrowser.com).\n\nAlthough fully-featured, Enoki is still early in development. Support for other frameworks and syntax styles are on the roadmap. If something you’d like to see is missing, please feel free to contribute!\n\n## Features\n\n- **no-db**: just files and folders\n- **simple**: written for clarity and understandability\n- **tools**: easy ways of [traversing data](#page-api)\n- **cute**: first class support for [choo](https://github.com/choojs/choo), a simple and sturdy front-end framework\n- **panel**: manage your content with a [super simple and extensible interface](https://github.com/enokidotsite/panel)\n\n## Usage\n\nThe Enoki module can be used in a variety of ways. For a quick overview in situ, take a look at an [example design](https://github.com/enokidotsite/design-jacinto). For the sake of this readme, let’s just create a fresh little Choo app.\n\nCreate a `/content` directory in the root of your project and make an `index.txt` file. Pages (and sub-pages) are just folders with their own `index.txt` files:\n\n```\ntitle: Enoki Example\n----\ntext: Hey, not bad!\n```\n\nInside `index.js` let’s initialize our Choo app and require the `enoki/choo` plugin which loads our content. If in an environment exposing the Dat API we’ll dynamically read your `/content` into state. If over HTTP we’ll fallback to static JSON output of state when last edited/built.\n\n```js\nvar choo = require('choo')\nvar app = choo()\n\napp.use(require('enoki/choo')())\n```\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eExpaned Choo example\u003c/b\u003e\u003c/summary\u003e\n\n```js\nvar html = require('choo/html')\n\nfunction view (state, emit) {\n  var page = state.page\n  var children = page().children().sort('title', 'asc').value()\n\n  return html`\n    \u003cbody\u003e\n      \u003ch1\u003e${page.value('title')}\u003c/h1\u003e\n      \u003carticle\u003e${page.value('text')}\u003c/article\u003e\n      \u003cul\u003e\n        ${children.map(renderChild)}\n      \u003c/ul\u003e\n    \u003c/body\u003e\n  `\n\n  function renderChild (props) {\n    var child = page(props)\n    return html`\n      \u003cli\u003e\n        \u003ca href=\"${child.value('url')}\"\u003e${child.value('title')}\u003c/a\u003e\n      \u003c/li\u003e\n    `\n  }\n}\n``` \n\n\u003c/details\u003e\n\n## Page API\n\nEnoki provides a super convenient way for traversing flat content state called [`nanopage`](https://github.com/jondashkyle/nanopage). Just pass some [content state](#content-state) to the constructor and you’re set.\n\n```js\nvar Page = require('enoki/page')\nvar page = new Page(state)\n\n// some examples\nvar title = page().value('title')\nvar children = page().children().toArray()\nvar imageFirst = page().files().value('path')\n```\n\nFor a complete list of methods, take a look [at the docs](https://github.com/jondashkyle/nanopage)!\n\n## Enoki Panel\n\nThe [Enoki Panel](https://github.com/enokidotsite/panel) is a super extensible interface for managing an Enoki site’s content. It runs entirely client-side in [Beaker Browser](https://beakerbrowser.com), and is accessible at [panel.enoki.site](https://panel.enoki.site).\n\n## Configuration options\n\n```json\n{\n  \"blueprints\": \"/blueprints\",\n  \"config\": \"site.json\",\n  \"content\": \"content\",\n  \"fallback\": \"/bundles/content.json\",\n  \"file\": \"index.txt\"\n}\n```\n\nIt’s recommended to place your configuration in a file called `site.json` within the root directory of your site. This works like `package.json`, but for your site. Just as `package.json` can be read using any number of tools, your `site.json` can be too.\n\nAlternatively, when using the module, pass the configuration object as the first argument to the Enoki class. When using the Choo plugin, simply pass as the first argument to the returned function.\n\n```js\n// using the module\nnew Enoki(defaults)\n\n// using the choo plugin\napp.use(require('enoki/choo')(defaults))\n```\n\nConfiguration is progressively constructed, just like `package.json`: module defaults → `site.json` → configuration object argument.\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eConfiguration options overview\u003c/b\u003e\u003c/summary\u003e\n\n#### `blueprints`\n\nThe directory containing your site’s blueprints. These are JSON files describing the fields for the Enoki Panel. Here’s an [example of that](lib/read/defaults.json).\n\n#### `config`\n\nThe location of the configuration file.\n\n#### `content`\n\nThe content directory.\n\n#### `fallback`\n\nThe location of the content state JSON fallback for HTTP.\n\n#### `file.txt`\n\nThe file containing data for each page. Defaults to `index.txt`. An alternate could be `index.md`.\n\n\u003c/details\u003e\n\n## Peer-to-Peer / Dat\n\nThe web is becoming re-decentralized! You can use Enoki with [Dat](https://datproject.org) in an environment such as [Beaker Browser](https://beakerbrowser.com) by swapping Node’s `fs` for the `DatArchive` API. This enables real-time reading of the archives’s files. Ensure you’re using `.readAsync()`.\n\n## HTTP Fallback and CLI\n\nWhen using Enoki in a Dat environment we use the `DatArchive` API instead of Node’s `fs` to read the archive’s files. However, over `http` Enoki reads a static `json` file for fallback.\n\nIf you’d like to output that static `json` when developing your site you can use the Enoki `cli`. It’s possible to watch your content directory for changes by using the `--watch` flag.\n\n```\nenoki content\nenoki content --watch\n```\n\n## Dependencies\n\nFor specifics on formatting directories and files, take a look at the dependencies’ documentation.\n\n- [`smarkt`](https://github.com/jondashkyle/smarkt) for parsing mixed key/value store and yaml plain text files\n- [`hypha`](https://github.com/jondashkyle/hypha) for turning folders and files into json\n\n## Contributing\n\nEnoki is early in development. If you’d like to see support for webpack, or whatever other tooling, feel free to contribute!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenokidotsite%2Fenoki","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenokidotsite%2Fenoki","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenokidotsite%2Fenoki/lists"}