fengling-console/docs/task-01-create-project-structure.md

101 lines
3.3 KiB
Markdown

# Task 1: Create Project Structure
## Task Description
**Files:**
- Create: `src/Fengling.AuthService/Fengling.AuthService.csproj`
- Create: `src/Fengling.AuthService/Program.cs`
- Create: `src/Fengling.AuthService/appsettings.json`
## Implementation Steps
### Step 1: Create project file
Run:
```bash
cd /Users/movingsam/Fengling.Refactory.Buiding/src
dotnet new webapi -n Fengling.AuthService -o Fengling.AuthService
```
### Step 2: Update project file with dependencies
Edit: `src/Fengling.AuthService/Fengling.AuthService.csproj`
```xml
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OpenIddict.AspNetCore" Version="7.2.0" />
<PackageReference Include="OpenIddict.EntityFrameworkCore" Version="7.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.0.1" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.3" />
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="OpenTelemetry" Version="1.11.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.11.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.11.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.11.0" />
</ItemGroup>
</Project>
```
### Step 3: Create appsettings.json
Create: `src/Fengling.AuthService/appsettings.json`
```json
{
"ConnectionStrings": {
"DefaultConnection": "Host=192.168.100.10;Port=5432;Database=fengling_auth;Username=movingsam;Password=sl52788542"
},
"OpenIddict": {
"Issuer": "https://auth.fengling.local",
"Audience": "fengling-api"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
```
### Step 4: Commit
```bash
git add src/Fengling.AuthService/
git commit -m "feat(auth): create authentication service project structure"
```
## Context
This is the first task of implementing the Fengling Authentication Service. We're building a standalone authentication service using OpenIddict for JWT token issuance and multi-tenant support. This task establishes the basic ASP.NET Core Web API project structure with all necessary dependencies including OpenIddict, EF Core, PostgreSQL, Serilog, and OpenTelemetry.
**Architecture**: ASP.NET Core Web API with OpenIddict for OAuth2/OIDC, PostgreSQL for user data.
**Tech Stack**: .NET 10.0, OpenIddict 7.2.0, EF Core 10.0, PostgreSQL, Serilog 9.0.0, OpenTelemetry 1.11.0.
**Working Directory**: `/Users/movingsam/Fengling.Refactory.Buiding/src`
## Verification
- [ ] Project file created successfully
- [ ] Target framework set to net10.0
- [ ] All NuGet packages added (latest versions)
- [ ] appsettings.json configured with connection string and OpenIddict settings
- [ ] Project builds successfully
- [ ] Committed to git
## Notes
- OpenIddict packages updated to 7.2.0 (latest)
- All dependencies updated to latest versions
- Used .NET 10.0 as target framework