Giter VIP home page Giter VIP logo

google_clone's Introduction

Introduction

Since I already had experience with React.Js projects, I decided to get to know one of it's "meta frameworks", and coincidentally, I got a beginner-friendly free course on Udemy by Sahand Gavidel, where he guides through the fundamentals of Next.js with a hands-on approach. The course includes step-by-step instructions for building four clone projects, with one of them replicating the Google interface.

Google main page
See the details
Google web search loading Google image search loading Google web search results Google image searc results

⚠ It's important to state that some functionalities such as "Sign in", "Microphone input" and "Settings" were not implemented for now, since this application focus on its search functionality. However, I intend to implement some other functionalities.

Getting Started

To clone and run this project locally, firstly:

  1. Ensure you have Node.js installed, with a minimum version of 18.x or a later stable release;
  2. Get a free Google Custom Search API key;

    In order to identify your application client, you will:

  1. Get a Context Key;

    You will need to set up a Programming Search Engine. This means you will have to:

  1. Run the application

    In root folder, run the command:

       npm run dev
       # or
       yarn dev
       # or
       pnpm dev
       # or
       bun run dev
     

    Open http://localhost:3000 with your browser to see the result.

  1. Get API key for IP Localization (Optional)

    This clone gets the user IP address using just like Google and its sets the user's country in the footer. By default, it shows "United States".
    Sahand uses the free package of eXTReMe Geolocation. However, somehow it's not possible to create an account with a Gmail or Hotmail address.
    I could get the same result using ipgeolocation.

    • Create an account;
    • Once you've signed up/logged in, click on "Dashboard"
    • Generate your API Key and copy it
    • In your .env file, assign your ipgeolocation API key value to the corresponding environment variable;
      You can still name it however you would like, but since this component is rendered client side, the environment variable requires the NEXT_PUBLIC_ prefix.
              NEXT_PUBLIC_IP_API_KEY = # past you ipgeolocation key here
            

Development

Stack and Language Decision

Moreover, while Sahand instructs the project using JavaScript, I've chose deliberately to implement it using TypeScript. This decision not only eases the development process with enhanced type safety, but also aligns with the rising trend and widespread adoption of TypeScript in the developer community.
Also, it's worth noting that this project was built with Next.js 14, while Sahand utilized its earlier version in the course.

Styles, Icons and Formatting

To style the project, it was employed Tailwind CSS, a CSS framework which provides classes to style HTML elements, contributing to a more efficient development process.
Additionally, for the integration of icons, React Icons was employed—an extensive library featuring a diverse collection of icons to enhance the overall user experience.
In order to achieve the boldened search term in each result description, html-react-parser was employed, once Google search API brings a property called htmlSnippet for this purpose.

See the example below
Google API result showing htmlSnippet property Search term boldened

google_clone's People

Contributors

joao-lee avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.