How zuyd-hogeschool/narrowcasting works
1. Overall shape
- This is an ASP.NET Core application called Narrowcasting with a classic layered structure: UI layer (Razor Pages + controllers), service layer, data/model layer (EF Core), and Identity/authentication.
- The solution also includes a separate test project and a Dockerfile for containerized deployment.
2. Primary domain
- The app appears to manage a narrowcasting/digital-signage system: screens, playlists, playlist items, media files, announcements, departments, users, and audit logs.
- The domain models in Models/ are the core objects that flow through the app and are persisted by EF Core.
3. UI boundaries
- The application has two main UI surfaces:
- Admin area under Pages/Admin, used for managing users, screens, playlists, media files, departments, announcements, and audit logs.
- Public pages under Pages/Public, including Display and Cast, which are likely the playback/runtime-facing views for screens.
- There is also a conventional Pages/Shared layout structure and a separate Areas/Identity implementation for authentication pages.
4. Controllers vs Razor Pages
- The repo mixes MVC controllers in Controllers/ with Razor Pages in Pages/.
- The controllers likely expose CRUD or API-style endpoints for core resources such as announcements, playlists, screens, departments, users, and audit logs.
- The Razor Pages area is used for the admin dashboard and public-facing pages, keeping interactive site flows distinct from controller endpoints.
5. Service layer
- Business logic is concentrated in Services/ and abstracted behind interfaces in Interfaces/.
- Each major business concept has a service contract and implementation: IAnnouncementService, IPlaylistService, IScreenService, IMediaFileService, IDepartmentService, IAuditService, and IPlaylistItemService.
- ServiceExtensions.cs suggests a dependency-injection composition boundary where services are registered into the ASP.NET Core container.
6. Persistence and schema
- Data/ApplicationDbContext.cs is the EF Core database context and the main persistence boundary.
- The Migrations/ folder contains both Identity schema migrations and application model migrations, showing that Identity and domain data share the same database context or at least the same EF Core migration pipeline.
- The model snapshot indicates code-first schema management is the source of truth.
7. Authentication and user management
- Authentication is built on ASP.NET Core Identity, with a full generated identity UI under Areas/Identity.
- The app supports login, registration, password reset, 2FA, external login, account management, and email confirmation.
- Models/ApplicationUser.cs indicates the identity user has been extended to fit the application’s domain needs.
8. Authorization and roles
- The presence of Pages/Admin, AdminPageModel.cs, and dedicated UserController strongly suggests role-based access control around the admin functions.
- The separation between admin and public pages implies authorization is a key boundary: public playback pages are accessible broadly, while management pages are restricted.
9. Audit and operational visibility
- AuditLog and AuditLogsController / Pages/Admin/AuditLog indicate the system records administrative or data-change activity.
- This is a cross-cutting subsystem rather than a business object, likely used to trace changes to playlists, screens, media, and users.
10. Media and file handling
- MediaFile plus MediaFileService and the top-level UploadedFiles/ directory indicate the application stores uploaded content on disk rather than purely in the database.
- That creates a clear boundary between metadata in the database and binary assets on the filesystem.
- The Display/Cast pages likely consume those stored assets to render content on a target screen.
11. Playback/content composition flow
- A plausible main data flow is: admin uploads media → media is stored in UploadedFiles and indexed in the DB → playlists are assembled from playlist items → screens are assigned or scheduled content → public display pages render the resulting content.
- Schedule.cs in the models suggests time-based or rule-based playback is part of the content delivery model.
12. Testing and deployment
- NarrowcastingTest contains tests for at least login and screen behavior, indicating the app has some automated verification around authentication and screen-related logic.
- Dockerfile, .dockerignore, and serviceDependencies*.json show the project is prepared for containerized and possibly cloud deployment.
- appsettings*.json holds environment-specific configuration, likely including connection strings and identity/runtime settings.
Main entry points: IAnnouncementService.cs Service contracts · ApplicationDbContext.cs DbContext · Index.cshtml Admin UI · AnnouncementsController.cs Controllers
Components 21
UI
Razor Pages and MVC endpoints for admin and public-facing flows
- Admin UI · Management dashboard and CRUD surfaces
Narrowcasting/Pages/Admin/Index.cshtml - Public UI · Public playback and informational pages
Narrowcasting/Pages/Public/Index.cshtml - Controllers · Controller-based access to core resources
Narrowcasting/Controllers/AnnouncementsController.cs
Domain
Core application models and persistence
- DbContext · Main persistence boundary for Identity and domain data
Narrowcasting/Data/ApplicationDbContext.cs - User · Application-specific Identity user
Narrowcasting/Models/ApplicationUser.cs - Domain models · Screens, playlists, media, announcements, departments, schedules, and logs
Narrowcasting/Models/Announcement.cs - Announcements · Announcement business operations
Narrowcasting/Services/AnnouncementService.cs - Audit · Audit trail and activity recording
Narrowcasting/Services/AuditService.cs - Departments · Department management logic
Narrowcasting/Services/DepartmentService.cs - Media files · Uploaded file handling and media metadata
Narrowcasting/Services/MediaFileService.cs - Playlist items · Playlist composition logic
Narrowcasting/Services/PlaylistItemService.cs - Playlists · Playlist lifecycle and playback organization
Narrowcasting/Services/PlaylistService.cs - Screens · Screen management and assignment logic
Narrowcasting/Services/ScreenService.cs
Identity
ASP.NET Core Identity UI and user account flows
- Identity UI · Generated authentication and account management pages
Narrowcasting/Areas/Identity/Pages/Account/Login.cshtml
Support
Composition, deployment, tests, and runtime assets
- Program · ASP.NET Core app bootstrap and middleware pipeline
Narrowcasting/Program.cs - DI setup · Registers application services into the container
Narrowcasting/Services/ServiceExtensions.cs - Service contracts · Interfaces for business services and user context
Narrowcasting/Interfaces/IAnnouncementService.cs - User context · Current user and authorization context
Narrowcasting/Services/UserContextService.cs - Tests · Automated checks for login and screen behavior
NarrowcastingTest/NarrowcastingTest.csproj - Dockerfile · Container build and runtime definition
Narrowcasting/Dockerfile - Uploaded files · On-disk storage for media uploads
UploadedFiles
Connections 46
- Program → DI setup: uses · Bootstraps registered application services
- Program → DbContext: configures · Wires EF Core persistence into the app
- Program → Admin UI: hosts · Serves the admin Razor Pages surface
- Program → Public UI: hosts · Serves the public playback surface
- Program → Controllers: maps · Exposes controller endpoints
- Program → Identity UI: enables · Integrates ASP.NET Core Identity pages
- DI setup → Service contracts: registers · Binds contracts to concrete services
- Service contracts → Announcements: implemented by · Announcement service contract
- Service contracts → Audit: implemented by · Audit service contract
- Service contracts → Departments: implemented by · Department service contract
- Service contracts → Media files: implemented by · Media service contract
- Service contracts → Playlist items: implemented by · Playlist item service contract
- Service contracts → Playlists: implemented by · Playlist service contract
- Service contracts → Screens: implemented by · Screen service contract
- Service contracts → User context: implemented by · User context contract
- Announcements → DbContext: persists · Reads and writes announcements
- Audit → DbContext: persists · Stores audit events
- Departments → DbContext: persists · Stores departments
- Media files → DbContext: persists · Stores media metadata
- Media files → Uploaded files: stores files · Writes uploaded binary assets to disk
- Playlist items → DbContext: persists · Stores playlist item composition
- Playlists → DbContext: persists · Stores playlists
- Screens → DbContext: persists · Stores screen data
- User context → User: reads · Resolves current application user
- Admin UI → Announcements: uses · Admin management of announcements
- Admin UI → Audit: uses · Admin audit log viewing
- Admin UI → Departments: uses · Admin department management
- Admin UI → Media files: uses · Admin media upload management
- Admin UI → Playlists: uses · Admin playlist management
- Admin UI → Screens: uses · Admin screen management
- Admin UI → User context: uses · Admin authorization and user context
- Public UI → Playlists: reads · Displays playlist-driven content
- Public UI → Screens: reads · Looks up screen-specific playback state
- Public UI → Media files: reads · Resolves media assets for playback
- Controllers → Announcements: uses · Controller access to announcement operations
- Controllers → Audit: uses · Controller access to audit records
- Controllers → Departments: uses · Controller access to department operations
- Controllers → Playlists: uses · Controller access to playlist operations
- Controllers → Screens: uses · Controller access to screen operations
- Controllers → User context: uses · Controller access to user context
- Identity UI → User: authenticates · Built around the application user type
- DbContext → Domain models: maps · EF Core maps core domain entities
- DbContext → User: maps · EF Core maps the identity user model
- Tests → Identity UI: verifies · Covers login-related behavior
- Tests → Screens: verifies · Covers screen behavior
- Dockerfile → Program: packages · Builds and runs the ASP.NET Core app