Skip to content
Back to skills

Gee Api Routes

ASecurity

Server-side Earth Engine in Next.js API routes: init once, promisified evaluate, layers, palettes, tile URLs, validation, timeouts.

  • 8 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 19, 2026
developmentgonextjsapibackend

Works with

  • cli
  • api

Security analysis

A100/100

Scanned September 19, 2026

npx -y skills add Adilmunawar/ZD-claude-plugin --skill gee-api-routes --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Gee Api Routes?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Gee Api Routes
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/adilmunawar-gee-api-routes/badge)](https://www.skillsdirectory.com/skills/adilmunawar-gee-api-routes)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: gee-api-routes
paths: ["src/app/api/**", "src/lib/geeCore.ts"]
description: Server-side Earth Engine in Next.js API routes: init once, promisified evaluate, layers, palettes, tile URLs, validation, timeouts.
---

- **Init once.** `initGEE()` guards with a module-level flag; credentials from `EE_BASE64_KEY` (base64 JSON); normalise `private_key` newlines. No fallback credentials in code — throw a descriptive error instead.
- **Promisify.** `const evaluate = (o) => new Promise((res, rej) => o.evaluate((v, e) => e ? rej(e) : res(v)))`; run independent reductions with `Promise.all`.
- **Validate input.** Body must contain a GeoJSON geometry; reject > 5 MB or > 10 000 vertices (simplify client-side first). Cap `range` months and date spans.
- **Layers.** Build in `geeCore.ts`: S2 SR harmonized cloud-masked median, indices (NDVI NDMI NDRE EVI SAVI GNDVI NDTI MSAVI2 CIRE NDWI MNDWI BSI NDBI NBR NDCI NDSI), classification image, S1 VV/VH. Reuse the shared `visParams` table so palettes match the legend component.
- **Tiles.** `getMapUrl(image, vis)` → `ee.data.getMapId` → `{z}/{x}/{y}` template; cache per (layer, date range) for the request lifetime; tile URLs expire — do not persist them.
- **Reductions.** `scale: 10, maxPixels: 1e9, tileScale: 4+` for parcel-size geometries; `bestEffort` only for previews.
- **Errors.** Return `{ error }` with 400 for bad input, 502 for EE failures; log the EE message server-side only.
- **Timeouts.** App Hosting/Vercel functions have execution limits; long jobs go to the inference backend with a job id.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.