> ## Documentation Index
> Fetch the complete documentation index at: https://aipkg.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Solution Structure

> AI•Pkg.slnx project layout, directory structure, and mapping from NuGetGallery source projects to new AI•Pkg projects.

<Note>
  The new solution file is `AI•Pkg.slnx` (SLNX format). Do **not** convert the existing `NuGetGallery.sln`. The SLNX is created from scratch.
</Note>

***

## Solution Layout

```
AI•Pkg.slnx
├── src/
│   ├── AI•Pkg.Core/                  # Shared library (see SDK Interface spec)
│   ├── AI•Pkg.Server/                # ASP.NET Core 10 web app (API + Blazor)
│   ├── AI•Pkg.Server.Db/             # SQL Server Database Project (.sqlproj)
│   ├── AI•Pkg.Server.Data/           # EasyAF-generated EF Core entities + repositories
│   ├── AI•Pkg.Server.Search/         # Azure AI Search integration
│   ├── AI•Pkg.CLI/                   # aipkg CLI (Native AOT) — see SDK Interface spec
│   └── AI•Pkg.Jobs/                  # Background jobs (stats, vulnerability, catalog)
├── tests/
│   ├── AI•Pkg.Core.Tests/
│   ├── AI•Pkg.Server.Tests/
│   └── AI•Pkg.Server.Integration.Tests/
└── src/AI•Pkg.Docs/
    └── (this directory)
```

***

## Project Descriptions

### `AI•Pkg.Core`

Cross-platform .NET 10 class library. Contains manifest parsing, archive reading/writing, APM fallback resolution, validation, and versioning. **AOT-compatible**: no reflection emit, no dynamic code. Published to NuGet as `AI•Pkg.Core`. Referenced by both `AI•Pkg.Server` and `AI•Pkg.CLI`.

### `AI•Pkg.Server`

ASP.NET Core 10 web application. Hosts:

* Minimal API endpoints for the Registry API (under `/v3/`)
* Blazor SSR components for the web UI
* GitHub OAuth + API key authentication middleware

### `AI•Pkg.Server.Db`

SQL Server Database Project (`.sqlproj`). Contains all table definitions as `.sql` files. This is the **authoritative schema source**. Changes to the database always start here.

### `AI•Pkg.Server.Data`

EasyAF-generated EF Core 10 entities, repositories, and `AIpkgDbContext`. Generated from `AI•Pkg.Server.Db`. Committed to source control. Regenerated via EasyAF CLI whenever the DB project changes.

### `AI•Pkg.Server.Search`

Azure AI Search document models, indexing pipelines, and query translation. Contains `AipkgSearchDocument` and the pipeline that keeps the search index in sync with the database.

### `AI•Pkg.CLI`

Native AOT `aipkg` command-line tool. References `AI•Pkg.Core`. Published as a single self-contained binary per platform (see [SDK Implementation](06-sdk-implementation)).

### `AI•Pkg.Jobs`

Background jobs: CDN stats parsing, GitHub vulnerability ingestion, search index sync, and registration blob builder. Adapted from `src/Stats.*`, `src/GitHubVulnerabilities2Db/`, and related NuGetGallery projects.

***

## Project Rename Reference

| NuGetGallery Original        | AI•Pkg Project                          |
| ---------------------------- | --------------------------------------- |
| `NuGetGallery` (MVC app)     | `AI•Pkg.Server`                         |
| `NuGetGallery.Core`          | `AI•Pkg.Core` + `AI•Pkg.Server.*`       |
| `NuGet.Services.Entities`    | `AI•Pkg.Server.Data` (EasyAF-generated) |
| `NuGet.Services.AzureSearch` | `AI•Pkg.Server.Search`                  |
| `NuGetGallery.Core.Facts`    | `AI•Pkg.Core.Tests`                     |
| `NuGetGallery.Facts`         | `AI•Pkg.Server.Tests`                   |
| `Stats.*`                    | `AI•Pkg.Jobs` (combined)                |
| `GitHubVulnerabilities2Db`   | Part of `AI•Pkg.Jobs`                   |
| `NuGet.Packaging` (client)   | `AI•Pkg.Core` (own reader/writer)       |
| `NuGetGallery.sln`           | `AI•Pkg.slnx`                           |

***

## SLNX Format

SLNX (`.slnx`) is the XML-based Visual Studio solution format introduced in Visual Studio 2022. It is:

* Human-readable and diff-friendly (unlike `.sln`)
* Supported by `dotnet build`, `dotnet test`, and Rider/VS 2022+
* Created via `dotnet new sln --format slnx`

Do **not** attempt to convert the existing `NuGetGallery.sln`. It contains 139 projects, most of which are being deleted. The new `AI•Pkg.slnx` adds projects incrementally during Phase 0.
