Skip to content

Latest commit

 

History

History
86 lines (67 loc) · 1.84 KB

File metadata and controls

86 lines (67 loc) · 1.84 KB

CommitFill Backend

This directory contains the backend service for CommitFill.

The backend handles:

  • GitHub OAuth authentication
  • Commit creation logic
  • Interaction with the GitHub API

Tech Stack

  • Flask
  • SQLAlchemy
  • JWT
  • GitPython
  • NeonDB
  • GitHub OAuth

Setup (Local Development)

  1. Navigate to the backend directory:
    cd backend
  2. Create virtual environment:
    uv venv
  3. Install dependencies:
    uv sync
  4. Create environment variables:
    cp .env.example .env
  5. Initialize the environment variables in .env file
  6. Create database ->
    uv run python
    >>> from app import app,db
    >>> with app.app_context():
    ...     db.create_all()
  7. Start the backend server:
    uv run flask run

GitHub OAuth Setup

To set up GitHub OAuth for this backend application, follow these steps:

  1. Navigate to your GitHub account settings.
  2. Go to "Developer settings" > "OAuth Apps".
  3. Click on "New OAuth App".
  4. Fill in the required fields, such as the application name, homepage URL, and authorization callback URL.
  5. After creating the app, copy the Client ID and Client Secret provided by GitHub.
  6. Use these credentials in your backend configuration to enable OAuth authentication.

Required Environment Variables

  • GITHUB_CLIENT_ID=YOUR_GITHUB_CLIENT_ID
  • GITHUB_CLIENT_SECRET=YOUR_GITHUB_CLIENT_SECRET
  • DATABASE_URL=YOUR_DATABASE_URL
  • FERNET_SECRET_KEY=YOUR_FERNET_SECRET_KEY
  • JWT_SECRET_KEY=YOUR_JWT_SECRET_KEY
  • FRONTEND_URL=http://localhost:8080

How It Works (High Level)

  • Users authenticate with GitHub via OAuth
  • The backend generates commits with custom timestamps
  • Commits are pushed to the user’s repository
  • GitHub reflects them in the contribution graph