Skip to main content

Setup Using NuGet Package

You finish with an Endatix API on https://localhost:5001 that Hub can call at http://localhost:3000. The template writes the project, the development settings, and the first user. It does not start a database or Docker.

Endatix.Templates is published with the Endatix API release: nuget.org for a stable release, GitHub Packages for a canary. Until that package is on the feed you use, create the host with dotnet new web and dotnet add package Endatix.Hosting, then follow Already have a project?.

Meet the System Requirements first: the .NET 10 SDK, and either SQL Server or PostgreSQL (pg_trgm on PostgreSQL).

Create the API​

  1. Install the template and create the project. SQL Server is the default.
dotnet new install Endatix.Templates
dotnet new endatix -n My.Endatix.ApiHost
cd My.Endatix.ApiHost
  1. Point ConnectionStrings:DefaultConnection in appsettings.Development.json at a server you can reach. The generated password is a placeholder.

SQL Server default:

Server=localhost;Database=endatix;User Id=sa;Password=yourStrong(!)Password;TrustServerCertificate=True;
  1. Run the API. dotnet run uses the https profile (it is first in launchSettings.json): https://localhost:5001 and http://localhost:5000, which is what Hub's ENDATIX_BASE_URL expects. dotnet run --launch-profile http is HTTP only.
dotnet run
  1. Open https://localhost:5001/health/ui and https://localhost:5001/api-docs. Sign in as admin@localhost / P@ssw0rd, then change that password. The first run applies migrations and seeds sample data and sample forms (EnableAutoMigrations, SeedSampleData, SeedSampleForms).

PostgreSQL​

Pass --database postgresql in step 1. The connection string becomes:

Host=localhost;Port=5432;Database=endatix;Username=postgres;Password=postgres

DefaultConnection_DbProvider is postgresql. Create the pg_trgm extension before the first run. See System Requirements.

What the template already sets​

These values are in appsettings.Development.json only. Both signing keys are empty: in Development the API uses a random key for each run, so tokens and resume links stop working on restart. To keep them across restarts, and in every other environment, set each key to its own value from openssl rand -base64 48.

Endatix:Hub:HubBaseUrlDefault http://localhost:3000

Base URL the API uses for links to Hub.

Signs Hub access tokens. Set it to the output of openssl rand -base64 48.

Issuer for resource authorization tokens. Leave this unless you change Hub to match.

Signs submission resume links. Set it to its own output of openssl rand -base64 48.

Endatix:Data:InitialUser:EmailDefault admin@localhost

Created on first run.

Created on first run. Change it after you sign in.

Browser origin allowed to call the API. Hub's dev server is this origin.

(Optional) Pin the NuGet version: dotnet new endatix -n My.Endatix.ApiHost --EndatixVersion 0.7.8. The default is the Endatix version shipped with the template.

(Optional) --saasManagement adds the commercial Endatix.SaaS.Management package and registers the module. Use it with --database postgresql. Leave it off for the open-source API.

Already have a project?​

dotnet add package Endatix.Hosting
using Endatix.Hosting;

var builder = WebApplication.CreateBuilder(args);
builder.Host.ConfigureEndatix();

var app = builder.Build();
app.UseEndatix();
await app.RunAsync();

Copy ConnectionStrings and Endatix from an app created with dotnet new endatix, or follow Configuring Endatix.

Not in this template​

dotnet new endatix does not start containers or an SMTP server. For API, Hub, and SQL Server in Docker, use Self-Hosting using Docker. For mail, use Email settings.

Next steps​