How macgreene14/forest-fuel-finder works
Project type and purpose
• The Forest Fuel Finder is a frontend‐centric, full‐stack‐style web application built with Next.js (App Router) for server‐side rendering (SSR) and static generation (SSG).
• It displays USDA raster maps on a Mapbox map, providing interactive mapping, search/geocoding, and responsive styling via Tailwind CSS.
File structure
• Top‐level config files: next.config.js, tailwind.config.ts, postcss.config.js, tsconfig.json – indicate Next.js + Tailwind CSS build pipeline.
• src/app: Uses Next.js 13 App Router.
• app/page.tsx – root map view page.
• app/layout.tsx – global layout (includes navbar.jsx).
• app/components – React components: LogCam.jsx, iFly.js, iLegend.js for custom map overlays/legends.
• app/info/page.tsx – info sub‐page.
• globals.css – Tailwind imports and global styles.
• package.json & lock: Node/NPM dependency management.
• README.md: Confirms Mapbox + USDA raster integration, Vercel deployment.
README insights
• The app uses Mapbox SDK (client‐side JS) for interactive mapping and geocoding for search.
• USDA raster map tiles are overlaid via Mapbox raster source.
• Deployment target: Vercel (SSR, CDN for static assets).
Main components and their interactions
a. Components:
• Client (Browser) – renders UI, runs React/Mapbox JS.
• Next.js Server (Vercel) – SSR/SSG, serves HTML/CSS/JS, API Routes (if any).
• CDN (Vercel) – hosts static assets from /public and built JS/CSS bundles.
• Mapbox Service – Map rendering engine, Mapbox GL JS, geocoding API.
• USDA Raster Tile Server – external raster tile endpoint serving fuel data.
• Developer Toolchain – Node.js, NPM, ESLint, Tailwind/PostCSS (build‐time).
b. Interactions and data flow:
1. User → Next.js on Vercel: initial GET request for / or /info
2. Next.js (SSR/SSG) → CDN/HTML: returns pre‐rendered HTML + CSS (Tailwind) + JS bundle
3. Browser executes React hydration → interactive UI (navbar, map container)
4. Mapbox GL JS (in browser) → Mapbox API: fetch style, vector tiles, geocoding on search
5. Mapbox (via raster‐source config) → USDA Raster Server: fetch map tiles showing fuel data
6. Browser renders overlay, legends, custom components (LogCam, iFly, iLegend)
7. All static assets (images, CSS) are pulled from Vercel CDN
Architectural patterns and design principles
• Component‐based UI with React and Next.js App Router
• SSR/SSG hybrid: pages are either statically generated at build or rendered server‐side per request
• Separation of concerns:
• Routing & layout in Next.js (src/app)
• Presentation in React components
• Styling via Tailwind (utility‐first CSS)
• External integration pattern: abstract Mapbox & USDA tile source configuration into reusable components
Essential elements
• Clear component labels
• Call out key technologies on each component (Next.js, Tailwind, Mapbox GL JS, USDA Raster)