Route Groups & Basepath in Hono

From the Hono cheat sheet · Routing · verified Jul 2026

Route Groups & Basepath

Organize routes with grouping and base paths

typescript
// Basepath for entire app
const app = new Hono().basePath('/api/v1')

app.get('/users', (c) => c.json([])) // /api/v1/users
app.get('/posts', (c) => c.json([])) // /api/v1/posts

// Route grouping with sub-apps
const users = new Hono()
users.get('/', (c) => c.json([]))
users.get('/:id', (c) => c.json({}))
users.post('/', (c) => c.json({}, 201))

const posts = new Hono()
posts.get('/', (c) => c.json([]))

const app = new Hono()
app.route('/users', users)
app.route('/posts', posts)
💡 Use .basePath() to prefix all routes in an app
⚡ app.route(path, subApp) mounts sub-apps at a path
📌 Chain methods for proper RPC type inference
🎯 Export typeof app for type-safe RPC client

More Hono tasks

Back to the full Hono cheat sheet