# Install your first foundation packages

Restore and execute an independently verified package consumer.

Goal: restore an explicitly versioned package and use the cache port in a console
application. The same port can later be injected into a worker or API.

## Prerequisites

Use .NET 10. Source contributors use the exact SDK in global.json. GitHub Packages
requires authentication even when package metadata is public. Obtain an approved
package-read credential from your organization's secret provider; do not put its
value in repository files, shell history or this documentation.

## Configure package sources

Use NuGet source mapping: Fabricators.* belongs to the fabricators feed and public
dependencies belong to nuget.org. Supply credentials at runtime through NuGet's
credential provider or NuGetPackageSourceCredentials_fabricators. The source name
must match your configuration. Never interpolate a token into a command argument.

```xml
<configuration>
  <packageSources>
    <clear />
    <add key="fabricators"
         value="https://nuget.pkg.github.com/fabricatorsltd/index.json" />
    <add key="public" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
  <packageSourceMapping>
    <packageSource key="fabricators"><package pattern="Fabricators.*" /></packageSource>
    <packageSource key="public"><package pattern="*" /></packageSource>
  </packageSourceMapping>
</configuration>
```

## Create and restore the consumer

```text
dotnet new console --framework net10.0
dotnet add package Fabricators.Caching.FusionCache --version 0.19.0
```

Replace Program.cs with this complete example. The verification runner compiles
and executes this exact source against NuGet packages outside the checkout,
without project references.

```csharp
using Fabricators.Application.Services;
using Fabricators.Caching.FusionCache;
using Microsoft.Extensions.Options;
using ZiggyCreatures.Caching.Fusion;

using var cacheProvider = new FusionCache(Options.Create(new FusionCacheOptions()));
ICacheService cache = new FusionCacheService(cacheProvider);
await cache.SetAsync("quickstart:message", "Hello from the cache", TimeSpan.FromMinutes(1));
string? message = await cache.GetOrDefaultAsync<string>("quickstart:message");
Console.WriteLine(message);
```

Expected output: `Hello from the cache`. This is process-local storage; restarting
the process loses the value. No database, ASP.NET host or external cache is required.

## Move into a real host

Register AddFabricatorsCache in the trusted host and inject ICacheService. Derive
tenant, company and app identifiers from authorized server context. Do not accept
cache scope from an arbitrary JSON body. The default is local cache; shared cache
and invalidation across replicas require explicit deployment configuration.

Next: [create your first API](/foundation/0.19.0/guides/first-api/), [select adapters](/foundation/0.19.0/guides/packages/)
and [cache safely](/foundation/0.19.0/guides/caching/).
