Skip to content

This project is a FastAPI application that allows users to authenticate with GitHub using OAuth and fetch their starred repositories. The application provides a web interface for users to log in and view their starred repositories, as well working with command-line interface (CLI)

Notifications You must be signed in to change notification settings

DeRuina/Starfolio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Starfolio

Short Description

This project is a FastAPI application that allows users to authenticate with GitHub using OAuth and fetch their starred repositories. The application provides a web interface for users to log in and view their starred repositories, like a portfolio, hence Starfolio. Working as well through the command-line interface (CLI) for fetching the repositories programmatically.

Instructions

Prerequisites

  • Python 3.6 or newer
  • FastAPI
  • Uvicorn (ASGI server)
  • httpx (for making HTTP requests)
  • python-dotenv (for loading environment variables)

Getting Started

To get started with the project, follow these steps:

  1. Clone the Repository: Open a terminal and run the following command to clone the repository:
git clone https://github.com/DeRuina/Starfolio.git 
  1. Navigate to the Project Directory: Change to the project directory by running:
cd Starfolio

GitHub OAuth Setup

  1. Go to your GitHub account's Developer Settings.
  2. Click on "New OAuth App" to create a new OAuth application.
  3. Fill in the "Application name", "Homepage URL", and "Authorization callback URL" fields.
    • For "Homepage URL", use http://127.0.0.1:8000.
    • For "Authorization callback URL", use http://127.0.0.1:8000/authorize.
  4. After creating the OAuth application, you will receive a client_id and client_secret.

Environment Setup

  1. Rename the .env.example file to .env.
  2. Open the .env file and fill in the GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET fields with the values you received from GitHub between the double quotes.

Running the Application

  1. Install the required dependencies by running
 pip install fastapi uvicorn httpx python-dotenv
  1. Start the application by running
python3 main.py
  1. Open your web browser and navigate to http://127.0.0.1:8000.
  2. Click on the "Login with GitHub" button to authenticate.
  3. After successful authentication, you will be redirected to the /starred endpoint, where you can view your starred repositories.

Using the Command-Line Interface (CLI)

  1. After authenticating, you can use the following curl command to fetch your starred repositories programmatically:
curl -X GET "http://127.0.0.1:8000/starred" -H "Authorization: Bearer ${ACCESS_TOKEN}"

Additional Notes

  • Ensure that your .env file is not committed to version control systems like Git to protect your sensitive credentials.

Running Tests

Prerequisites

  • Python 3.6 or newer
  • All project dependencies installed (as listed in the instructions)

Running the Tests

  1. Navigate to the project directory: Open a terminal and navigate to the root directory of your project.

  2. Run the tests: Execute the following command to run the tests:

python3 -m unittest tests.test_app

Author

About

This project is a FastAPI application that allows users to authenticate with GitHub using OAuth and fetch their starred repositories. The application provides a web interface for users to log in and view their starred repositories, as well working with command-line interface (CLI)

Topics

Resources

Stars

Watchers

Forks

Languages