commit 4c63fa5b8b00ab87a8bfd963cb62c4df7031912c Author: blazblue547-afk Date: Sat Jun 13 18:16:39 2026 -0400 NEONEX v4 — Netlify-ready vaporwave search engine diff --git a/README.md b/README.md new file mode 100644 index 0000000..5579eb1 --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +# NEONEX — Vaporwave Search Engine (Netlify Edition) + +Fully self-contained vaporwave search engine powered by Brave Search API. +Works on both **localhost** (Python proxy) and **Netlify** (serverless function). + +``` +neonex-netlify/ +├── index.html ← The search engine +├── netlify.toml ← Netlify config (functions, redirects) +└── netlify/ + └── functions/ + └── search.js ← Serverless search proxy +``` + +## 🚀 Deploy to Netlify + +### 1. Push to GitHub +```bash +cd neonex-netlify +git init +git add -A +git commit -m "NEONEX v4 — Netlify-ready" +git remote add origin git@github.com:YOUR_USER/neonex.git +git push -u origin main +``` + +### 2. Connect Netlify +- Go to https://app.netlify.com +- "Add new site" → "Import an existing project" → Connect GitHub +- Select the repo, leave build settings as-is (no build step) + +### 3. Set API Key +In Netlify dashboard: +- **Site Settings → Environment variables** +- Add: `BRAVE_API_KEY` = `BSAljOHalG4Fb3svssjzzzPWqaOfz_ _` +- Redeploy (Deploys → Trigger deploy) + +### 4. Done +Open your `.netlify.app` URL and search the grid. + +## 🖥️ Local Development +```bash +cd ~/neonex-netlify +python3 ../neonex-proxy.py # Start the proxy +# Open http://localhost:8777 in browser +``` + +Or use Netlify CLI: +```bash +netlify dev # Runs function + static site locally +``` + +## 🔑 How It Works + +The HTML auto-detects where it's running: + +| Environment | Search endpoint | API key source | +|----------------|--------------------------------------|---------------------| +| `localhost` | Local Python proxy (port 8777) | localStorage or env | +| Netlify | `/.netlify/functions/search` | `BRAVE_API_KEY` env | +| Fallback | Direct Brave API | localStorage key | diff --git a/index.html b/index.html new file mode 100644 index 0000000..95f2087 --- /dev/null +++ b/index.html @@ -0,0 +1,720 @@ + + + + + +NEONEX — Search the Grid + + + + +
+
+
+
+
+
+
+
+ +
+
+ +

NEONEX

+

S E A R C H _ T H E _ G R I D

+
+ +
+ + + + +
+ +
+ + + +
+
+
+
+ +
+ + GRID ONLINE + ∥ + 00:00:00 + ∥ + SYS v4.0.0 +
+
+ + + + diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 0000000..dbeca27 --- /dev/null +++ b/netlify.toml @@ -0,0 +1,25 @@ +[build] + # Static site — no build step needed + publish = "." + +[functions] + directory = "netlify/functions" + +# /search → serverless function (query params pass through automatically) +[[redirects]] + from = "/search" + to = "/.netlify/functions/search" + status = 200 + +# SPA fallback — serve index.html for everything else +[[redirects]] + from = "/*" + to = "/index.html" + status = 200 + +# Optional: custom headers for security +[[headers]] + for = "/*" + [headers.values] + X-Frame-Options = "DENY" + X-Content-Type-Options = "nosniff" diff --git a/netlify/functions/search.js b/netlify/functions/search.js new file mode 100644 index 0000000..760ceb1 --- /dev/null +++ b/netlify/functions/search.js @@ -0,0 +1,77 @@ +// NEONEX Search — Netlify serverless function +// Proxies search requests to Brave Search API server-side. +// +// Deploy: +// 1. Push to GitHub, connect to Netlify +// 2. Set env var: BRAVE_API_KEY in Netlify dashboard (Site Settings → Environment) +// 3. Trigger deploy +// +// Local dev: npx netlify-cli dev + +exports.handler = async (event) => { + const headers = { + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Headers": "Content-Type", + "Content-Type": "application/json", + }; + + // CORS preflight + if (event.httpMethod === "OPTIONS") { + return { statusCode: 204, headers, body: "" }; + } + + const query = event.queryStringParameters?.q; + const count = event.queryStringParameters?.count || "12"; + + if (!query) { + return { + statusCode: 400, + headers, + body: JSON.stringify({ error: "Missing ?q= parameter" }), + }; + } + + const apiKey = process.env.BRAVE_API_KEY; + if (!apiKey) { + return { + statusCode: 401, + headers, + body: JSON.stringify({ error: "BRAVE_API_KEY not set in Netlify environment variables" }), + }; + } + + const braveUrl = `https://api.search.brave.com/res/v1/web/search?q=${encodeURIComponent(query)}&count=${count}`; + + try { + // Node 18+ has global fetch built in + const braveRes = await fetch(braveUrl, { + headers: { + "Accept": "application/json", + "X-Subscription-Token": apiKey, + }, + }); + + const data = await braveRes.json(); + + if (!braveRes.ok) { + return { + statusCode: braveRes.status, + headers, + body: JSON.stringify({ error: `Brave API error ${braveRes.status}: ${JSON.stringify(data)}` }), + }; + } + + return { + statusCode: 200, + headers, + body: JSON.stringify(data), + }; + } catch (err) { + return { + statusCode: 500, + headers, + body: JSON.stringify({ error: `Search request failed: ${err.message}` }), + }; + } +};