https://github.com/abhish3kk/repofinder-react
https://github.com/abhish3kk/repofinder-react
authentication axios azure-deployment cicd husky javascript jwt react react-router tailwind tsx vite
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/abhish3kk/repofinder-react
- Owner: abhish3kk
- Created: 2025-02-07T17:32:47.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-28T18:50:31.000Z (over 1 year ago)
- Last Synced: 2025-02-28T21:56:00.356Z (over 1 year ago)
- Topics: authentication, axios, azure-deployment, cicd, husky, javascript, jwt, react, react-router, tailwind, tsx, vite
- Language: TypeScript
- Homepage:
- Size: 190 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
---
title: Repofinder React
description: RepoFinder allows users to search GitHub repositories based on various filters such as topics, languages, stars, sorting order, and result limits. Users can log in to save their search preferences.
stack: React, Azure, GitHub Actions, Zustand, TypeScript, Tailwind CSS, Node Express, SQLite, Swagger, Azure Devops, JWT
---
# Repofinder - React
## Live Demo
π **Repofinder Live:** [https://repofinder.abhish3kk.in](https://repofinder.abhish3kk.in)
## Table of Contents
1. [Introduction](#introduction)
- [What is Repofinder?](#what-is-repofinder)
- [Features](#features)
2. [Application Architecture](#application-architecture)
- [Overview](#overview)
- [Component Breakdown](#component-breakdown)
- [State Management](#state-management)
- [API Communication](#api-communication)
3. [Application Flow](#application-flow)
- [Entry Point (`main.tsx`)](#entry-point-maintsx)
- [App Initialization](#app-initialization)
- [Routing & Navigation](#routing--navigation)
- [Authentication Flow](#authentication-flow)
- [Fetching and Displaying GitHub Repos](#fetching-and-displaying-github-repos)
- [Favoriting Repositories](#favoriting-repositories)
- [Error Handling & Edge Cases](#error-handling--edge-cases)
4. [Tech Stack](#tech-stack)
- [Frontend Technologies](#frontend-technologies)
- [Libraries & Dependencies](#libraries--dependencies)
- [API & Backend Communication](#api--backend-communication)
5. [Project Setup & Installation](#project-setup--installation)
- [Prerequisites](#prerequisites)
- [Installation Steps](#installation-steps)
- [Environment Variables](#environment-variables)
6. [Running the Application](#running-the-application)
- [Development Mode](#development-mode)
- [Production Build](#production-build)
7. [API Interaction](#api-interaction)
- [Health Check API](#health-check-api)
- [Authentication APIs](#authentication-apis)
- [GitHub API Calls](#github-api-calls)
- [Favorites API](#favorites-api)
8. [Folder Structure](#folder-structure)
9. [Deployment](#deployment)
- [Deployment Steps](#deployment-steps)
- [Azure Hosting](#azure-hosting)
## Introduction
### What is Repofinder?
Repofinder is a React application that helps users discover GitHub repositories efficiently. It interacts with the GitHub API via a Node.js Express backend, allowing users to search for repositories based on customizable parameters such as **topics, programming language, star count, result limit, sorting criteria,** and more. Users can configure these filters in the **Settings** section to refine their search and find repositories that align with their interests.
### Features
- **Search Repositories by Topic & Language** β Easily filter repositories based on relevant technologies and domains.
- **Find Active & Relevant Projects** β Avoid outdated or inactive repositories by prioritizing projects with recent activity.
- **Sort by Stars & Popularity** β Discover trending repositories based on their star count and engagement.
- **Reduce Overwhelm** β Many top-ranked repositories can be complex or inactive. Repofinder helps users find projects that are easier to contribute to based on recent activity and stack relevance.
## Application Architecture
### Overview
Repofinder follows a **client-server architecture**, where the frontend (React) communicates with the backend (Node.js + Express) to fetch repositories via the GitHub API. The application ensures seamless user authentication, state management, and API communication to provide an interactive user experience.
```mermaid
graph LR;
User -->|Requests| ReactApp;
ReactApp -->|API Calls| NodeBackend;
NodeBackend -->|Fetches Data| GitHubAPI;
NodeBackend -->|Response| ReactApp;
ReactApp -->|Displays Data| User;
```
> The diagram above represents the data flow: Users interact with the React frontend, which fetches data from the backend, and the backend queries the GitHub API before returning the results to the client.
### Component Breakdown
```
src/components
βββ Card.tsx
βββ Combobox.tsx
βββ Darklight.tsx
βββ Error.tsx
βββ Loader.tsx
βββ MainContent.tsx
βββ Nav.tsx
βββ UserDropdown.tsx
```
The application consists of various reusable and structural components, categorized as follows:
#### **Core UI Components**
- **Card.tsx** β Displays repository details such as name, stars, and description.
- **Combobox.tsx** β A searchable dropdown component for selecting options like topics or languages.
- **Darklight.tsx** β Toggles between dark and light themes.
- **Error.tsx** β Displays error messages when API calls fail or when the backend is unreachable.
- **Loader.tsx** β A loading spinner shown during API calls or page transitions.
#### **Structural Components**
- **MainContent.tsx** β The primary layout container that renders content dynamically.
- **Nav.tsx** β The navigation bar containing links and user profile actions.
- **UserDropdown.tsx** β A headless component for user-related actions like logout and profile settings.
### State Management
Repofinder uses a combination of **Zustand** and **Context API** for efficient state management:
#### **Global State Management with Zustand**
Zustand is used for managing application-wide state while ensuring minimal re-renders. The following stores handle different aspects of the app:
```
src/store
βββ appStore.ts
βββ authStore.ts
βββ index.ts
βββ settingStore.ts
```
- **`appStore.ts`** β Manages global app settings like theme selection (dark/light mode).
- **`authStore.ts`** β Stores authentication details, including user session and JWT tokens.
- **`settingStore.ts`** β Maintains user-defined search filters (topics, language, stars, etc.).
#### **Context API for UI State**
Context API is used for handling UI-related transient states that donβt require persistence, such as:
- **Loader State** β Controls when to show/hide the loader during API requests and page transitions.
By combining **Zustand** for persistent, app-wide state and **Context API** for temporary UI state, Repofinder ensures a smooth and optimized user experience.
### Folder Structure
```
src
βββ AppRoutes.tsx
βββ Provider.tsx
βββ api
βΒ Β βββ api.service.ts
βΒ Β βββ axiosInstance.ts
βΒ Β βββ config.ts
βΒ Β βββ endpoints.ts
βΒ Β βββ http.service.ts
βΒ Β βββ index.ts
βββ assets
βΒ Β βββ react.svg
βΒ Β βββ repos.json
βββ auth
βΒ Β βββ ProtectedRoute.tsx
βββ components
βΒ Β βββ Card.tsx
βΒ Β βββ Combobox.tsx
βΒ Β βββ Darklight.tsx
βΒ Β βββ Error.tsx
βΒ Β βββ Loader.tsx
βΒ Β βββ MainContent.tsx
βΒ Β βββ Nav.tsx
βΒ Β βββ UserDropdown.tsx
βββ contexts
βΒ Β βββ authContext.ts
βΒ Β βββ healthContext.ts
βΒ Β βββ index.ts
βΒ Β βββ loaderContext.ts
βββ hooks
βΒ Β βββ index.ts
βΒ Β βββ useAuth.ts
βΒ Β βββ useLoader.ts
βββ index.css
βββ main.tsx
βββ models
βΒ Β βββ api.request.model.ts
βΒ Β βββ api.response.model.ts
βΒ Β βββ app.models.ts
βΒ Β βββ app.types.ts
βΒ Β βββ github.model.ts
βΒ Β βββ github.types.ts
βββ providers
βΒ Β βββ AuthProvider.tsx
βΒ Β βββ HealthProvider.tsx
βΒ Β βββ LoaderProvider.tsx
βΒ Β βββ index.ts
βββ routes
βΒ Β βββ index.tsx
βββ store
βΒ Β βββ appStore.ts
βΒ Β βββ authStore.ts
βΒ Β βββ index.ts
βΒ Β βββ settingStore.ts
βββ utils
βΒ Β βββ enumToArray.ts
βΒ Β βββ getLabelFromOption.ts
βΒ Β βββ index.ts
βββ views
βΒ Β βββ Dashboard.tsx
βΒ Β βββ Login.tsx
βΒ Β βββ Register.tsx
βΒ Β βββ Settings.tsx
βββ vite-env.d.ts
```