Skip to content

Metro Station Finder is a Next.js application that helps users locate the nearest metro station in Dhaka city, Bangladesh.

Notifications You must be signed in to change notification settings

tashfiqul-islam/metro-station-finder

Repository files navigation

Metro-Banner

Metro Station Finder - WIP

Metro Station Version Deployment Passing Lint Passing Code Style Prettier wakatime


πŸš‡ Introduction

Finding the closest metro station in Dhaka was a real headache. Every time someone asked, "Where's the nearest metro station to where I'm going?" I had to dig through maps, trying to figure it out. It was a slow and annoying process because Google Maps still needed to show metro stations. That's when I thought of a better way. I created the Metro Station Finder, a simple app made with Next.js. It makes my life easier by quickly showing the closest metro station and how far it is just by entering a location. No more map headaches!


✨ Features

  • Search functionality to input a location.
  • Interactive map view to display user's location and nearest metro station.
  • Distance calculation from the user's location to the nearest metro station.
  • Fare calculation between two stations.

πŸ’» Tech Stack

Next.js React Tailwind CSS Google Maps API TypeScript


Hosted with GitHub Pages

GitHub Pages


Usage

Enter a location in the search bar and click the 'Search' button. The map will update to show your location and the nearest metro station, along with the distance to it.

Metro-Banner

Getting Started

Prerequisites

Node.js npm

P.S. This is what I had installed while working on this.

Project Directory Structure

metro-station-finder/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ CustomDropdown.tsx // Custom component for the dropdown on route fare.
β”‚   β”‚   β”œβ”€β”€ Layout.tsx // Header and footer component for the website.
β”‚   β”‚   β”œβ”€β”€ mapview.tsx // Component for displaying the map view.
β”‚   β”‚   β”œβ”€β”€ metroInfoCard.tsx // Component for displaying metro station info card.
β”‚   β”‚   β”œβ”€β”€ NavBar.tsx // Nav bar design for the website.
β”‚   β”‚   β”œβ”€β”€ Searchbar.tsx // Component for the search bar.
β”‚
β”œβ”€β”€ pages/
β”‚   β”œβ”€β”€ _app.tsx // Main Next.js application component.
β”‚   β”œβ”€β”€ index.tsx // Homepage of the application.
β”‚   β”œβ”€β”€ route-fare.tsx // Route fare page layout.
β”‚
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ fareCalculation.ts // Service for fetching route fare data.
β”‚   β”œβ”€β”€ metroService.ts // Service for fetching metro station data.
β”‚
β”œβ”€β”€ styles/
β”‚   β”œβ”€β”€ globals.css // Global CSS styles.
β”‚
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ constants.ts // Metro stations map location.
β”‚   β”œβ”€β”€ loadGoogleMapScript.ts // Utility for loading Google Maps scripts.

Installation

  1. Clone the repository:
    git clone https://github.com/tashfiqul-islam/metro-station-finder.git
  2. Navigate to the project directory:
    cd metro-station-finder
  3. Install dependencies:
    npm install
  4. Set up the environment variables:
    Create a .env.local file in the root directory and add your Google Maps API key:
    NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=your_api_key

Running the Application

  1. To start the development server, run:

  2. npm run dev
  3. Navigate to http://localhost:3000 to view the application.


πŸ‘ Credits


Contributing

Contributions to the Metro Station Finder are welcome. Please reach out to me if you've more ideas for this.


πŸ“œ License

Licensed under the MIT License.
Feel free to use and modify as you like.


This project was a learning journey, crafted with ❀️ by Tashfiq.
A stepping stone in my ongoing quest to become a Programming Ninja!

🌟 Follow me on GitHub β€” I promise, my future projects will only have slightly fewer bugs! πŸ›