How suman724/fastapi-git works
Marketplace Git Server handles Git clients’ clone/fetch requests by generating a deterministic marketplace.json payload, building a fresh in-memory Git repository, and serving Git Smart HTTP responses. The central flow separates payload generation, repository construction, HTTP request validation, and Dulwich protocol handling. Application setup also provides health/banner endpoints, error formatting, configuration, and request-correlated structured logging. README-described shallow fetches and gzip handling are represented in the route/protocol path; evidence is limited to the supplied excerpts and README.
Main entry points: routes.py Git HTTP routes · main.py FastAPI app · protocol.py Upload-pack protocol · repo.py Memory repo builder
Components 15
Application runtime
- FastAPI app
app/main.py - Runtime settings
app/config.py - Health and banner
app/main.py
Smart HTTP Git
- Git HTTP routes
app/git/routes.py - Repo name validation
app/git/repo.py - Body and gzip guards
app/git/routes.py - Upload-pack protocol
app/git/protocol.py
Synthetic repository generation
- Memory repo builder
app/git/repo.py - Marketplace JSON generator
app/marketplace.py
Errors and observability
- Request middleware
app/middleware.py - Structured logging
app/logging_config.py - HTTP error handlers
app/exceptions.py
Other components
- Git client
- Dulwich protocol engine
- Git clone response
Connections 18
- FastAPI app → Git HTTP routes: registers routes
app/main.py - FastAPI app → Request middleware: installs middleware
app/main.py - FastAPI app → HTTP error handlers: registers handlers
app/main.py - FastAPI app → Runtime settings: loads settings
app/main.py - Git client → Git HTTP routes: requests clone
README.md - Git HTTP routes → Repo name validation: validates name
app/git/routes.py - Git HTTP routes → Body and gzip guards: checks upload body
app/git/routes.py - Git HTTP routes → Runtime settings: reads size limit
app/git/routes.py - Git HTTP routes → Memory repo builder: builds repository
app/git/routes.py - Memory repo builder → Marketplace JSON generator: renders JSON
app/git/repo.py - Memory repo builder → Runtime settings: reads branch identity
app/git/repo.py - Git HTTP routes → Upload-pack protocol: renders Git responses
app/git/routes.py - Upload-pack protocol → Dulwich protocol engine: drives upload-pack
app/git/protocol.py - Upload-pack protocol → Git clone response: produces protocol bytes
app/git/protocol.py - Git HTTP routes → Git clone response: returns HTTP response
app/git/routes.py - Git client → Health and banner: checks health
README.md - Request middleware → Structured logging: sets request context
app/middleware.py - FastAPI app → Structured logging: configures logging
app/main.py