Auth wired. Docker ready. Just clone and build.
git clone https://github.com/YOUR_USERNAME/WebApiReact.git
cd WebApiReact
docker compose up --build| Service | URL |
|---|---|
| Frontend | http://localhost:3000 (Docker) / :5173 (dev) |
| API | http://localhost:5000 |
| Swagger | http://localhost:5000/swagger |
| Health | http://localhost:5000/health |
| Backend | Frontend |
| JWT Auth (register/login/refresh/me) | Login/Register/Dashboard pages |
| Global exception middleware + traceId | Protected routes + auth guards |
| Request logging (method/path/status/duration/IP) | Zustand auth state management |
| Serilog (console + daily file rotation) | Axios with JWT auto-refresh on 401 |
| EF Core auto-migrations on startup | Tailwind CSS v4 + reusable components |
| CORS, Health checks, Swagger, Docker | TypeScript throughout |
Frontend (:5173) — React 19 + Vite 6 + Tailwind v4
│ HTTP (JWT Bearer)
Backend (:5000) — .NET 10 Clean Architecture
│
├── API (Controllers + Middleware)
├── Application (Interfaces + DTOs)
├── Domain (Entities)
└── Infrastructure (EF Core + JWT)
│
Database (:1433) — MS SQL Server 2022
Backend/src/
├── API/
│ ├── Controllers/AuthController.cs ← register, login, refresh, me
│ ├── Middleware/ExceptionMiddleware.cs ← catches all → {status, detail, traceId}
│ ├── Middleware/RequestLoggingMiddleware.cs ← logs every request
│ └── Program.cs ← pipeline: Exception → Logging → CORS → Auth
├── Application/
│ ├── Interfaces/IApplicationDbContext.cs
│ ├── Interfaces/ITokenService.cs
│ └── DTOs/Auth/AuthDtos.cs
├── Domain/Entities/
│ ├── User.cs ← IdentityUser<Guid> + ISoftDeletable
│ ├── Role.cs ← IdentityRole<Guid>
│ └── UserRole.cs ← join table
└── Infrastructure/
├── Data/ApplicationDbContext.cs
├── Authentication/JwtTokenService.cs ← HS256, 15min access, refresh rotation
└── Services/CurrentUserService.cs
Frontend/src/
├── api/client.ts ← Axios + JWT interceptor + auto-refresh on 401
├── store/authStore.ts ← Zustand: user, isAuthenticated, loading
├── components/
│ ├── Button.tsx, Input.tsx
│ └── Layout.tsx ← Nav bar + Outlet
├── pages/
│ ├── Login.tsx, Register.tsx
│ └── Dashboard.tsx
└── App.tsx ← Router + ProtectedRoute + PublicRoute
- Add Entity →
Backend/src/Domain/Entities/ - Add DTO →
Backend/src/Application/DTOs/ - Add Controller →
Backend/src/API/Controllers/ - Add Page →
Frontend/src/pages/ - Add Route →
Frontend/src/App.tsx
🤖 AI CONTEXT — Copy-paste this for any AI
=== FULL PROJECT CONTEXT: WebApiReact (.NET 10 + React 19) ===BACKEND KEY FILES:
- AuthController.cs: POST /api/auth/register, /login, /refresh, GET /api/auth/me
- ExceptionMiddleware.cs: Catches all exceptions → {status, detail, traceId}
- RequestLoggingMiddleware.cs: Logs method/path/status/duration/IP/user
- Program.cs: Pipeline = ExceptionHandler → RequestLogging → CORS → Auth → Controllers
- User.cs: IdentityUser<Guid> + FirstName, LastName, RefreshToken, RefreshTokenExpiry, Provider, IsActive, IsDeleted
- ApplicationDbContext.cs: IdentityDbContext<User, Role, Guid>, soft-delete on User
- JwtTokenService.cs: HS256, 15min access token, 64-byte refresh token, ValidateToken()
FRONTEND KEY FILES:
- client.ts: Axios instance at VITE_API_URL (default http://localhost:5000), JWT interceptor + auto-refresh
- authStore.ts: Zustand store (user, isAuthenticated, loading, login, register, logout, checkAuth)
- App.tsx: BrowserRouter, ProtectedRoute (redirects /login), PublicRoute (redirects /)
- Layout.tsx: Nav bar with user email + logout, <Outlet>
PACKAGES: Backend: MediatR, FluentValidation, EF Core SqlServer, Identity, JwtBearer, Serilog, Swagger, HealthChecks Frontend: react-router-dom, zustand, axios, tailwindcss v4, lucide-react, clsx, tailwind-merge
CONFIG: appsettings.json: ConnectionStrings:DefaultConnection (LocalDB), Jwt:Secret/Issuer/Audience .env: VITE_API_URL=http://localhost:5000 docker-compose.yml: sqlserver(:1433) + api(:5000→8080) + frontend(:3000→80)
ALREADY BUILT (DO NOT REBUILD): Auth endpoints, global exception handler, request logger, Serilog, auto-migrations, CORS, health checks, Swagger, Docker, protected routes, Zustand auth, Axios interceptors
MY REQUEST: [Describe your issue or feature here]
docker compose up --build| Service | Image | Port |
|---|---|---|
| Database | mssql/server:2022-latest | 1433 |
| API | .NET 10 ASP.NET | 5000 |
| Frontend | nginx:alpine | 3000 |