Skip to content


You can modify BaGet's configurations by editing the appsettings.json file.

Require an API Key

You can require that users provide a password, called an API Key, to publish packages. To do so, you can insert the desired API key in the ApiKey field.


Users will now have to provide the API key to push packages:

dotnet nuget push -s http://localhost:5000/v3/index.json -k NUGET-SERVER-API-KEY package.1.0.0.nupkg

Enable Read-Through Caching

Read-through caching lets you index packages from an upstream source. You can use read-through caching to:

  1. Speed up your builds if restores from are slow
  2. Enable package restores in offline scenarios

The following Mirror setting configures BaGet to index packages from


    "Mirror": {
        "Enabled":  true,
        "PackageSource": ""



PackageSource is the value of the NuGet service index.

Enable Package Hard Deletions

To prevent the "left pad" problem, BaGet's default configuration doesn't allow package deletions. Whenever BaGet receives a package deletion request, it will instead "unlist" the package. An unlisted package is undiscoverable but can still be downloaded if you know the package's id and version. You can override this behavior by setting the PackageDeletionBehavior:


    "PackageDeletionBehavior": "HardDelete",


Enable Package Overwrites

Normally, BaGet will reject a package upload if the id and version are already taken. You can configure BaGet to overwrite the already existing package by setting AllowPackageOverwrites:


    "AllowPackageOverwrites": true,


Private Feeds

A private feed requires users to authenticate before accessing packages.


Private feeds are not supported at this time! See this pull request for more information.

Database Configuration

BaGet supports multiple database engines for storing package information:

  • MySQL: MySql
  • SQLite: Sqlite
  • SQL Server: SqlServer
  • PostgreSQL: PostgreSql
  • Azure Table Storage: AzureTable

Each database engine requires a connection string to configure the connection. Please refer to to learn how to create the proper connection string for each database engine.

You may configure the chosen database engine either using environment variables or by editing the appsettings.json file.

Environment Variables

There are two environment variables related to database configuration. These are:

  • Database__Type: The database engine to use, this should be one of the strings from the above list such as PostgreSql or Sqlite.
  • Database__ConnectionString: The connection string for your database engine.


The database settings are located under the Database key in the appsettings.json configuration file:


    "Database": {
        "Type": "Sqlite",
        "ConnectionString": "Data Source=baget.db"


There are two settings related to the database configuration:

  • Type: The database engine to use, this should be one of the strings from the above list such as PostgreSql or Sqlite.
  • ConnectionString: The connection string for your database engine.