Git Product home page Git Product logo

ghexplorer's Introduction

ATask Test

This is a Next.js project bootstrapped with create-next-app.

This project is a github search engine to search Github users based on their username keywords, Has the following features :

  • Search for github users by their username keywords
  • Showing public repository of a user
  • infinite scroll pagination for repositories

Overall Project decision explanation

  1. why i'm using pnpm, instead of other package manager, ?, it's about speed and disk efficiency, Reference, pnpm is the fastest even without lock file. Pnpm uses symlinks to add only the direct dependencies of the project into the root of the modules directory. Reference

  2. Why i use next/dynamic ? , i need to split the chunk file in an easy way. The JS file will be splitted into separate .js file based on route or component, this way can reduce total blocking time. you can interact with other component while waiting other huge size chunk file loaded.

  3. Why @motion/react instead of css ?, emotion has good specificity level, your style will specified only for the components and make your code modular. you can reuse the component anywhere without mixing style with other components. and the className will be generated by emotion, so the style will not mixed with other className that created by our self inside css file. And yes you can pass variable from component, state, or other variable that affect the styling. you can literally do javascript calculation with the style.

  4. Why graphql instead of regular rest api ?, In graphql you can pick what matter for UI to returned back in response. So, it makes the api call lighter and comsuming less internet data usage

  5. Infinite scroll pagination, you can see, if you have reach the bottom of content the browser will request for the next page, and so on. i prefer calculate scroll height and container height to decide either it has been reach bottom or not. In other way you can use Intersection Observer, but this way will not works in old version browser.

How to run in Development mode

please take a note, this project crafted with pnpm, so the module version locked with pnpm-lock.yml. To prevent unexpected error because different library version you've installed, i recommend to use pnpm or import the lock file to your prefered package manager

  1. Clone the repo
git clone https://github.com/mkhotib20/ghexplorer.git
  1. Copy .env.sample as .env.local, and input your prefered config
cp .env.sample .env.local
  1. Import dependency lock file to your prefered package manager (if you're using pnpm, skip this step), you can use Synp or other library to do it.
  2. Install dependencies
pnpm install
or
yarn install
or
npm install
  1. Run the apps in development mode
pnpm run dev
  1. open http://localhost:3000 in your browser

How to run in Production mode

i recommend to use docker for production mode, it's nearly zero config, you just need to copy the docker-compose.yml

  1. Run build command
pnpm run build
  1. Make sure you have pm2 installed on your server, or you can refer to this tutorial

  2. run pm2 with following command, you can modify the port and name for monitoring

pm2 start --name=ghxplorer npm -- start -- -p 3000
  1. You can use nginx so the apps can be accessible from public network, you can refer to following minimal nginx config to make this app run on example.com domain
server {
  server_name example.com www.example.com;

  location / {
    proxy_pass http://127.0.0.1:3000;
  }
}

Available scripts

pnpm run dev // start application in development mode
pnpm run build // build for production
pnpm run start // start production bundle

ghexplorer's People

Contributors

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