Skip to content

team-gamma-devs/git-gud-stats

Repository files navigation

FastAPI Uvicorn HTTPX

Repo License Last Commit

Contributors

glovek08 federico-paganini Martin-DMC

Start Developing:

  1. Create your virtual environment.

  2. Install FastAPI dependencies:

(venv) $ pip install -r requirements.txt
  1. Set up your GH Token in an .env
GITHUB_TOKEN=<Your token>
  1. Run the FastAPI server:
# Navigate to app/
(venv) $ fastapi dev main.py
  1. Run the Vite server:
# Navigate to client/
(venv) $ npm run dev

About git-gud-stats

git-gud-stats is a Python-based backend service built with the high-performance FastAPI framework. Its purpose is to fetch, process, and serve statistics for any GitHub user by leveraging the power of GitHub's public APIs.

This project utilizes both the GitHub REST API for basic user data and the GitHub GraphQL API for more complex queries, such as retrieving recent repositories and the primary languages used within them.

Purpose & Vision

This project serves as a foundational training ground for a more ambitious future application. The primary goals of this initial phase are:

  1. API Integration: To learn and implement best practices for interacting with both REST and GraphQL APIs from a backend service.
  2. Authentication: To handle authenticated requests securely using GitHub Personal Access Tokens (PATs).
  3. Asynchronous Programming: To build a responsive and efficient service using Python's async/await syntax with FastAPI and HTTPX.

The long-term vision is to evolve this service into a fully-fledged GitHub App that will integrate into another full web application. This future web app will provide a specific client without IT background with filtered but rich insightful visualizations of a user's coding activity, helping them track their progress, understand their language preferences, and "get good" at their craft. This project is the first crucial step in building the robust backend required for that vision.

Technology Stack

The project is built with a modern, asynchronous Python stack, chosen for its performance and developer-friendly features:

  • FastAPI: A modern, fast (high-performance) web framework for building APIs with Python.
  • Uvicorn: A lightning-fast ASGI server, used to run the FastAPI application.
  • HTTPX: A fully featured asynchronous HTTP client for making requests to the GitHub API.
  • Python-dotenv: A library for managing environment variables, used here to securely load the GITHUB_TOKEN.

Current Features

The API currently provides two main endpoints to gather user statistics:

  • GET /user/{username}: Fetches basic public user information from the GitHub REST API.
  • GET /graphql-user/{username}: Executes a GraphQL query to get the user's name and their 5 most recently pushed repositories, including the top languages used in each.

It also includes a CORS middleware to allow requests from a local development server (like a Svelte or React frontend) and a simple, secure token authentication system that prioritizes a Bearer token from the request header before falling back to an environment variable for development.

About

GitHub App that fetches user's github information.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •