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.
- Python 3.6 or newer
- FastAPI
- Uvicorn (ASGI server)
httpx(for making HTTP requests)python-dotenv(for loading environment variables)
To get started with the project, follow these steps:
- Clone the Repository: Open a terminal and run the following command to clone the repository:
git clone https://github.com/DeRuina/Starfolio.git - Navigate to the Project Directory: Change to the project directory by running:
cd Starfolio- Go to your GitHub account's Developer Settings.
- Click on "New OAuth App" to create a new OAuth application.
- 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.
- For "Homepage URL", use
- After creating the OAuth application, you will receive a
client_idandclient_secret.
- Rename the
.env.examplefile to.env. - Open the
.envfile and fill in theGITHUB_CLIENT_IDandGITHUB_CLIENT_SECRETfields with the values you received from GitHub between the double quotes.
- Install the required dependencies by running
pip install fastapi uvicorn httpx python-dotenv- Start the application by running
python3 main.py- Open your web browser and navigate to
http://127.0.0.1:8000. - Click on the "Login with GitHub" button to authenticate.
- After successful authentication, you will be redirected to the
/starredendpoint, where you can view your starred repositories.
- After authenticating, you can use the following
curlcommand to fetch your starred repositories programmatically:
curl -X GET "http://127.0.0.1:8000/starred" -H "Authorization: Bearer ${ACCESS_TOKEN}"- Ensure that your
.envfile is not committed to version control systems like Git to protect your sensitive credentials.
- Python 3.6 or newer
- All project dependencies installed (as listed in the instructions)
-
Navigate to the project directory: Open a terminal and navigate to the root directory of your project.
-
Run the tests: Execute the following command to run the tests:
python3 -m unittest tests.test_app