A high-performance V language web framework inspired by Hono.js.
- 🚀 High Performance - Hybrid routing with LRU cache for optimal speed
- 🎯 Simple API - Clean and intuitive API design
- 🔧 Flexible Routing - Multiple router implementations (FastRouter, TrieRouter, HybridRouter)
- 🌐 Multiple Backends - Picoev and uSockets support
- 🔌 Modular Design - Optional plugins for extended functionality
v install --git https://github.com/v-hono/v-hono-coreimport net.http
import hono
fn main() {
mut app := hono.Hono.new()
app.get('/', fn (mut c hono.Context) http.Response {
return c.text('Hello, World!')
})
app.get('/users/:id', fn (mut c hono.Context) http.Response {
user_id := c.params['id'] or { 'unknown' }
return c.json('{"user_id": "${user_id}"}')
})
app.listen(':3000')
}v-hono-core with uSockets backend supports 10,000+ concurrent connections out of the box.
import hono
fn main() {
mut app := hono.Hono.new()
app.get('/', fn (mut c hono.Context) http.Response {
return c.text('Hello, World!')
})
// Use uSockets backend for high concurrency
app.listen_usockets(3000)
}Build with uSockets:
# macOS / Linux
v -enable-globals -prod -o app your_app.v
# Windows (must use gcc)
v -enable-globals -cc gcc -ldflags "-ldbghelp" -o app.exe your_app.vHono.new()- Create a new applicationapp.get(path, handler)- Register GET routeapp.post(path, handler)- Register POST routeapp.put(path, handler)- Register PUT routeapp.delete(path, handler)- Register DELETE routeapp.patch(path, handler)- Register PATCH routeapp.all(path, handler)- Register route for all methodsapp.use(middleware)- Add middlewareapp.route(prefix, subapp)- Mount sub-applicationapp.listen(port)- Start server with picoevapp.listen_usockets(port)- Start server with uSockets
c.text(data)- Return text responsec.json(data)- Return JSON responsec.html(data)- Return HTML responsec.file(path)- Return file responsec.redirect(url, status...)- Redirect to URLc.status(code)- Set response status codec.params- Route parametersc.query- Query parametersc.body- Request bodyc.headers- Response headersc.set(key, value)- Store data in contextc.get(key)- Retrieve data from context
Extend v-hono-core with additional functionality:
Authentication and authorization
- JWT authentication
- Bearer token auth
- User session management
- Role-based permissions
Common middleware collection
- CORS
- Cookie management
- Request compression
- Rate limiting
- Request validation
- Logging
Static file serving
File upload and storage handling
- Multipart form parsing
- Chunked uploads
- File storage system (SQLite)
Real-time communication
- WebSocket support
- Server-Sent Events (SSE)
- Streaming responses
API documentation
- OpenAPI 3.0/3.1
- Swagger UI
| Concurrent | RPS | Avg Latency | Success Rate |
|---|---|---|---|
| 5,000 | 81,524 | 60.77ms | 100% |
| 6,000 | 56,290 | 98.46ms | 100% |
| 7,000 | 42,895 | 130.04ms | 100% |
| 10,000 | 24,198 | 240.90ms | 100% |
v-hono-core/ # Core framework
├── app.v # Application and routing
├── router.v # Hybrid router
├── fast_router.v # Fast precompiled router
├── trie_router.v # Trie-based router
├── cache.v # LRU cache
├── request.v # Request context
├── response.v # Response utilities
├── security.v # Security utilities
├── error_handler.v # Error handling
├── picoev_server.v # Picoev backend
├── usockets_server.v # uSockets backend
└── usockets/ # uSockets library
See the examples/ directory for more examples:
examples/basic/- Basic usageexamples/route_grouping/- Route grouping- Server backends (picoev, uSockets)
See docs/ directory for detailed documentation:
- High Concurrency Guide
- Project Overview (CN)
- Benchmark Results
- Route Grouping
- API Documentation Guide
MIT