Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rokf/janet-datastar
A Janet utility library for the Datastar hypermedia framework
https://github.com/rokf/janet-datastar
datastar http-server hypermedia janet janet-lang utility-library
Last synced: about 1 month ago
JSON representation
A Janet utility library for the Datastar hypermedia framework
- Host: GitHub
- URL: https://github.com/rokf/janet-datastar
- Owner: rokf
- License: mit
- Created: 2024-10-20T17:18:18.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-03T18:21:26.000Z (2 months ago)
- Last Synced: 2024-11-03T19:23:17.599Z (2 months ago)
- Topics: datastar, http-server, hypermedia, janet, janet-lang, utility-library
- Language: Janet
- Homepage:
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# janet-datastar
This is a Janet utility library for building web applications using the [Datastar](https://data-star.dev) hypermedia framework. It primarily contains helper functions for the various attributes, actions, and event types that Datastar is offering. It is meant to be used together with Janet's [spork](https://github.com/janet-lang/spork) library (`htmlgen` and `http` modules).
> [!IMPORTANT]
>
> This library is not yet stable. Even though it probably contains functions for all of the functionality that Datastar is offering they have not all been tested yet, at least not well enough. Expect changes. I'll start adding semantic version tags once things stabilise.## API
The library is split into multiple modules:
- `datastar` contains middleware and other stuff that doesn't exactly fit into any of the submodules.
- `datastar/attributes` contains helper functions for Datastar's HTML attributes, such as `data-store`.
- `datastar/actions` contains helper functions for Datastar's actions, such as `$$clipboard`.
- `datastar/events` contains helper functions for all the SSE response types (events) Datastar is supporting, such as `datastar-fragment` or `datastar-redirect`.
- `datastar/server` contains a slightly customized HTTP server implementation from `spork/http`, because the original does not (yet) support everything that'd be needed for it to work well with the Datastar framework.See the [API](./API.md) reference for details.
## Installation
The library can be installed with **jpm** using `jpm install https://github.com/rokf/janet-datastar` or by adding the following line into your project's dependency tuple:
```janet
{ :url "https://github.com/rokf/janet-datastar" :tag "main" }
```## Example
An example can be found in the `example` folder. It requires the following dependencies:
- https://github.com/ianthehenry/pat
- https://github.com/janet-lang/spork
- https://github.com/rokf/janet-redkaThe folder contains a Docker Compose specification which can be used to spin up a properly configured Redka instance (see `compose.yaml`).
## Tests
See the contents of the `test` folder. The tests require [judge](https://github.com/ianthehenry/judge). Make sure that it's installed on your machine before you run them with `judge test`.
## License
MIT - see the `LICENSE` file at the root of the repository for details.