| name | storm-api-init |
| description | Initialize a new Storm.Api project with NuGet packages, Program.cs, Startup.cs, and code style configuration. Use when setting up a new project from scratch. |
| user-invocable | true |
| disable-model-invocation | false |
You are helping initialize a new Storm.Api project. Follow all patterns below exactly — this covers the one-time project setup. For global rules (logging, extensions, anti-patterns), see /storm-api.
The user's request: $ARGUMENTS
NuGet Packages
<PackageReference Include="Storm.Api" Version="*" />
<PackageReference Include="Storm.Api.Dtos" Version="*" />
<PackageReference Include="Storm.Api.SourceGenerators" Version="*" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<PackageReference Include="ServiceStack.OrmLite.SqlServer" Version="*" />
Do NOT add: Entity Framework Core, Dapper, Microsoft.Extensions.Logging.Abstractions, any other ORM.
Program.cs
DefaultLauncher<Startup>.RunWebHost(args);
With options:
DefaultLauncher.UseNewtonsoftJson = true;
DefaultLauncher.UseVault = true;
DefaultLauncher.SetDatabaseDebug = true;
DefaultLauncher<Startup>.RunWebHost(args);
Always prefer System.Text.Json — only set UseNewtonsoftJson when explicitly instructed.
Startup.cs
public class Startup : BaseStartup
{
public Startup(IConfiguration configuration, IWebHostEnvironment env) : base(configuration, env)
{
UseMigrationModules(new AppMigrationModule());
}
public override void ConfigureServices(IServiceCollection services)
{
base.ConfigureServices(services);
RegisterConsoleLogger(services, LogLevel.Debug);
services.AddRepository<UserEntity, UserRepository>();
services.AddLongRepository<ProductEntity, ProductRepository>();
services.AddScoped<IActionAuthenticator<CurrentUser>, JwtAuthenticator>();
services.AddScoped<MyService>();
}
}
BaseStartup automatically configures: CORS (all origins), OpenAPI/Scalar (dev only), Brotli+Gzip compression, request localization, database module.
Migration Module stub
Check /storm-api-database-migrations for examples of writing migrations, seeding data, and checking schema existence
Code Style (Enforced Globally)
Set these in your .csproj or Directory.Build.props:
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
Key Namespaces (Storm.Api 10.x)
| Type | Namespace |
|---|
DefaultLauncher<TStartup>, BaseStartup | Storm.Api.Launchers |
BaseMigrationModule, BaseMigration, IMigration, IMigrationModule | Storm.Api.Databases.Migrations.Models |
IActionAuthenticator<T>, JwtAuthenticator, refresh-token base actions | Storm.Api.Authentications.* |
Repository DI extensions (AddRepository, AddLongRepository) | Storm.Api.Databases.Extensions |
ILogService | Storm.Api.Logs |
If a symbol is missing from BaseStartup or a Storm.Api type doesn't resolve, inspect the DLL under ~/.nuget/packages/storm.api/<version>/lib/<tfm>/Storm.Api.dll — the namespaces above are authoritative for 10.x and supersede older docs.