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 🙏

© 2026 – Pkg Stats / Ryan Hefner

arche

v1.0.2

Published

HTML as JavaScript

Readme

Arche

arche-logo

Arche (/ˈɑːrki/; Ancient Greek: ἀρχή) is a Greek word with primary senses "beginning", "origin" or "source of action" (ἐξ' ἀρχῆς: from the beginning, οr ἐξ' ἀρχῆς λόγος: the original argument), and later "first principle" or "element".

Node.js CI codecov npm version

Simplified DOM interface / React in pure JavaScript.

{
  const DocumentElement = Arche(document)
  const { Div, H1, P } = DocumentElement

  const myElement = Div({ id: 'my-element' }, [
    H1('DOM Example'),
    P('paragraph'),
    P('lorem ipsum'),
  ])

  document.getElementById('dom-container').appendChild(myElement)
}

{
  const ReactElement = Arche(React)
  const { Div, H1, P, Button, Img } = ReactElement

  const UserCard = ReactElement(({
    firstName, lastName, age,
  }) => Div([
    H1(`${firstName} ${lastName}`),
    Img({ src: 'https://placehold.co/300x300', alt: 'placeholder' }),
    P({ style: { color: 'lightgrey' } }, `age: ${age}`),
  ]))

  ReactDOM.render(
    UserCard({ firstName: 'React', lastName: 'ExampleUser', age: 32 }),
    document.getElementById('react-root')
  )
}

Installation

with npm

npm i arche

with browser script, sets window.Arche

<script src="https://unpkg.com/arche"></script>

with ES Modules

import Arche from 'https://unpkg.com/arche/es.js'

Set DocumentElement globally for a better developer experience.

// global.js
const DocumentElement = Arche()

window.DocumentElement = DocumentElement

for (const elementName in DocumentElement) {
  window[elementName] = DocumentElement[elementName]
}

// set missing elements
window.Aside = DocumentElement('aside')
window.Svg = DocumentElement('svg')
window.Path = DocumentElement('path')

Using React

To use Arche with React, simply provide the React library.

const ReactElement = Arche(React)

Create dynamic components with props.

const ReactElement = Arche(React)

const { Div, H1, P, Button, Img } = ReactElement

const UserCard = ReactElement(({
  firstName, lastName, age,
}) => Div([
  H1(`${firstName} ${lastName}`),
  Img({ src: 'https://placehold.co/300x300', alt: 'placeholder' }),
  P({ style: { color: 'lightgrey' } }, `age: ${age}`),
]))

ReactDOM.render(
  UserCard({ firstName: 'Example', lastName: 'Name', age: 32 }),
  document.getElementById('react-root')
)

Complete interoperability with React hooks (converted from this example).

const ReactElement = Arche(React)
const { Div, P, Button } = ReactElement
const { useState } = React

const Example = ReactElement(() => {
  const [count, setCount] = useState(0)

  return Div([
    P(`You clicked ${count} times`),
    Button({
      onClick() {
        setCount(count + 1)
      },
    }, 'Click me'),
  ])
})

ReactDOM.render(Example(), document.getElementById('react-root'))

Set ReactElement globally for a better developer experience.

// global.js
const ReactElement = Arche(React)

window.ReactElement = ReactElement

for (const elementName in ReactElement) {
  window[elementName] = ReactElement[elementName]
}

// set missing elements
window.Aside = ReactElement('aside')
window.Svg = ReactElement('svg')
window.Path = ReactElement('path')

Using React Context

To use React Context with Arche, wrap YourContext.Provider with ReactElement and supply value as a prop, specifying children in the next argument.

JSX example:

function ArticleWrapper () {
  const [theme, setTheme] = React.useState(themes[0])

  return (
    <ThemeContext.Provider value={{
      theme,
      changeTheme: setTheme
    }}>
      <ThemeSwitcher />
      <Article />
    </ThemeContext.Provider>
  )
}

Translates to the following with Arche:

const ArticleWrapper = ReactElement(() => {
  const [theme, setTheme] = React.useState(themes[0])

  return ReactElement(ThemeContext.Provider)({
    value: { theme, changeTheme: setTheme },
  }, [ThemeSwitcher(), Article()])
})

Using styled

Arche accepts a styled option from css-in-js libraries like Styled Components to enable a css prop on ReactElement and TypedReactElement.

const ReactElement = Arche(React, { styled })

Elements can now specify a css prop to use css-in-js.

const ReactElement = Arche(React, { styled })
const { Div, H1, P } = ReactElement

const MyComponent = ReactElement(() => {
  return Div({
    css: `
      height: 500px;
      width: 100%;
      background-color: pink;
    `,
  }, [
    H1('Styled Example'),
    P('Text'),
  ])
})

ReactDOM.render(MyComponent(), document.getElementById('react-root'))

Contributing

Your feedback and contributions are welcome. If you have a suggestion, please raise an issue. Prior to that, please search through the issues first in case your suggestion has been made already. If you decide to work on an issue, please create a pull request.

Pull requests should provide some basic context and link the relevant issue. If you are interested in contributing, the help wanted tag is a good place to start.

For more information please see CONTRIBUTING.md

License

Arche is MIT Licensed.

Support

  • minimum Node.js version: 14
  • minimum Chrome version: 63
  • minimum Firefox version: 57
  • minimum Edge version: 79
  • minimum Safari version: 11.1