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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@gravlabs/appwrite-hono-adapter-node

v0.7.0

Published

This adapter allows you to run your Hono application on Appwrite's `node-21.0` runtime. **Caution:** this library is in active development and the API is subject to change.

Downloads

83

Readme

Appwrite Hono Adapter

This adapter allows you to run your Hono application on Appwrite's node-21.0 runtime. Caution: this library is in active development and the API is subject to change.

[!NOTE] Please carefully read the Requirements. Certain versions of this library will work with select Appwrite node-21.0+ runtimes.

Installation

You can install it from the npm registry:

  • npm:

    npm install hono @gravlabs/appwrite-hono-adapter-node
  • yarn:

    yarn add hono @gravlabs/appwrite-hono-adapter-node
  • pnpm:

    pnpm add hono @gravlabs/appwrite-hono-adapter-node

Usage

Import serve from @gravlabs/appwrite-hono-adapter-node and write your Hono code like usual. It supports most Hono middleware as well:

import { Hono } from "hono"
import { serve } from "@gravlabs/appwrite-hono-adapter-node"
import { serveStatic } from "@gravlabs/appwrite-hono-adapter-node/serveStatic"

const app = new Hono()

app.get("/static/*", serveStatic({
    root: './',
}))

app.get("/", (context) =>
    context.html(`
        <html>
            <h1>Hello world</h1>
        </html>
    `),
)

export default serve(app)

Options

overrideGlobalObjects

default: true

Allows override of default Response and Request object. This is where the magic happens and allows this adapter to work faster than default Response and Request objects.

Middleware

Middleware that works for Hono will work with this middleware.

Static Middleware

Use the packaged serveStatic middleware to serve static files. It's best illustrated with an example. If your folder structure looks like so:

.
├── src
│   └── main.js // Appwrite function entry
├── static
│   ├── 1.jpg
│   └── 2.html

Your serveStatic middleware would look like so:

import { serveStatic } from "@gravlabs/appwrite-hono-adapter-node/serveStatic"

app.use('/static/*', serveStatic({ root: './' }))

And with your folder structure looking like so:

.
└─ src
   ├─ main.js // Appwrite function entry
   └─ static
     ├─ 1.jpg
     └─ 2.html

Your serveStatic middleware would look like so:

import { serveStatic } from "@gravlabs/appwrite-hono-adapter-node/serveStatic"

app.use('/static/*', serveStatic({ root: './src' }))

Astro Middleware Example

It's really convenient to create an Astro static site with just Appwrite functions:

1. Set up the Adapter

Add the adapter to your astro.config.mjs file.

import { defineConfig } from "astro/config"
import honoAstro from "hono-astro-adapter"

// https://astro.build/config
export default defineConfig({
	output: "server", // or hybrid if you want to use SSR and SSG
	adapter: honoAstro(),
})

2. Build your project

Build your project using the astro build command.

3. Import and set up your Appwrite hook

import { Hono } from "hono";
import { serve } from "@gravlabs/appwrite-hono-adapter-node"
import { serveStatic } from "@gravlabs/appwrite-hono-adapter-node/serveStatic"
import { handler as ssrHandler } from "./dist/server/entry.mjs"

const app = new Hono()

app.use("/*", serveStatic({ root: "./dist/client/" }))
app.use(ssrHandler)

export default serve(app)

Typings

You can use the log and error functions from the runtime, as well as have access to the original req and res by accessing the context.env in Hono. You can access the types from

import type { AppwriteBindings } from '@gravlabs/appwrite-hono-adapter-node/types'

Requirements

Pleae check out which context methods you can use and then install the appropriate version.

Supported Appwrite Function API

| Version | Supports | Doesn't Support | | --- | --- | --- | | < 1.0.0 | res.send() res.json() res.empty() res.redirect() | res.binary() res.start() res.writeText() res.writeJson() res.writeBinary() res.end() | >=1.0.0 \|\| < 2.0.0 | res.send() res.text() res.json() res.empty() res.redirect() res.binary() | res.start() res.writeText() res.writeJson() res.writeBinary() res.end() | >=2.0.0 | res.send() res.text() res.json() res.empty() res.redirect() res.binary() res.start() res.writeText() res.writeJson() res.writeBinary() res.end() |

License

MIT