npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sudodevnull/datastar

v0.19.9

Published

[https://data-star.dev](https://data-star.dev)

Downloads

543

Readme

Datastar

https://data-star.dev

Star History Chart

Typescript library for making hypermedia systems using little to no Javascript code. The Typescript may be important to the datastar dev but its just a normal JS file to the browser. The goal is to make it easy to create realtime web apps with as little Javascript as possible. This is done by using HTML attributes to define the behavior of the page. This is similar to Alpine.js + HTMX but with a few key differences.

It's just normal HTML data attributes that get watched by plugins and build up a context object. The current plugins work off of signals to make everything reactive and allow very fast interactions in very little code.

Size

Community

Has it's on Discord server. Feel free to join and ask questions.

Features

Pros

  • Built with reactive applications in mind, not just pages.
  • 💯 strict Typescript with full tree shaking support
  • 📦 0 dependencies
  • The best parts of Alpine.js and HTMX but created in a unique way to allow for a more declarative approach
  • 💯 HTML compliant
  • Fine grain reactivity
  • Using Vite for development and Rollup for production builds.
  • Everything is an plugin so you can add and remove features as needed
  • HOWL stack ready with Go specific tooling coming soon
  • Even with all plugins its very small (see badge above)
  • Faster than Alpine.js VDOM reactivity and HTMX needs Hyperscript or Alpine to work on most real world projects
  • DHH would hate it

Cons

  • No progressive enhancement, you need Javascript enabled. Datastar is for making realtime web apps like dashboards, admin panels, etc. If you need progressive enhancement use Alpine-Ajax or HTMX and stick to just <a/> and <form/> tags. Scripting is a first class citizen in hypermedia systems.
  • Modern browsers only (no IE11 support)
  • Have to use custom attributes (data-*) so slightly more verbose but spec compliant always
  • Have to use SSE if you use the defaults. It's a little more code upfront but allows for faster updates and less code.
  • No book, but most of hypermedia concepts will port directly over.

Why not just use Vue/React/Svelte?

HTMX Essays are a great place to start.

Why not just use HTMX+Alpine?

I think HTMX is great and I will continue to recommend it for splashes of contents. In general Datastar is geared towards more complex reactive applications, especially in a realtime context.

Building

The library itself can be built with https://pnpm.io/ by doing a pnpm i and pnpm build in the packages/library folder.

To run the examples website you will need the following:

Start with a git lfs checkout in the datastar root folder then run task tools followed by task -w hot.