Architecture
Eight projects working together — a .NET domain and API, a Next.js web dashboard, a 202-tool TypeScript MCP server for AI integration, shared MAUI libraries, and cross-platform Staff and Patient mobile apps.
System Overview
src/
├── Rdn.FacLT.Domain/ ← EF Core Domain (64 entities, code-first)
│ ├── Entities/ ← Tenant, Facility, Staff, Patient, Booking, ...
│ ├── EntityTypeConfigurations/ ← Fluent API + seed data (static readonly GUIDs)
│ └── Core/ ← EntityBase, DbContext, Interceptors, Config
│
├── Rdn.FacLT.Api/ ← .NET 10 REST API (43 controllers, CQRS/MediatR)
│ ├── Controllers/ ← ApiController base, AuthController, Mobile controllers
│ ├── Endpoints/ ← 34 entity sets × 5 handlers (~170 handler pairs)
│ │ ├── Settings/ ← FacilitySettings + TenantSettings (namespace isolation)
│ │ └── Shared/ ← Request models, PaginatedQueryHelper, DataTableListModel
│ └── Server/ ← Startup, Middleware, Auth, Swagger, Behaviors
│
├── rdn-faclt-web/ ← Next.js 16 Admin Dashboard
│ ├── app/(admin)/ ← Auth-protected pages (34 entity pages + AI agent chat)
│ ├── app/(site)/ ← Public pages (login, register, forgot-password)
│ ├── app/api/ ← API proxy + agent routes (SSE chat, model list)
│ ├── components/agent/ ← AgentChat, AgentInput, AgentMessageList, AgentToolCall
│ └── lib/agent/ ← MCP client, system prompt, types
│
├── rdn-faclt-mcp/ ← MCP Server (202 tools, stdio transport)
│ ├── src/tools/ ← 39 entity tool files + utilities (202 tools total)
│ ├── src/api-client.ts ← HTTP client (GET/POST/PUT/PATCH/DELETE) + ProblemDetails
│ └── src/response-formatter.ts ← Preserve IDs for multi-step AI workflows
│
├── Rdn.FacLT.Maui.UI/ ← Shared MAUI UI Controls
│ └── Calendar/ ← CalendarMonthView, CalendarWeekView, CalendarDayView, Toolbar
│
├── Rdn.FacLT.Maui.Core/ ← Shared MAUI Core (converters, branding, models)
│
├── Rdn.FacLT.Staff/ ← .NET MAUI Staff App (Android, iOS, macOS, Windows)
│ ├── Views/ ← LoginPage, DashboardPage, SchedulePage, BookingsPage,
│ │ BookingDetailPage, AvailabilityPage, PatientLookupPage
│ ├── ViewModels/ ← MVVM with CommunityToolkit.Mvvm
│ ├── Services/ ← AuthService (direct login), ApiClient, BrandingService
│ └── Helpers/ ← AppConfig (platform-aware dev URLs)
│
└── Rdn.FacLT.Patient/ ← .NET MAUI Patient App (Android, iOS, macOS, Windows)
├── Views/ ← LoginPage, RegisterPage, DashboardPage, BookingsPage,
│ BookingDetailPage, NewBookingPage, FacilitiesPage
├── ViewModels/ ← MVVM with CommunityToolkit.Mvvm
├── Services/ ← AuthService (direct login + registration), ApiClient
└── Helpers/ ← AppConfig (platform-aware dev URLs)Domain Layer
Rdn.FacLT.Domain — Entity Framework Core
Core Entities
Core Infrastructure
- EntityBase with Id, DateCreated, DateModified, IsDeleted
- IAuditable, ISoftDeletable, ISortable interfaces
- ApplicationDbContext with AuditSaveChangesInterceptor
- Data Protection encryption via [Protected] attribute
- AppConfiguration with DotEnv environment loading
- MigrationsDbContextFactory for EF Core CLI
- 10 EntityTypeConfigurations with seed data
API Layer
Rdn.FacLT.Api — .NET 10 / ASP.NET Core
CQRS Pattern
Every operation is a MediatR command or query. Create, Update, Delete are commands; GetAll and GetById are queries. Each handler has its own file with request/response models.
Pipeline Behaviors
LoggingBehavior logs every request with timing. ExceptionHandlingBehavior catches DbUpdateException (400), ConcurrencyException (409), and SqlException with mapped error codes.
Authentication
Dual auth: JWT Bearer tokens for user sessions and API key authentication (X-Api-Key header) for machine-to-machine. API keys validate against TenantSettings.LicenseClientId.
Web Dashboard
rdn-faclt-web — Next.js 16 / React 19
Route Structure
Admin Routes (34 entity pages + agent)
/admin — Dashboard
Tenants
/admin/tenants — Tenant list
/admin/tenant-settings — Tenant settings
/admin/tenant-statuses — Tenant statuses
Facilities
/admin/facilities — Facility list
/admin/facility-settings — Facility settings
/admin/hours-of-operation — Hours of operation
/admin/stations — Station list
People
/admin/staff — Staff list
/admin/patients — Patient list
/admin/patient-statuses — Patient statuses
/admin/patient-facilities — Patient facilities
Scheduling
/admin/bookings — Booking list
/admin/booking-statuses — Booking statuses
/admin/availability — Availability
/admin/schedules — Schedule list
/admin/shifts — Shift CRUD
/admin/shift-logs — Shift logs
/admin/booking-logs — Booking logs
Admin Routes (continued)
Services & Access
/admin/services — Service list
/admin/service-types — Service types
/admin/roles — Role list
Supply Chain
/admin/suppliers — Supplier list
/admin/supplies — Supply list
Contact Info
/admin/addresses — Addresses
/admin/address-types — Address types
/admin/email-addresses — Email addresses
/admin/email-address-types — Email addr types
/admin/phones — Phones
/admin/phone-types — Phone types
Geography & Notifications
/admin/countries — Countries
/admin/states — States
/admin/notification-types — Notification types
/admin/notification-templates — Templates
/admin/notification-log — Log (read-only)
AI
/admin/agent — AI agent chat
API Proxy Routes
/api/auth/external/callback — OAuth callback (PKCE token exchange)
/api/auth/logout — Logout + clear cookies
/api/agent/chat — SSE streaming agent chat
/api/agent/models — Available AI models
/api/admin/[entity] — List + Create (×31)
/api/admin/[entity]/[id] — Get + Update + Delete (×31)
Public Routes
/ — Landing page
/signin — OAuth sign-in redirect
MCP Server
rdn-faclt-mcp — 202 AI Tools
Tool Coverage
tenants_list, get, create, update, delete
tenant_settings_list, get, create, update, delete
tenant_statuses_list, get, create, update, delete
facilities_list, get, create, update, delete
facility_settings_list, get, create, update, delete
hours_of_operation_list, get, create, update, delete
staff_list, get, create, update, delete
patients_list, get, create, update, delete
patient_statuses_list, get, create, update, delete
patient_facilities_list, get, create, update, delete
bookings_list, get, create, update, delete
booking_statuses_list, get, create, update, delete
services_list, get, create, update, delete
service_types_list, get, create, update, delete
stations_list, get, create, update, delete
availability_list, get, create, update, delete
schedules_list, get, create, update, delete
schedule_statuses_list, get, create, update, delete
roles_list, get, create, update, delete
suppliers_list, get, create, update, delete
supplies_list, get, create, update, delete
addresses_list, get, create, update, delete
address_types_list, get, create, update, delete
countries_list, get, create, update, delete
states_list, get, create, update, delete
email_addresses_list, get, create, update, delete
email_address_types_list, get, create, update, delete
phones_list, get, create, update, delete
phone_types_list, get, create, update, delete
channel_types_list, get, create, update, delete
notification_types_list, get, create, update, delete
notification_templates_list, get, create, update, delete
notification_log_list, get (read-only)
notification_preferences_get, save
messaging_consents_list by patient/staff, create, revoke
device_registrations_register, unregister
shifts_list, get, create, update, delete
shift_logs_list, get (read-only)
booking_logs_list, get (read-only)
Design Decisions
Stdio Transport
Uses standard input/output for communication. Launched as a child process by MCP clients (Claude Code, Cursor, etc.).
Response Formatting
Preserves IDs in responses so the agent can use them in follow-up operations. Enables multi-step workflows like creating a facility under a specific tenant.
Confirmation Required
Delete operations include instructions requiring the AI to ask for user confirmation before proceeding. Safety first.
Error Translation
ProblemDetails responses from .NET are parsed into clear error messages. Validation errors include field names and descriptions.
Mobile Apps
Rdn.FacLT.Staff + Rdn.FacLT.Patient — .NET 10 MAUI
Staff App
Staff-facing mobile app for managing schedules, viewing bookings, updating availability, and profile management. Four shell tabs: Schedule, Bookings, Availability, Profile.
6 views · 6 view models · 5 DTOs
Callback: rdnfacltstaff://callback
Patient App
Patient-facing mobile app for viewing appointments, creating new bookings, browsing facilities, and profile management. Three shell tabs: Appointments, Facilities, Profile.
6 views · 6 view models · 4 DTOs
Callback: rdnfacltpatient://callback
Direct Auth via FacLT API
Both apps authenticate via direct API calls to FacLT which proxies to RdnId password grant. MFA passthrough with authenticator, email, and SMS. Access and refresh tokens stored in platform SecureStorage.
MVVM Architecture
CommunityToolkit.Mvvm 8.4.0 with ObservableObject, RelayCommand, and ObservableProperty attributes. CommunityToolkit.Maui 13.0.0 for UI converters and behaviors.
Platform-Aware Configuration
AppConfig loads from embedded appsettings.json. In debug mode, Android emulator routes to 10.0.2.2 to reach host localhost; iOS uses localhost directly.