How barryvl/ct-werktool works
Purpose and deployment shape
CT Werktool is an internal portal for customer requests, projects, employees, and HRM access. It is a React single-page frontend backed by an ASP.NET Core Web API and PostgreSQL. In combined mode, the backend serves the built React assets and API from one origin; Cloudflare Tunnel can expose that host externally.
• Start-Werktool.ps1
• backend/Program.cs
• frontend/src/main.tsx
Backend host and request boundary
The ASP.NET Core application is the runtime composition root: it configures API handling, database access, access-gate behavior, and likely static-file hosting for the built frontend. Local development can separate Vite and API, while production/tunnel traffic reaches the backend host directly.
• backend/Program.cs
• backend/appsettings.json
• backend/Properties/launchSettings.json
Shared test access gate
External access is protected by a shared Basic Authentication-style gate, configured with AccessGate:Password through .NET User Secrets. Requests from non-local clients are rejected if this password is absent. This is explicitly a temporary perimeter mechanism, not employee identity or authorization.
• backend/Program.cs
• backend/appsettings.Development.json
Customer-request domain and API
Customer requests are the primary persisted workflow. The request model is paired with submitted answers, and the controller forms the API boundary used by the portal. EF migrations establish these tables and evolve their relationship.
• backend/Controllers/KlantaanvragenController.cs
• backend/Models/Klantaanvraag.cs
• backend/Models/AanvraagAntwoord.cs
Employee and HRM domain
Employee records support the employee and HRM portions of the portal. Stored roles/permissions are not yet enforced server-side, so clients must not be treated as an authorization boundary.
• backend/Controllers/MedewerkersController.cs
• backend/Models/Medewerker.cs
• frontend/src/MedewerkersPage.tsx
Persistence and schema lifecycle
Entity Framework Core connects the API to PostgreSQL through a configured default connection. ApplicationDbContext is the central persistence boundary; schema changes are versioned as migrations and applied before combined startup.
• backend/Data/ApplicationDbContext.cs
• backend/Migrations/20260724075508_InitialCreate.cs
• backend/Migrations/ApplicationDbContextModelSnapshot.cs
Frontend application flow
The React/Vite application selects portal, employee, and HRM views. A centralized API module is the frontend-to-backend integration point; Vite proxies API calls locally, avoiding cross-origin behavior during development.
• frontend/src/App.tsx
• frontend/src/Api.ts
• frontend/src/PortalPage.tsx
• frontend/src/HrmPage.tsx
Infrastructure and external dependencies
Material runtimes are .NET 10, Node.js/npm, React 19, TypeScript, Vite, PostgreSQL, and EF Core. Cloudflare Tunnel forwards the public hostname to the single local backend listener without inbound router ports. The current public-access design requires secret management through .NET User Secrets and Cloudflare administration.
• backend/backend.csproj
• frontend/package.json
• frontend/vite.config.ts
Main entry points: Program.cs ASP.NET Core host · Api.ts API client · App.tsx React portal app · ApplicationDbContext.cs ApplicationDbContext
Components 19
Frontend
- React portal app · Selects portal, employee, and HRM views.
frontend/src/App.tsx - Frontend entry
frontend/src/main.tsx - Customer request view
frontend/src/PortalPage.tsx - Employee view
frontend/src/MedewerkersPage.tsx - HRM view
frontend/src/HrmPage.tsx - API client · Centralized browser-to-API boundary.
frontend/src/Api.ts - Vite API proxy · Proxies local API calls to avoid cross-origin behavior.
frontend/vite.config.ts
Backend API
- ASP.NET Core host · Serves API and built frontend assets in combined mode.
backend/Program.cs - Temporary access gate · Rejects non-local requests when the User Secrets password is absent.
backend/Program.cs - Customer requests API
backend/Controllers/KlantaanvragenController.cs - Employees API · Stored roles and permissions are not server-enforced.
backend/Controllers/MedewerkersController.cs
Persistence
- Request and answers · A request is persisted with submitted answers.
backend/Models/Klantaanvraag.cs - Employee record
backend/Models/Medewerker.cs - ApplicationDbContext · Central database persistence boundary.
backend/Data/ApplicationDbContext.cs - Schema migrations · Versioned schema lifecycle applied before combined startup.
backend/Migrations/20260724075508_InitialCreate.cs - PostgreSQL
External Access
- Cloudflare Tunnel · Forwards the public hostname to the backend listener.
- User Secrets · Supplies AccessGate:Password.
backend/appsettings.Development.json
Other components
- Combined startup
Start-Werktool.ps1
Connections 22
- Combined startup → ASP.NET Core host: starts
- Cloudflare Tunnel → ASP.NET Core host: public traffic
- Frontend entry → React portal app: mounts
- React portal app → Customer request view: renders
- React portal app → Employee view: renders
- React portal app → HRM view: renders
- Customer request view → API client: uses
- Employee view → API client: uses
- HRM view → API client: uses
- API client → Vite API proxy: local development
- Vite API proxy → ASP.NET Core host: proxies /api
- API client → ASP.NET Core host: combined mode
- ASP.NET Core host → Temporary access gate: applies
- User Secrets → Temporary access gate: password
- ASP.NET Core host → Customer requests API: routes
- ASP.NET Core host → Employees API: routes
- Customer requests API → Request and answers: handles
- Employees API → Employee record: handles
- Request and answers → ApplicationDbContext: mapped by
- Employee record → ApplicationDbContext: mapped by
- ApplicationDbContext → PostgreSQL: EF Core connection
- Schema migrations → PostgreSQL: evolves schema