Git Product home page Git Product logo

storchk / carlist Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 625 KB

The application is a frontend web platform that lists vehicles and provides detailed information about them. Users can view a listing page with vehicle tiles, initially displaying a limited number of vehicles to fit the screen. More vehicles are loaded as the user scrolls.

Shell 0.06% TypeScript 97.20% JavaScript 2.19% HTML 0.55%

carlist's Introduction

Carlist

tl;dr

The application is a frontend web platform that lists vehicles and provides detailed information about them. Users can view a listing page with vehicle tiles, initially displaying a limited number of vehicles to fit the screen. More vehicles are loaded as the user scrolls (lazy loading). The listing page supports filtering based on URL parameters.

Each vehicle tile on the listing page shows an image, make, model, mileage, first registration, fuel type, power, consumption, and CO2 emissions. Clicking on a vehicle tile opens a product page with additional details, including vehicle information and an image gallery.

Getting Started

This projects uses pnpm. It contains two application: backend and frontend

  • Install node modules for backend app: pnpm install:backend
  • Install node modules for frontend app: pnpm install:frontend
  • Start backend app: pnpm start:backend
  • Start frontend app: pnpm start:frontend

Frontend

The frontend app in the /frontend directory is a web application. It is responsible for rendering the user interface and communicating with the backend server through GraphQL queries. The app can be started by running pnpm start:frontend or npm run --prefix frontend dev after installing the necessary node modules with pnpm install:frontend or npm i --prefix frontend.

Tech Stack

Filter

Cars in the car list can be filtered using query parameters. For example, to filter by brand, you can add the brand parameter to the URL and set its value to the desired brand. For instance, to show only cars of the brand Audi, you can use the following URL:

?brand=audi

This will filter the car list to show only cars of the brand Audi. It's also possible to combine filter in the url

?brand=audi&color=red

This will filter the car list to show only cars of the brand Audi which are red.
You can filter the car list by the following properties:

  • brand
  • category
  • color
  • drivetrain.cc
  • drivetrain.consumption
  • drivetrain.fuel
  • drivetrain.transmissionType
  • id
  • model
  • performance
  • price.gross
  • technicalFeatures.drive
  • vehicleHistory.registrationDate
  • vehicleType.condition Use these properties to filter the car list according to your preferences.

Codegen

The frontend application leverages Codegen to automatically generate typed queries, interfaces, and hooks based on the GraphQL schema. This approach ensures type safety and enables seamless integration between the frontend and backend, enhancing the development process and reducing the potential for errors.

  • run backend application and execute pnpm run --prefix frontend codegen from project root to generate types and operations in /frontend/src/graphql/__genrated__

Backend

The backend app in the /backend directory is a Node.js application. It is responsible to serve extracted data from provided GraphQL Endpoint via GraphQL. The app acts as backend-for-frontend layer to collect data and provide a single endpoint to the frontend application. The app can be started by running pnpm start:backend or npm run --prefix backend dev after installing the necessary node modules with pnpm install:backend or npm i --prefix backend.

Tech Stack

GraphQL

Query to get cars:

query GetCars($limit: Int, $offset: Int) {
  cars(limit: $limit, offset: $offset) {
    total
    items {
      ... on Car {
        brand
        category
        color
        drivetrain {
          cc
          consumption
          fuel
          transmissionType
        }
        id
        media {
          url
        }
        model
        performance
        price {
          gross
        }
        technicalFeatures {
          drive
        }
        vehicleHistory {
          registrationDate
        }
        vehicleType {
          condition
        }
      }
    }
  }
}

Variables

{
  "limit": 10,
  "offset": 0,
}

Query to get a single car:

query Car($carId: String!) {
  car(id: $carId) {
    ... on Car {
      brand
      category
      color
      drivetrain {
        cc
        consumption
        fuel
        transmissionType
      }
      id
      media {
        url
      }
      model
      performance
      price {
        gross
      }
      technicalFeatures {
        drive
      }
      vehicleHistory {
        registrationDate
      }
      vehicleType {
        condition
      }
    }
  }
}

Variables

{
  "carId": "d5ae265a-5a44-5e4b-b25b-1b8825072e65",
}

CI

This application utilizes two workflows to validate the backend and frontend TypeScript code, as well as lint errors. These workflows ensure that both the backend and frontend apps are free from errors and adhere to linting standards.

carlist's People

Contributors

storchk 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.