What you need
- The .NET 10 SDK (or later), and Visual Studio, Rider or the
dotnetCLI. - A Nexus service with a secret key (
wxs_...) and its endpoint (https://<slug>.westyx.dev) - see Create a service. The endpoint is on the service’s page in the console; the key is shown once, when you create it. - In that service, three values to read:
1. Create the project
- Visual Studio
- dotnet CLI
In your solution, right-click the solution in Solution Explorer and choose Add > New
Project. Pick ASP.NET Core Empty, name it
Checkout, and choose .NET 10.0.2. Add the package source and the packages
The packages are on the Westyx GitLab NuGet feed, which is public - no token is needed. Put anuget.config next to your solution file and commit it, so every machine and your CI find the feed:
Checkout project:
- Visual Studio
- dotnet CLI
Right-click the project, Manage NuGet Packages, set Package source to
westyx-nexus
(or All), and install WestyxNexus.Extensions.Configuration and
WestyxNexus.Extensions.DependencyInjection. Both bring in the core WestyxNexus package.3. Tell the application where Nexus is
The endpoint is not a secret, so it goes inappsettings.json:
- Visual Studio
- dotnet CLI
Right-click the project, Manage User Secrets, and add:
Nexus__ApiKey, or skip the key
entirely with workload identity.
4. Write Program.cs
Replace the contents of Program.cs:
builder.AddWestyxNexus(...)creates one client, runs the first sync before the application starts, and keeps it current over a live connection that delivers a change within milliseconds. It is disposed with the application.- Configs arrive in
IConfigurationwith:as the separator, socheckout.currencyischeckout:currencyand binds like any other section.IConfigurationmatches property names case-insensitively but not across an underscore, which is what[ConfigurationKeyName]is for. - Secrets do not enter
IConfiguration, so a configuration dump cannot print them.AddWestyxNexusSecrets<T>("payment")binds every secret underpayment.toPaymentOptions, and mapsapi_keytoApiKeyitself. Keep the options type aclass: arecordprints its values fromToString()- see Secrets binding. - Flags are read from the client:
GetFlaganswers from memory, with no network call. IOptionsMonitor<T>is what sees a change without a restart;IOptions<T>keeps the value from startup.
5. Run it
Start the project (F5 in Visual Studio, ordotnet run) and open /checkout on the address it
prints (Now listening on: http://localhost:<port>):
checkout.max_items or switch new.checkout off in the console, and call the endpoint
again: the new value is there, with no restart.
If it does not start
The first sync runs before the application starts, so a wrong setting stops it at startup rather than on the first request:
The full list is in Error handling.
In production
-
The key comes from the environment -
Nexus__ApiKeyoverrides user secrets andappsettings.json- or from whatever secret store already feeds yourIConfiguration. -
Better: no key at all. On Kubernetes, EKS, AKS, GKE and Azure, the SDK can prove the
workload’s identity instead. Set
Wifand dropApiKey:See Workload identity for the trust policy it needs. -
Locally without a key: run
westyx dev setup --service=<name>once. It stores a developer credential for the service, and the sameWifconfiguration finds it on your machine - see Local development.
Which call to use
builder.AddWestyxNexus(config) is the right call for most ASP.NET Core applications. The others
serve one side only:
Use one of them. Two calls create two clients, each with its own sync loop and live connection.
Wiring the packages explains the trade-offs.
Without ASP.NET Core
A console tool or a script creates the client itself and disposes it at the end:client.ConnectStream() after creating the client to receive changes
as they happen.
Next
Feature management
Nexus flags through
IFeatureManager and [FeatureGate].OpenFeature
The vendor-neutral flag API, with per-user targeting.
Workload identity
Authenticate without a static key.
Configuration
Every
NexusConfig option.