What Web Framework Does the Akash Console API Use?

The Akash Console API uses Hono, a lightweight, high-performance TypeScript web framework optimized for edge runtimes and Node.js environments.

The Akash Console API serves as the backend for the Akash Network's decentralized cloud marketplace, handling deployment management, billing, and provider interactions. Understanding what web framework the Akash Console API uses is essential for developers contributing to the akash-network/console repository or building compatible integrations.

The Hono Web Framework

Hono is a small, fast, and portable web framework designed for native TypeScript and JavaScript runtimes. Unlike traditional Node.js frameworks that rely heavily on Node-specific APIs, Hono abstracts runtime differences to run seamlessly on Node.js, Cloudflare Workers, Deno, and Bun.

Key characteristics that make Hono suitable for the Akash Console API include:

  • Minimal overhead: Hono's router achieves near-native performance with zero dependencies
  • TypeScript-first: Full type safety across request contexts and middleware chains
  • Middleware composition: Elegant app.use() patterns for cross-cutting concerns like CORS, logging, and authentication
  • Edge compatibility: The same codebase can deploy to traditional servers or edge networks

How Akash Console API Implements Hono

The Akash Console API architecture centers on Hono's routing and middleware systems, organized across several key files in the apps/api/ directory.

Project Dependencies

The framework choice is declared in apps/api/package.json, which lists Hono as the core dependency alongside specialized Hono packages for OpenAPI documentation and Node.js server integration:

{
  "dependencies": {
    "hono": "^3.x",
    "@hono/node-server": "^1.x",
    "@hono/zod-openapi": "^0.x",
    "@hono/swagger-ui": "^0.x"
  }
}

These packages enable the API to generate OpenAPI specifications directly from Zod schemas and serve interactive Swagger documentation.

Application Entry Point

The main server initialization occurs in apps/api/src/rest-app.ts, where the top-level Hono instance is created and configured:

// src/rest-app.ts – the entry point for the API
import { Hono } from "hono";
import { cors } from "hono/cors";
import { swaggerUI } from "@hono/swagger-ui";
import { OpenApiDocsService } from "./core/services/openapi-docs/openapi-docs.service";

// Create the base Hono app
const app = new Hono<AppEnv>();

// Global middleware (CORS, logging, OpenTelemetry, etc.)
app.use("*", cors({ origin: "*" }));
app.use("*", HttpLoggerInterceptor);
app.use("*", otel());

// Register sub‑routers (each built with Hono/OpenAPIHono)
app.route("/api", apiRouter);
app.route("/dashboard", dashboardRouter);
app.route("/legacy", legacyRouter);

// Serve OpenAPI documentation at /docs
app.get("/docs", swaggerUI({ url: "/openapi.json" }));

// Start the server (Node.js mode via @hono/node-server)
await startServer(app);

This file demonstrates Hono's middleware composition pattern, where app.use() applies cross-cutting concerns globally, and app.route() mounts sub-routers for different API versions and functionalities.

Router Architecture

Individual route modules use Hono's router factory pattern. In apps/api/src/routers/apiRouter.ts, the API creates versioned routers using OpenAPIHono for automatic documentation generation:

// src/routers/apiRouter.ts
import { OpenAPIHono } from "@hono/zod-openapi";

const apiRouter = new OpenAPIHono<AppEnv>();

// Version 1 routes
apiRouter.route("/v1", v1Router);

// OpenAPI metadata
apiRouter.doc("/openapi.json", {
  openapi: "3.0.0",
  info: {
    title: "Akash Console API",
    version: "1.0.0"
  }
});

OpenAPI Integration

The Akash Console API leverages @hono/zod-openapi to maintain type safety and documentation in one place. The service in apps/api/src/core/services/open-api-hono-handler/open-api-hono-handler.ts wraps Hono's handlers to integrate Zod schema validation with OpenAPI spec generation, ensuring that every endpoint is automatically documented based on its TypeScript types.

Minimal Hono Server Example

For developers looking to understand the framework's basics, here is a minimal Hono server similar to the Akash Console API's core pattern:

import { Hono } from "hono";

const app = new Hono();

app.get("/", c => c.text("Akash Console API (Hono)"));
app.get("/healthz", c => c.json({ status: "ok" }));

export default app; // use @hono/node-server to run in Node

This example demonstrates Hono's concise API: create an app instance, register routes with HTTP methods, and return responses using the context object c.

Summary

  • The Akash Console API uses Hono, a TypeScript-first web framework optimized for edge runtimes and Node.js.
  • Key implementation files include apps/api/src/rest-app.ts for the main application setup and apps/api/src/routers/apiRouter.ts for route definitions.
  • The API leverages @hono/zod-openapi and @hono/swagger-ui for automatic OpenAPI documentation generation.
  • Hono's middleware system handles cross-cutting concerns like CORS, logging, and OpenTelemetry across all routes.

Frequently Asked Questions

Why did the Akash Console API choose Hono over Express.js?

The Akash Console API selected Hono for its superior performance characteristics and modern TypeScript support. Unlike Express, Hono provides zero-dependency routing with minimal overhead, native edge runtime compatibility, and built-in type safety for request contexts. This allows the API to deploy consistently across Node.js servers and edge networks while maintaining strict type checking across middleware chains.

Does Hono support OpenAPI and Swagger documentation?

Yes, Hono supports OpenAPI through the official @hono/zod-openapi package, which the Akash Console API uses extensively. This integration allows developers to define Zod schemas that simultaneously validate requests and generate OpenAPI specifications. The @hono/swagger-ui middleware then serves interactive documentation at designated endpoints, as implemented in apps/api/src/rest-app.ts with the swaggerUI function.

Can Hono run on traditional Node.js servers or only edge platforms?

Hono runs on both traditional Node.js servers and modern edge platforms. The Akash Console API uses @hono/node-server to adapt Hono's fetch-standard API to Node.js's native HTTP server, enabling deployment on standard VPS or containerized environments. Simultaneously, the same Hono code can deploy to Cloudflare Workers or Deno without modification, providing flexibility for future infrastructure changes.

How does middleware work in Hono compared to other frameworks?

Hono uses a standard middleware pattern similar to Express but with full TypeScript type preservation. Middleware functions receive a Context object containing the request, response, and typed environment variables, plus a Next function to continue the chain. In apps/api/src/rest-app.ts, global middleware like CORS and logging attach via app.use("*", handler), while route-specific middleware can attach to individual paths. This composition ensures type safety propagates through the entire request lifecycle.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →