- Next.js
- TypeScript
- TanStack Query
- Material UI
- React Hook Form + Yup
- Jest & React Testing Library
Before running the project, create a .env.local file with the following content:
NEXT_PUBLIC_API_URL=https://api.github.com
NEXT_PUBLIC_GITHUB_TOKEN=- This token is not required for the application to work.
- GitHub's Search API has request limits. To increase the limit, you can set
NEXT_PUBLIC_GITHUB_TOKENwith a personal access token. - Do not use this token in production, as it will be publicly accessible in the browser, posing a security risk.
- A proper solution would be to use a proxy with an API route in Next.js. The frontend would call this internal API, which would then securely handle the request to GitHub using the token. This is not implemented in the current version.
- In production,
NEXT_PUBLIC_GITHUB_TOKENis not used, but locally, you can set it up for testing purposes.
Run the development server:
yarn install
yarn devThen open http://localhost:3000 in your browser.
Build and start the application:
yarn install && yarn build && yarn startThe main files to look at are:
UserSearch.tsx– Handles the search input and interactionUserList.tsx– Displays the list of GitHub usersuseGithubSearch.ts– Custom hook for fetching GitHub usersgetUsers.ts– Function for making API calls to GitHub
- The application does not include i18n, but instead of hardcoding text in the code, translations have been extracted into a separate file for better maintainability.
-
As part of the Handling GitHub API Rate Limits, I have implemented a mechanism to prevent excessive requests when the API rate limit is exceeded. If a 403 error occurs due to too many requests, the app pauses further requests and displays a message advising the user to wait for a minute. A retry button allows manual resumption of data fetching.
-
This is my proposed enhancement to improve the app’s usability and prevent unnecessary API calls.
- Constants, types, translations, and styles are organized into separate files and directories following best practices.
All project requirements have been met.
- The app is live and can be accessed at: https://github-search-mciechanowicz1s-projects.vercel.app/