The problem it solves

Before you depend on a library or contribute to a project, you usually click around its repository for a while. Is there a license? Tests? CI? When was the last commit? How many issues are open?

ArchLens runs that checklist in one request, scores it out of 100 and explains every point, so the result is something you can check rather than take on trust. It is useful for choosing a dependency, sizing up a project before contributing, or finding the gaps in your own repository.

Architecture

Web pages FastAPI + Jinja templates, one small JavaScript file
REST API /api/v1, progress streamed as JSON lines
CLI archlens analyze
AnalysisService validate input → reuse a recent report → rate-limit → fetch → scan dependencies → score → store, reporting each step
GitHubService one shared async HTTP client, retries on transient errors GitHub REST API
MetricsService scoring rules as constants; no I/O
RepositoryService SQLAlchemy models, Alembic migrations SQLite
Every entry point calls the same service layer. Only GitHubService talks to GitHub, and analyses are stored through RepositoryService. Dashed boxes are external systems. Each user and system flow is written up, with diagrams, in docs/process-flows.md.

Tech stack

LanguagePython 3.11+
Web frameworkFastAPI (async), server-rendered Jinja2 templates
GitHub clienthttpx AsyncClient, calls run concurrently with asyncio.gather
StorageSQLite by default (PostgreSQL optional) through SQLAlchemy 2, schema migrations with Alembic
Vulnerability dataOSV.dev (free, no key); if it cannot be reached the report says “couldn’t check”
Command lineTyper and Rich
Front endPlain CSS, inline SVG charts and one vanilla JavaScript file; no build step
Qualitypytest with GitHub mocked, Ruff, Black, GitHub Actions
DeploymentMulti-stage Docker image running as a non-root user; Render Blueprint

Key design decisions

  1. One shared HTTP client

    A single httpx.AsyncClient is opened when the app starts and closed when it stops. The six GitHub requests of an analysis run concurrently and reuse its pooled connections instead of each paying for a new TLS handshake.

  2. Real progress, not a timer

    The analysis reports each step to a callback. POST /api/v1/analyze/stream forwards those events as newline-delimited JSON, and the home page lights up its “How it works” steps as each GitHub call finishes. A report’s “Analyze again” runs through the same steps. Without JavaScript the form still posts normally.

  3. Protecting the GitHub quota

    Asking for the same repository and profile again within 60 minutes reuses the stored report, and that reuse is free. Each visitor can start 5 new analyses per 10 minutes (a sliding window keyed by IP); one that fails because GitHub is down or out of quota is given back. When one GitHub call fails, the others are cancelled. The badge never calls GitHub, and the compare page uses stored reports first.

  4. Seeded example reports

    The free hosting tier wipes the disk on every restart, which would greet visitors with an empty site. Real analyses captured earlier are bundled with the app and loaded into an empty database, labelled with the date they were captured.

  5. Scoring rules as data

    Every point value, threshold and file name is a named constant. The scorer applies them, the scoring page renders them, and each report lines its findings up with the same checks. Tests run the real scorer against both, so the explanation cannot drift from the code.

  6. One error vocabulary

    Each failure (bad input, unknown repository, empty repository, rate limits, GitHub outages) is an exception class with its own HTTP status and error code. The API returns them as JSON, the progress stream sends them as an error event, and the pages show the same message next to the form.

Limitations

  • Metadata and dependency files only. ArchLens reads repository statistics, the root file listing and the dependency files in the root. It does not read source files, run tests or measure coverage.
  • Heuristics, not ground truth. A file earns points by existing, whatever its quality, and stars are a weak proxy for health. Read a low score as a list of things to look at.
  • Capped counts. Contributors and recent commits come from one page of GitHub results, so they stop at 100.
  • Single instance. The rate limiter lives in memory, resets on restart and trusts the X-Forwarded-For header, which a determined client can forge.
  • Renames are learned, not looked up. An old name of a renamed repository finds the new one’s reports only after someone has analyzed it under the old name once.
  • Ephemeral demo storage. On the free host the SQLite file resets when the service restarts. Example reports come back; other reports, and the badges that point at them, return after someone analyzes the repository again.
  • GitHub limits. Without a token GitHub allows 60 requests an hour, which is five to ten analyses (each uses six requests, plus one for each dependency file it finds).

Who built it

Designed and built by Vishnu Jayanth. The source, tests and deployment config are on GitHub, and the REST API is documented at /docs.