Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

GitHub-Explorer

A full-stack web app for discovering and saving GitHub repositories. Browse trending repos, search by keyword, and star your favorites to a personal list — with email/password or Google OAuth login.

Features

  • 🔍 Search & Discover — Search GitHub repositories or browse the most popular ones (sorted by stars) via the GitHub Search API
  • ⭐ Favorites — Star any repo to save it to your account; unstar to remove it
  • 📄 Pagination — Page through search and favorite results
  • 🔐 Authentication — Sign up / log in with email and password (hashed with bcrypt), or sign in with Google OAuth 2.0
  • 🗄️ Persistent storage — Users and favorites are stored in PostgreSQL, scoped per user

Tech Stack

Backend: Node.js, Express 5, PostgreSQL (pg), Passport.js (local + Google OAuth 2.0), bcrypt, express-session

Frontend: EJS templates, vanilla JavaScript, Bootstrap 5, Font Awesome

External API: GitHub REST API (repository search)

Project Structure

GitHub-Explorer/
├── main.js                # Express app, routes, auth, GitHub API calls
├── db.js                  # PostgreSQL connection + table setup
├── views/
│   ├── home.ejs            # Login page
│   ├── register.ejs        # Sign-up page
│   └── index.ejs           # Repository listing (popular / favorites)
├── public/
│   ├── css/                # Stylesheets
│   ├── js/index.js         # Client-side search, favoriting, navigation
│   └── images/
├── package.json
└── .gitignore

Prerequisites

Setup

  1. Clone the repository

    git clone https://github.com/Sblackx/GitHub-Explorer.git
    cd GitHub-Explorer
  2. Install dependencies

    npm install
  3. Create a PostgreSQL database and note its connection details. The app automatically creates the required tables (users, favorite) on first run.

  4. Configure environment variables

    Create a .env file in the project root:

    # PostgreSQL
    DB_USER=your_db_user
    DB_HOST=localhost
    DB_DATABASE=your_db_name
    DB_PASSWORD=your_db_password
    DB_PORT=5432
    
    # Session
    SESSION_SECRET=some_long_random_string
    
    # GitHub API
    GITHUB_TOKEN=your_github_personal_access_token
    
    # Google OAuth
    GOOGLE_CLIENT_ID=your_google_client_id
    GOOGLE_CLIENT_SECRET=your_google_client_secret

    For Google OAuth, set the authorized redirect URI to http://localhost:3000/auth/google/repository.

  5. Run the app

    npx nodemon main.js
    # or
    node main.js

    The app will be available at http://localhost:3000.

Usage

  1. Sign up with an email/password, or sign in with Google.
  2. Browse Popular repositories or use the search bar to find specific ones.
  3. Click the ⭐ icon on any repo card to add or remove it from your Favorites.
  4. Use the pagination controls at the bottom to browse more results.
  5. Click LogOut to end your session.

API Routes

Method Route Description
GET / Landing/login page (redirects to /popular if logged in)
GET /register Sign-up page
POST /register Create a new account
GET /login Login page
POST /login Authenticate with email/password
GET /auth/google Start Google OAuth flow
GET /auth/google/repository Google OAuth callback
GET /logout End session
GET /popular List trending/searched repositories
GET /favorite List the logged-in user's favorite repositories
PUT /favorite/add Add a repository to favorites
DELETE /favorite/remove Remove a repository from favorites

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages