Skip to content
/ r1ec-edge-hono Public template

An example on how to use HonoJs for R1EC

License

Notifications You must be signed in to change notification settings

amirparsadd/r1ec-edge-hono

Repository files navigation

r1ec-edge-hono

A minimal example showing how to deploy a Hono web app on ArvanCloud Edge Computing.

This project demonstrates how to build and bundle a Hono app and run it in Arvan's edge function environment using the r1ec CLI.


🌐 Features

  • ✅ Lightweight API using Hono (a super-fast edge framework)
  • 🚀 Deployable on ArvanCloud Edge Compute
  • 🔁 Portable to other edge platforms like Cloudflare Workers, Deno Deploy, Bun, etc.

🛠 Setup

1. Clone and install dependencies

git clone https://github.com/amirparsadd/r1ec-edge-hono.git
cd r1ec-edge-hono
npm install

2. Develop the API

The main logic lives in src/index.ts

3. Build for deployment

npm run build

This will generate a bundled dist/index.js using rollup, ready for edge deployment.

4. Deploy with ArvanCloud CLI

First, install and login to the CLI:

npm install -g r1ec
r1ec login -m YOUR_MACHINE_KEY

Then deploy:

r1ec deploy test -f dist/index.js

You'll receive a public edge URL in the panel.


🧪 Example API Call

curl https://test.amirparsab9.arvanedge.ir/

Response:

{ "message":"Hello World" }

🧠 How It Works

ArvanCloud Edge expects a JavaScript file that exports a fetch(request) handler. Hono supports this natively:

// Make it compatible with R1EC
export default {
  async fetch(request: Request) {
    return app.fetch(request)
  }
}

This wrapper allows Arvan to treat the Hono app as an Edge Function.


📚 References


📄 License

MIT

About

An example on how to use HonoJs for R1EC

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published