/**
* Clean Modern Website - Cloudflare Worker
* A beautiful, responsive, single-page site with dark mode support
*/
export default {
async fetch(request, env, ctx) {
const url = new URL(request.url);
// Optional: Serve different content based on path (e.g., /about)
if (url.pathname === "/about") {
return new Response(`
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>About</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-zinc-950 text-zinc-200">
<div class="max-w-2xl mx-auto px-6 py-24">
<h1 class="text-5xl font-bold mb-6">About Us</h1>
<p class="text-zinc-400 text-lg">This is a simple about page served by a Cloudflare Worker.</p>
<a href="/" class="mt-8 inline-block text-blue-400 hover:text-blue-300">← Back to Home</a>
</div>
</body>
</html>
`, {
headers: { "Content-Type": "text/html;charset=UTF-8" }
});
}
// Main homepage
return new Response(`
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Neon • Clean</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Space+Grotesk:wght@500;600&display=swap');
body {
font-family: 'Inter', system_ui, sans-serif;
}
.heading {
font-family: 'Space Grotesk', sans-serif;
}
.hero-bg {
background: linear-gradient(135deg, #18181b 0%, #27272a 100%);
}
</style>
</head>
<body class="bg-zinc-950 text-zinc-200 overflow-x-hidden">
<!-- Navigation -->
<nav class="border-b border-zinc-800 bg-zinc-950/80 backdrop-blur-md fixed w-full z-50">
<div class="max-w-screen-xl mx-auto px-6 py-5 flex items-center justify-between">
<div class="flex items-center gap-3">
<div class="w-8 h-8 bg-gradient-to-br from-violet-500 to-fuchsia-500 rounded-2xl flex items-center justify-center text-white font-bold text-xl">N</div>
<span class="heading text-2xl font-semibold tracking-tight">Neon</span>
</div>
<div class="hidden md:flex items-center gap-8 text-sm font-medium">
<a href="#" onclick="document.getElementById('features').scrollIntoView({behavior: 'smooth'})" class="hover:text-white transition-colors">Features</a>
<a href="#" onclick="document.getElementById('about').scrollIntoView({behavior: 'smooth'})" class="hover:text-white transition-colors">About</a>
<a href="/about" class="hover:text-white transition-colors">Blog</a>
</div>
<button onclick="alert('Thank you for visiting! 🚀 (This is a demo)')"
class="px-6 py-2.5 bg-white text-zinc-900 rounded-2xl font-semibold text-sm hover:bg-zinc-200 transition-all active:scale-95">
Get Started
</button>
</div>
</nav>
<!-- Hero Section -->
<section class="hero-bg min-h-screen flex items-center pt-20">
<div class="max-w-screen-xl mx-auto px-6 py-24 grid md:grid-cols-2 gap-16 items-center">
<div class="space-y-8">
<div class="inline-flex items-center gap-2 px-4 py-2 bg-zinc-900 rounded-3xl text-sm border border-zinc-700">
<span class="relative flex h-3 w-3">
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"></span>
<span class="relative inline-flex rounded-full h-3 w-3 bg-emerald-500"></span>
</span>
Now faster than ever
</div>
<h1 class="heading text-7xl md:text-8xl font-semibold tracking-tighter leading-none">
Clean.<br>Fast.<br>Yours.
</h1>
<p class="text-xl text-zinc-400 max-w-lg">
A beautifully minimal website served instantly from the edge with Cloudflare Workers.
</p>
<div class="flex flex-wrap gap-4">
<button onclick="window.scrollTo({top: document.getElementById('features').offsetTop - 80, behavior: 'smooth'})"
class="px-8 py-4 bg-white text-black rounded-3xl font-semibold flex items-center gap-3 hover:bg-zinc-100 transition-all">
Explore the site
<i class="fas fa-arrow-down"></i>
</button>
<button onclick="alert('Demo: This would open a live preview in a real app')"
class="px-8 py-4 border border-zinc-700 hover:border-zinc-400 rounded-3xl font-medium transition-all">
Watch 18s demo
</button>
</div>
<div class="flex items-center gap-8 text-sm text-zinc-500 pt-6">
<div>✓ Blazing fast</div>
<div>✓ Zero config</div>
<div>✓ Global edge</div>
</div>
</div>
<div class="relative hidden md:block">
<div class="absolute -inset-20 bg-gradient-to-br from-violet-500/20 via-fuchsia-500/20 to-transparent rounded-[4rem] blur-3xl"></div>
<div class="bg-zinc-900 border border-zinc-700 rounded-3xl overflow-hidden shadow-2xl">
<div class="h-11 bg-zinc-950 border-b border-zinc-800 flex items-center px-4 gap-2">
<div class="w-3 h-3 rounded-full bg-red-500"></div>
<div class="w-3 h-3 rounded-full bg-yellow-500"></div>
<div class="w-3 h-3 rounded-full bg-emerald-500"></div>
</div>
<div class="p-8 bg-zinc-950 text-center">
<div class="mx-auto w-24 h-24 bg-gradient-to-br from-violet-400 to-fuchsia-400 rounded-2xl flex items-center justify-center mb-6">
<span class="text-6xl">✦</span>
</div>
<p class="text-zinc-400">Your clean website is live on Cloudflare</p>
</div>
</div>
</div>
</div>
</section>
<!-- Features -->
<section id="features" class="py-24 border-t border-zinc-800">
<div class="max-w-screen-xl mx-auto px-6">
<div class="text-center mb-16">
<span class="text-sm uppercase tracking-widest text-zinc-500 font-medium">Why this works</span>
<h2 class="heading text-5xl font-semibold mt-3">Simple. Powerful. Edge-native.</h2>
</div>
<div class="grid md:grid-cols-3 gap-8">
<div class="bg-zinc-900 p-8 rounded-3xl border border-zinc-800 hover:border-zinc-600 transition-colors group">
<div class="w-12 h-12 bg-violet-500/10 text-violet-400 rounded-2xl flex items-center justify-center mb-6 group-hover:scale-110 transition-transform">
<i class="fas fa-bolt text-2xl"></i>
</div>
<h3 class="text-2xl font-semibold mb-3">Lightning Fast</h3>
<p class="text-zinc-400">Served from 300+ cities worldwide. Sub-50ms response times guaranteed.</p>
</div>
<div class="bg-zinc-900 p-8 rounded-3xl border border-zinc-800 hover:border-zinc-600 transition-colors group">
<div class="w-12 h-12 bg-fuchsia-500/10 text-fuchsia-400 rounded-2xl flex items-center justify-center mb-6 group-hover:scale-110 transition-transform">
<i class="fas fa-palette text-2xl"></i>
</div>
<h3 class="text-2xl font-semibold mb-3">Beautiful by Default</h3>
<p class="text-zinc-400">Modern design with dark mode, smooth animations, and perfect responsiveness.</p>
</div>
<div class="bg-zinc-900 p-8 rounded-3xl border border-zinc-800 hover:border-zinc-600 transition-colors group">
<div class="w-12 h-12 bg-emerald-500/10 text-emerald-400 rounded-2xl flex items-center justify-center mb-6 group-hover:scale-110 transition-transform">
<i class="fas fa-code text-2xl"></i>
</div>
<h3 class="text-2xl font-semibold mb-3">One File</h3>
<p class="text-zinc-400">Everything lives in a single Worker. No build step. Instant deploys.</p>
</div>
</div>
</div>
</section>
<!-- Footer -->
<footer class="border-t border-zinc-800 py-12 bg-zinc-950">
<div class="max-w-screen-xl mx-auto px-6 text-center text-zinc-500 text-sm">
<p>Made with ❤️ using Cloudflare Workers • Edit the code and run <code class="bg-zinc-900 px-2 py-1 rounded">npm run deploy</code></p>
<p class="mt-4">This entire website is generated dynamically by your Worker.</p>
</div>
</footer>
<script>
// Tailwind script already loaded via CDN
// You can add more interactivity here if needed
</script>
</body>
</html>
`, {
headers: {
"Content-Type": "text/html;charset=UTF-8",
"Cache-Control": "public, max-age=60" // Adjust as needed
}
});
}
};