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

@hyperspan/framework

v0.0.2

Published

Hyperspan Web Framework

Downloads

97

Readme

Hyperspan. Simple. Full-Stack. Streaming.

[!NOTE] > Hyperspan is still in the early stages of development, your feedback is appreciated.

No JSX. No Virtual DOM. No hydration time. No nonsense. Just blazing fast HTML strings with reactive templates.

Hyperspan is a full-stack framework built with Bun that is focused on simplicity and perforamnce.

Who Is Hyperspan For?

Hyperspan is best for websites, web applications, and APIs that need fast streaming and dynamic server responses. It is great for performance critical applications and delivers no client-side JavaScript by default. This helps to ensure your website stays fast and lightweight for end users as it grows over time, since all client JavaScript is explicitly opt-in.

Why Bun?

Bun is a Node-compatible runtime that offers better performance and built-in TypeScript support so transpiling is not required for writing type-safe server-side code. Bun also offers some other extras like built-in ultra fast testing utilities so extra dependencies are not required to write high-quality code.

React vs. Hyperspan

Hyperspan is not a React replacement. React is a client-side library to build interactive JavaScript based UIs. Hyperspan is a full-stack server-side framework built to deliver high-performance streaming and dynamic responses, and does not deliver any JavaScript to the client by default.

Hyperspan can be best thought of as an alternative to React-based frameworks like Next.js. It has all the same types of things, like file-based page routes, API routes, middleware, components, etc. but Hyperspan has a very different runtime and execution model. React-based frameworks ship all React components and code to the client by default, resulting in surprisingly large JS bundle sizes that grow more over time as your site does. Hyperspan takes the opposite approach, and does not ship ANY components to the client by default. Client components are available, but are explicitly opt-in and should generally be used sparingly.

React is all JavaScript, all the time, delivered to the client. Hyperspan is mostly static content and markup delivered to the client, with JavaScript sprinkles where needed.

Philosophy

P1: Server-Side First.

Current JavaScript frameworks ship everything to the browser by default and use non-intuitive ways to opt-out of this. The first clue that this approach was backwards was when JavaScript bundle sizes started being measured in hundreds of kilobytes to megabytes.

Keeping bundle sizes down in large projects over time can be challenging. A full stack framework should render as much as possible on the server by default for better performance. Sending JavaScript code to the client and increasing bundle sizes for all your users should be explicit and opt-in.

Modern frameworks make it too easy to accidentally ship code to the client that you don't want. They often mix client and server concerns in a way that is hard to understand and keep separate. They return cryptic and confusing errors when you make mistakes around client and server boundaries.

We've lost the forrest from the trees. The complixity has become too much, and users are paying the price.

This is the way back for a full-stack framework:

  • Server fetching and rendering by default.
  • Minimal client-side JavaScript by default. Code that ships to the client should be explicit and opt-in.
  • Most of the work and state should be maintained on the server. The framework should help make this easy.

P2: Performance Oriented.

Server-side code is fast because it sends HTML strings to the client and lets the browser do its job - the job that is was built specifically to do. There is no sense in typing up the JavaScript thread for rendering markup that can just be sent directly.

You don't need a Virtual DOM or expensive reconciliation diff calculations to make interactive web sites or applications. You just need a more intelligent template that knows the pieces that update.

HTML strings are the fastest and easiest way to update the parts of the DOM that change. We have known this since the Web 1.0 days of AJAX and template partials. Modern JavaScript built-ins like Tagged Template Literals are an obvious choice to do do the same thing today, and are built into the language.

P3: Works the Same In Every Context.

All templates and components should be rendered asynchronously to allow you to do any other kind of asynchronous work in them that you need to, in any context that you do it in. It's just JavaScript. Not special framework-flavored JavaScript.

There should be no difference in how a template or component is rendered in one context vs. another. It should not matter if a component runs on the client or the server, or fetches data or streams in. The core conceptual semantics should be the same everywhere.