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.
- 🔍 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
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)
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
- Node.js (v18+ recommended)
- PostgreSQL running locally or remotely
- A GitHub personal access token (for higher API rate limits)
- A Google OAuth 2.0 client ID/secret (for Google sign-in)
-
Clone the repository
git clone https://github.com/Sblackx/GitHub-Explorer.git cd GitHub-Explorer -
Install dependencies
npm install
-
Create a PostgreSQL database and note its connection details. The app automatically creates the required tables (
users,favorite) on first run. -
Configure environment variables
Create a
.envfile 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. -
Run the app
npx nodemon main.js # or node main.jsThe app will be available at http://localhost:3000.
- Sign up with an email/password, or sign in with Google.
- Browse Popular repositories or use the search bar to find specific ones.
- Click the ⭐ icon on any repo card to add or remove it from your Favorites.
- Use the pagination controls at the bottom to browse more results.
- Click LogOut to end your session.
| 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 |