A production-ready, real-time Flight Tracking application built with Next.js 14, Tailwind CSS, and Google Cloud Run.
Live Demo: https://abhi-flight-tracker.com/
- 🌍 Live Flight Tracking: Real-time status, altitude, and speed data using the AviationStack API.
- 🛫 Airport Dashboard: Live Arrivals & Departures board for any airport code (e.g.,
JFK,LHR). - ⏱️ Smart Duration Logic: Custom engine that calculates flight duration by accounting for the precise Timezone Offsets of origin and destination, preventing confusing "12 hour" errors on 6 hour flights.
- 📅 US-Centric UI: Enforced
MM/DD/YYYYdate formats and specific timezone displays (e.g., "EDT", "GMT"). ✈️ Aircraft Imagery: Dynamic background images based on the specific aircraft model (787 Dreamliner, A380, etc.).
- Frontend: Next.js 14 (App Router), React Server Components
- Styling: Tailwind CSS, Lucide Icons
- Maps: React-Leaflet
- Infrastructure: Docker, Google Cloud Run (Serverless)
- API: AviationStack (Flight Data), Unsplash (Images)
- Node.js 18+
- AviationStack API Key
-
Clone the repository
git clone https://github.com/yourusername/flight-tracker.git cd flight-tracker -
Install dependencies
npm install # Note: Use `npm install --legacy-peer-deps` if you encounter react-leaflet issues -
Configure Environment Create a
.env.localfile:AVIATIONSTACK_API_KEY=your_api_key_here
-
Run Development Server
npm run dev
Open http://localhost:3000 with your browser.
The project is optimized for Google Cloud Run.
-
Build Container The included
Dockerfileis multi-stage and produces a standalone Next.js image (~100MB). -
Deploy Command
gcloud run deploy flight-tracker --source . --allow-unauthenticated
- Server-Side Proxy: All API requests are routed through Next.js API Routes (
/api/flights), keeping the API Key hidden from the client. - Log Redaction: Standardized logging middleware automatically redacts sensitive keys from server logs.
- Secret Management:
.envfiles are strictly excluded from version control.
This project uses Jest and React Testing Library.
# Run unit & integration tests
npm test
# Run tests in watch mode
npm run test:watchMIT