All Projects → yonureker → gitsearch

yonureker / gitsearch

Licence: other
A searchbar for querying Github users and repositories. Written in React Native and React Native Web. GraphQL and Apollo Client to query Github GraphQL API.

Programming Languages

typescript
32286 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to gitsearch

guchub
🎓 Elegantly manage your GUC academic life
Stars: ✭ 15 (+0%)
Mutual labels:  apollo, reactnative
GitHub-GraphQL-API-Example-iOS
An example iOS application using GitHub GraphQL API with Apollo.
Stars: ✭ 23 (+53.33%)
Mutual labels:  apollo
mern-apollo-graphql-boilerplate
MERN + Apollo-Graphql Boilerplate
Stars: ✭ 21 (+40%)
Mutual labels:  apollo
apollo-logger
Apollo GraphQL Logger
Stars: ✭ 19 (+26.67%)
Mutual labels:  apollo
matnbaz
📚 The source-code for matnbaz.net. A monorepo containing the back-end (NestJS/Prisma/Apollo), front-end (Next.js/Apollo) and some tooling.
Stars: ✭ 481 (+3106.67%)
Mutual labels:  apollo
gitstar
Github Client built with React Apollo
Stars: ✭ 15 (+0%)
Mutual labels:  apollo
graphqlizer
Make your meteor mongo collections accessible over a graphql endpoint
Stars: ✭ 37 (+146.67%)
Mutual labels:  apollo
graphql-workshop
⚒ 🚧 A GraphQL workshop to learn GraphQL implementations
Stars: ✭ 20 (+33.33%)
Mutual labels:  apollo
agollo
🚀Go client for ctrip/apollo (https://github.com/apolloconfig/apollo)
Stars: ✭ 563 (+3653.33%)
Mutual labels:  apollo
graphX
A simple blog based on Nuxt and graphQL
Stars: ✭ 19 (+26.67%)
Mutual labels:  apollo
laika
Log, test, intercept and modify Apollo Client's operations
Stars: ✭ 99 (+560%)
Mutual labels:  apollo
create-full-stack
Set up a TypeScript full stack with one command.
Stars: ✭ 94 (+526.67%)
Mutual labels:  apollo
nytimes-bestseller
NY Times best sellers list explorer
Stars: ✭ 35 (+133.33%)
Mutual labels:  reactnative
apollo.net
Apollo配置中心.Net客户端
Stars: ✭ 449 (+2893.33%)
Mutual labels:  apollo
apollo-express-ts-server-boilerplate
No description or website provided.
Stars: ✭ 29 (+93.33%)
Mutual labels:  apollo
ReactNativeNote
ReactNative基础知识,和一些在项目中遇到问题的总结,以及一些第三方框架的接入流程,欢迎fork,star~
Stars: ✭ 12 (-20%)
Mutual labels:  reactnative
sendbird-javascript-samples
A guide of the installation and functions of Sendbird Chat, UIKit, and SyncManager for JavaScript samples.
Stars: ✭ 315 (+2000%)
Mutual labels:  reactnative
apollo-tracing-elixir
Apollo Tracing middleware for Absinthe
Stars: ✭ 114 (+660%)
Mutual labels:  apollo
periqles
React form library for Relay and Apollo
Stars: ✭ 124 (+726.67%)
Mutual labels:  apollo
React-Native-UI
A Collection of React Native UI inspired from dribbble and other sites.
Stars: ✭ 18 (+20%)
Mutual labels:  reactnative

GitSearch

GitSearch is a search engine where you can search Github users and repositories. Search results are shown as user types the query. The application uses the Github GraphQL API to display user or repository search results. The web app is built with React Native web components and the website is deployed via Vercel.

Demo

Live demo is available here

GraphQL

I initially built the app with Github REST API where you simply fetch the data from either https://api.github.com/search/users?q=${query} or https://api.github.com/search/repositories?q=${query} and save the necessary portion of the response to a state to display the required info.

Later, I realized that Github also has a GraphQL API and wanted to have an intro about the GraphQL query language. After playing around with the explorer, I come up with queries to search Github users and repositories given a query from the user:

const GET_USERS = gql`
  query SearchUsers($userQuery: String!) {
    search(query: $userQuery, type: USER, first: 20) {
      edges {
        node {
          ... on User {
            avatarUrl
            id
            login
            url
          }
        }
      }
    }
  }
`;

const GET_REPOSITORIES = gql`
  query SearchRepositories($userQuery: String!) {
    search(query: $userQuery, type: REPOSITORY, first: 20) {
      edges {
        node {
          ... on Repository {
            id
            url
            description
            stargazerCount
            nameWithOwner
            owner {
              avatarUrl
            }
          }
        }
      }
    }
  }
`;

Optimizing Search

I have implemented a few conditions to make the search more data efficient for the user:

  • The user has to enter at least 3 characters before the search starts.
  • When the user stops typing, there is a 1 second delay before the search starts.
useEffect(() => {
    if (query.length >= 3) {
      const timeoutId = setTimeout(() => handleNewSearch(), 1000);
      return () => clearTimeout(timeoutId);
    }
  }, [query]);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].