<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>grweb - 高性能 Rust Web 框架,Go 风格并发</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,400;14..32,500;14..32,600;14..32,700;14..32,800&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Inter', sans-serif;
background: linear-gradient(135deg, #0a0f1e 0%, #0f172a 100%);
color: #e2e8f0;
line-height: 1.6;
overflow: hidden;
height: 100vh;
}
.particles {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 0;
}
.particle {
position: absolute;
background: rgba(96, 165, 250, 0.3);
border-radius: 50%;
animation: float 20s infinite ease-in-out;
}
@keyframes float {
0%, 100% { transform: translateY(0) translateX(0); opacity: 0; }
10% { opacity: 0.5; }
90% { opacity: 0.5; }
100% { transform: translateY(-100px) translateX(50px); opacity: 0; }
}
.pages-container {
height: 100vh;
width: 100%;
overflow-y: scroll;
scroll-snap-type: y mandatory;
scroll-behavior: smooth;
position: relative;
z-index: 1;
}
.pages-container::-webkit-scrollbar {
display: none;
}
.pages-container {
-ms-overflow-style: none;
scrollbar-width: none;
}
.page {
height: 100vh;
width: 100%;
scroll-snap-align: start;
display: flex;
align-items: center;
justify-content: center;
position: relative;
overflow-y: auto;
}
.page-content {
max-width: 1280px;
width: 100%;
padding: 2rem;
animation: fadeInUp 0.8s ease;
}
.nav-indicator {
position: fixed;
right: 2rem;
top: 50%;
transform: translateY(-50%);
z-index: 100;
display: flex;
flex-direction: column;
gap: 1rem;
}
.nav-dot {
width: 10px;
height: 10px;
border-radius: 50%;
background: #475569;
cursor: pointer;
transition: all 0.3s ease;
}
.nav-dot.active {
background: #60a5fa;
transform: scale(1.5);
box-shadow: 0 0 10px rgba(96, 165, 250, 0.5);
}
.nav-dot:hover {
background: #94a3b8;
transform: scale(1.2);
}
.keyboard-hint {
position: fixed;
bottom: 2rem;
left: 50%;
transform: translateX(-50%);
background: rgba(30, 41, 59, 0.8);
backdrop-filter: blur(10px);
padding: 0.5rem 1rem;
border-radius: 30px;
font-size: 0.75rem;
color: #94a3b8;
z-index: 100;
display: flex;
gap: 1rem;
border: 1px solid rgba(100, 116, 139, 0.3);
}
.keyboard-hint span {
display: inline-flex;
align-items: center;
gap: 0.3rem;
}
.key {
background: #1e293b;
padding: 0.2rem 0.5rem;
border-radius: 6px;
font-family: monospace;
font-size: 0.7rem;
border: 1px solid #475569;
}
.navbar {
position: fixed;
top: 0;
left: 0;
right: 0;
padding: 1.5rem 2rem;
border-bottom: 1px solid rgba(100, 116, 139, 0.2);
backdrop-filter: blur(10px);
background: rgba(15, 23, 42, 0.8);
z-index: 100;
animation: slideDown 0.5s ease;
}
.nav-content {
max-width: 1280px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
font-size: 1.5rem;
font-weight: 700;
background: linear-gradient(135deg, #60a5fa, #a78bfa);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
animation: glow 3s ease-in-out infinite;
}
.github-link {
background: #334155;
padding: 0.5rem 1rem;
border-radius: 8px;
text-decoration: none;
color: #f1f5f9;
font-weight: 500;
transition: all 0.3s ease;
}
.github-link:hover {
background: #475569;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
}
@keyframes slideDown {
from { transform: translateY(-100%); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
@keyframes glow {
0%, 100% { opacity: 0.8; }
50% { opacity: 1; text-shadow: 0 0 10px rgba(96, 165, 250, 0.5); }
}
@keyframes fadeInUp {
from { opacity: 0; transform: translateY(30px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInScale {
from { opacity: 0; transform: scale(0.9); }
to { opacity: 1; transform: scale(1); }
}
.btn {
display: inline-block;
padding: 0.75rem 1.5rem;
border-radius: 8px;
font-weight: 600;
text-decoration: none;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
cursor: pointer;
}
.btn-primary {
background: linear-gradient(135deg, #3b82f6, #8b5cf6);
color: white;
border: none;
box-shadow: 0 4px 14px 0 rgba(59,130,246,0.4);
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px 0 rgba(59,130,246,0.6);
}
.btn-outline {
border: 1px solid #60a5fa;
color: #60a5fa;
background: transparent;
}
.btn-outline:hover {
background: rgba(96, 165, 250, 0.1);
transform: translateY(-1px);
}
.badge {
background: rgba(96, 165, 250, 0.2);
border: 1px solid #3b82f6;
padding: 0.25rem 0.75rem;
border-radius: 20px;
font-size: 0.85rem;
display: inline-block;
margin-bottom: 1rem;
animation: pulse 2s infinite;
}
@keyframes pulse {
0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
50% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
}
.hero h1 {
font-size: 3.5rem;
font-weight: 800;
background: linear-gradient(135deg, #fff, #94a3b8);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
margin-bottom: 1rem;
}
.hero .tagline {
font-size: 1.25rem;
color: #94a3b8;
margin-bottom: 2rem;
max-width: 700px;
margin-left: auto;
margin-right: auto;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 1.5rem;
margin: 3rem 0;
}
.stat-card {
background: rgba(30, 41, 59, 0.6);
backdrop-filter: blur(10px);
border: 1px solid rgba(100, 116, 139, 0.3);
border-radius: 16px;
padding: 1.5rem;
text-align: center;
transition: all 0.3s;
}
.stat-card:hover {
transform: translateY(-5px);
border-color: #60a5fa;
}
.stat-number {
font-size: 2.5rem;
font-weight: 800;
color: #60a5fa;
margin-bottom: 0.5rem;
}
.features-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 1.5rem;
margin-top: 2rem;
}
.feature-card {
background: rgba(30, 41, 59, 0.4);
border-radius: 16px;
padding: 1.5rem;
border: 1px solid rgba(100, 116, 139, 0.2);
transition: all 0.3s;
}
.feature-card:hover {
transform: translateY(-5px);
border-color: #60a5fa;
}
.feature-icon {
font-size: 2.5rem;
margin-bottom: 1rem;
}
.code-section {
background: linear-gradient(135deg, #0f172a, #1e293b);
border-radius: 16px;
padding: 1.5rem;
border: 1px solid #334155;
}
pre {
background: #0f172a;
padding: 1rem;
border-radius: 8px;
overflow-x: auto;
font-size: 0.8rem;
border-left: 3px solid #60a5fa;
}
code {
font-family: 'Monaco', monospace;
color: #a5f3fc;
}
.comparison-table {
width: 100%;
border-collapse: collapse;
background: rgba(30, 41, 59, 0.4);
border-radius: 12px;
overflow: hidden;
}
.comparison-table th,
.comparison-table td {
padding: 0.75rem;
text-align: left;
border-bottom: 1px solid #334155;
}
.highlight {
color: #60a5fa;
font-weight: 700;
}
.section-title {
font-size: 2rem;
font-weight: 700;
text-align: center;
margin-bottom: 2rem;
color: #f1f5f9;
}
.text-center { text-align: center; }
.mt-4 { margin-top: 2rem; }
.mb-4 { margin-bottom: 2rem; }
@media (max-width: 768px) {
.hero h1 { font-size: 2rem; }
.section-title { font-size: 1.5rem; }
.page-content { padding: 5rem 1rem 2rem; }
.nav-indicator { right: 1rem; }
}
</style>
</head>
<body>
<div class="particles" id="particles"></div>
<nav class="navbar">
<div class="nav-content">
<div class="logo">⚡ grweb</div>
<a href="https://github.com/WLmutou/grweb" class="github-link" target="_blank">GitHub ↗</a>
</div>
</nav>
<div class="nav-indicator" id="navIndicator"></div>
<div class="keyboard-hint">
<span>⬅️ <span class="key">←</span> / <span class="key">↑</span></span>
<span>➡️ <span class="key">→</span> / <span class="key">↓</span></span>
<span>滑动鼠标滚轮</span>
</div>
<div class="pages-container" id="pagesContainer">
<div class="page" data-page="0">
<div class="page-content">
<div class="hero text-center">
<div class="badge">✨ v0.1.0 正式发布</div>
<h1>grweb: <br> Go 风格并发,Rust 极致性能</h1>
<p class="tagline">
一个轻量级、高性能的 Web 框架,将 Go 语言的并发模型与 Rust 的零成本抽象完美结合。
体验 M:N 协程调度带来的极致性能。
</p>
<div style="display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap;">
<a href="https://github.com/WLmutou/grweb" class="btn btn-primary">⭐ GitHub 仓库</a>
<a href="https://crates.io/crates/grweb" class="btn btn-outline">📦 crates.io</a>
<a href="#" class="btn btn-outline">📖 文档</a>
</div>
</div>
<div class="stats-grid">
<div class="stat-card">
<div class="stat-number" data-target="110038">0</div>
<div class="stat-label">QPS</div>
<div class="stat-unit">requests/sec</div>
</div>
<div class="stat-card">
<div class="stat-number" data-target="124">0</div>
<div class="stat-label">延迟 (平均)</div>
<div class="stat-unit">microseconds</div>
</div>
<div class="stat-card">
<div class="stat-number" data-target="483">0</div>
<div class="stat-label">吞吐量</div>
<div class="stat-unit">MB/s</div>
</div>
<div class="stat-card">
<div class="stat-number" data-target="99">0</div>
<div class="stat-label">稳定度</div>
<div class="stat-unit">高负载下</div>
</div>
</div>
<p class="text-center" style="font-size: 0.85rem; color: #64748b;">
* 测试环境: 4 线程, 100 连接, wrk 压测, 响应大小约 4.3KB (Keep-Alive 开启)
</p>
</div>
</div>
<div class="page" data-page="1">
<div class="page-content">
<h2 class="section-title">为什么选择 grweb?</h2>
<div class="features-grid">
<div class="feature-card">
<div class="feature-icon">⚡</div>
<div class="feature-title">110k QPS 真实性能</div>
<div>实测超越 Tokio/hyper,吞吐量碾压 Go/Java/Node.js。</div>
</div>
<div class="feature-card">
<div class="feature-icon">🎯</div>
<div class="feature-title">M:N 协程调度</div>
<div>用户态轻量级任务,工作窃取算法实现自动负载均衡。</div>
</div>
<div class="feature-card">
<div class="feature-icon">🔗</div>
<div class="feature-title">Channel 通信</div>
<div>类 Go 的 channel,安全高效的协程间消息传递。</div>
</div>
<div class="feature-card">
<div class="feature-icon">💾</div>
<div class="feature-title">极低内存占用</div>
<div>基础运行时内存仅 ~3MB,适合容器化部署。</div>
</div>
<div class="feature-card">
<div class="feature-icon">🔁</div>
<div class="feature-title">HTTP Keep-Alive</div>
<div>连接复用,吞吐量提升 6 倍,减少 TCP 握手开销。</div>
</div>
<div class="feature-card">
<div class="feature-icon">🦀</div>
<div class="feature-title">100% Rust</div>
<div>内存安全,零成本抽象,无畏并发。</div>
</div>
</div>
</div>
</div>
<div class="page" data-page="2">
<div class="page-content">
<h2 class="section-title">📄 代码示例</h2>
<div class="code-section">
<pre><code>use grweb::{Server, Router, Response};
fn main() {
let mut router = Router::new();
router.get("/", |_| {
Response::html("<h1>Hello grweb!</h1><p>高性能 Web 框架</p>")
});
router.get("/hello/:name", |ctx| {
let name = ctx.param("name").unwrap_or("World");
Response::json(&format!(r#"{{"message": "Hello, {}!"}}"#, name))
});
Server::new(router).run(":8080").unwrap();
}</code></pre>
<div class="text-center mt-4">
<a href="https://github.com/WLmutou/grweb/tree/main/examples" class="btn btn-outline">查看完整示例 →</a>
</div>
</div>
</div>
</div>
<div class="page" data-page="3">
<div class="page-content">
<h2 class="section-title">与世界主流框架对比</h2>
<table class="comparison-table">
<thead>
<tr><th>框架</th><th>QPS</th><th>平均延迟</th><th>吞吐量</th><th>内存占用</th></tr>
</thead>
<tbody>
<tr><td class="highlight">✨ grweb</td><td class="highlight">110,038</td><td class="highlight">1.24 ms</td><td class="highlight">483 MB/s</td><td class="highlight">~3 MB</td></tr>
<tr><td>Rust (Actix-Web)</td><td>~100,000</td><td>~1.50 ms</td><td>~100 MB/s</td><td>~8 MB</td></tr>
<tr><td>Go (net/http)</td><td>~48,000</td><td>~2.50 ms</td><td>~50 MB/s</td><td>~25 MB</td></tr>
<tr><td>Java (Spring Boot)</td><td>~38,000</td><td>~3.50 ms</td><td>~40 MB/s</td><td>~150 MB</td></tr>
<tr><td>Node.js (Express)</td><td>~18,000</td><td>~8.00 ms</td><td>~20 MB/s</td><td>~50 MB</td></tr>
</tbody>
</table>
<p class="text-center" style="font-size: 0.8rem; margin-top: 1rem;">* 数据基于相同硬件环境测试,grweb 开启 Keep-Alive</p>
</div>
</div>
<div class="page" data-page="4">
<div class="page-content">
<h2 class="section-title">🚀 快速开始</h2>
<div class="code-section">
<pre><code># 添加依赖
cargo add grweb
# 创建项目
cargo new my_grweb_app
cd my_grweb_app
# 运行示例
cargo run --example simple_server</code></pre>
<div class="text-center mt-4" style="display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap;">
<a href="https://github.com/WLmutou/grweb" class="btn btn-primary">GitHub 仓库</a>
<a href="#" class="btn btn-outline">📚 阅读文档</a>
<a href="#" class="btn btn-outline">🐛 报告问题</a>
</div>
</div>
<div class="text-center mt-4">
<p style="color: #64748b;">❤️ 用 Rust 实现 Go 的并发梦想 | grweb - 开源 · 高性能 · 现代化</p>
<p style="margin-top: 1rem; font-size: 0.8rem;">⭐ 如果喜欢这个项目,欢迎给个 Star!</p>
</div>
</div>
</div>
</div>
<script>
function createParticles() {
const container = document.getElementById('particles');
for (let i = 0; i < 50; i++) {
const particle = document.createElement('div');
particle.className = 'particle';
const size = Math.random() * 4 + 1;
particle.style.width = `${size}px`;
particle.style.height = `${size}px`;
particle.style.left = `${Math.random() * 100}%`;
particle.style.animationDelay = `${Math.random() * 20}s`;
particle.style.animationDuration = `${15 + Math.random() * 10}s`;
container.appendChild(particle);
}
}
function animateNumber(element, target) {
let current = 0;
const increment = target / 50;
const timer = setInterval(() => {
current += increment;
if (current >= target) {
element.textContent = target;
clearInterval(timer);
} else {
element.textContent = Math.floor(current);
}
}, 16);
}
let numbersAnimated = false;
function checkAndAnimateNumbers() {
if (numbersAnimated) return;
const firstPage = document.querySelector('.page[data-page="0"]');
if (firstPage && isElementInViewport(firstPage)) {
const statNumbers = document.querySelectorAll('.stat-number');
statNumbers.forEach(num => {
const target = parseInt(num.dataset.target);
if (target && num.textContent === '0') {
animateNumber(num, target);
}
});
numbersAnimated = true;
}
}
function isElementInViewport(el) {
const rect = el.getBoundingClientRect();
return rect.top >= 0 && rect.top < window.innerHeight;
}
const container = document.getElementById('pagesContainer');
const pages = document.querySelectorAll('.page');
const totalPages = pages.length;
let currentPage = 0;
function createNavDots() {
const indicator = document.getElementById('navIndicator');
indicator.innerHTML = '';
for (let i = 0; i < totalPages; i++) {
const dot = document.createElement('div');
dot.className = 'nav-dot';
if (i === currentPage) dot.classList.add('active');
dot.addEventListener('click', () => goToPage(i));
indicator.appendChild(dot);
}
}
function updateNavDots() {
const dots = document.querySelectorAll('.nav-dot');
dots.forEach((dot, idx) => {
if (idx === currentPage) dot.classList.add('active');
else dot.classList.remove('active');
});
}
function goToPage(pageIndex) {
if (pageIndex < 0 || pageIndex >= totalPages) return;
currentPage = pageIndex;
const targetPage = pages[currentPage];
targetPage.scrollIntoView({ behavior: 'smooth', block: 'start' });
updateNavDots();
}
function handleKeydown(e) {
if (e.key === 'ArrowDown' || e.key === 'ArrowRight') {
e.preventDefault();
goToPage(currentPage + 1);
} else if (e.key === 'ArrowUp' || e.key === 'ArrowLeft') {
e.preventDefault();
goToPage(currentPage - 1);
}
}
function updateCurrentPageOnScroll() {
let bestMatch = 0;
let bestDistance = Infinity;
pages.forEach((page, idx) => {
const rect = page.getBoundingClientRect();
const distance = Math.abs(rect.top);
if (distance < bestDistance) {
bestDistance = distance;
bestMatch = idx;
}
});
if (bestMatch !== currentPage) {
currentPage = bestMatch;
updateNavDots();
checkAndAnimateNumbers();
}
}
window.addEventListener('load', () => {
createParticles();
createNavDots();
checkAndAnimateNumbers();
container.addEventListener('scroll', updateCurrentPageOnScroll);
window.addEventListener('keydown', handleKeydown);
setTimeout(checkAndAnimateNumbers, 500);
setTimeout(checkAndAnimateNumbers, 1000);
});
</script>
</body>
</html>