Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
grainstack
Advanced tools
A succinct (API-first) way of building fine-grained, three-tier web apps.
This is an alternative stack for building web apps.
grainstack
- Run npx grainstack
to create a three-tier app.grainbox
: react
- Front-end framework providing reactive updates.jsx-to-hyperscript
: babel
- JSX support by transforming it to hyperscript
.web-imports
: webpack
- Support for resolving dependencies of dependencies.cleanbean
- A client-side graphql interface with minimal API surface area.The goal is to reduce JavaScript fatigue. Instead of being exposed to NPM, babel, and webpack your first time building a web app, instead, all you need is beginner understanding of vanilla HTML, JS, and CSS to start, and there is a gradual path towards increasing the complexity of the project until it is a three-tier app completed with a database, server, and client. That path is laid out by grainstack
.
ES modules in the browser was a major advancement in web technology that paved the way for isomorphic code sharing and a bundle-less developer experience that reduced complexity and overhead. It suddenly became possible to use packages without a compile step, resulting in a leaner project space.
Packages like htm
and hyperscript
allowed for a react-like developer experience in vanilla JS. So grainbox
was created to provide the reactivity solution, and then it was possible to make a reactive SPA using only built-in language features. "Bundl-ation" not needed.
However, in vanilla JS some features are still missing which are worth installing such as typing, JSX, and the ability to access a thriving package ecosystem.
Additional features are added by introducing a build or compilation step,
and if babel
is no longer needed for JSX transformation,
then it can be removed from the project in some cases.
Some common build steps are:
node_modules
and dependencies of dependencies.Covering these common use cases means that many projects might not need plugin systems such as babel
or webpack
anymore.
There are certain parts a single page application requires, and these solutions are known to work well together:
node_modules
in the browser using web-imports
jsx-to-hyperscript
import {css} from 'goober'
Running npx grainstack
will setup a project with all of the above.
One goal of the project is to bridge the gap as much as possible between the kinds of things you can make without NPM, babel, and webpack.
One interesting thing I have found it has enabled me to do is easily share code between the front-end and back-end. Taking advantage of the isomorphic feature of ES Modules, all I had to do was import and it was available.
Another notable feature is the ability to serve html pages through a CDN. This can be useful for making demos easily.
Supporting JSX will require compilation until it becomes part of the browser.
If you would like to use JSX instead of html
template tag literals, you can do so using the jsx-to-hyperscript
package. Then, h
must be present in any file which has JSX. This is similar to how React
has to be present in any file which has JSX.
// These imports are analogous to each other with respect to JSX being present in the file.
import {React} from 'react'
import {h} from 'grainstack'
// `jsx-to-hyperscript` will transforms this into: const element = h('div')
const element = <div/>
Which kinds of projects would work best with grainstack
?
grainstack
has not been tested on large projects.
FAQs
A succinct (API-first) way of building fine-grained, three-tier web apps.
We found that grainstack demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.