How haneen-1027/cap works
Project type and purpose
• This is a full-stack web application for managing and delivering coding and quiz assessments.
• The front end is a React single-page application (SPA).
• The back end is a .NET Core REST API with layered architecture (Controllers → Services → Data/EF Core → SQL).
• There’s also integration with an external code-execution engine (Judge0) and JWT-based authentication.
File structure
• Top level:
• Backend/CapApi – .NET Core solution with Controllers, Services, Models, DTOs, EF Core DbContext, appsettings.json.
• Backend/CapApi.Tests – unit tests for services.
• Database – SQL schema/script.
• Frontend/client – React app (create-react-app) with pages, components, context, API handler.
• Architectural patterns:
• Backend uses layered MVC-style pattern (API controllers delegate to service classes which use EF Core for data access).
• DTOs separate external contracts from internal models.
• Frontend uses component-based architecture organized by user roles (Admin, Company, Contributor, Landing).
• Config & deployment clues:
• appsettings.json for DB and JWT settings.
• CapApi.http for manual testing.
• qodana.yaml suggests static analysis/CI integration.
Extract insights from README
• (Empty in this case—so rely on file tree and naming conventions.)
Main components & interactions
a. Frontend SPA (React)
• Modules: LandingPage, Admin dashboard, Company dashboard, Contributor dashboard
• Context & utilities: DarkMode, API handler, time utils
• Communicates via HTTPS/REST with the Back End.
b. Back End API (.NET Core)
• Controllers (AssessmentController, AuthController, etc.)
• Services layer (Assessment services, Question services, User services, Judge0Service, JwtKeyGenerator)
• Data layer: EF Core DbContext against SQL Server (Coding_Assessment_Database.sql)
• Models & DTOs: internal entities vs. transport objects
• Authentication: JWT issuance & validation
c. Database
• SQL database with tables matching Models (User, Assessment, Question, Submission, TestCase, etc.)
d. External service
• Judge0 code execution API for running submitted code and returning test results
• React UI → AuthController (login/signup) → JwtKeyGenerator → return token → stored in client
• React UI (with token) → any secured Controller → validate JWT → pass through Services → DbContext → SQL DB
• React UI → CodeController → Judge0Service → external Judge0 API → returns execution result → React UI
• Services → Models → Data → EF Core → SQL Database
Architectural patterns
• Layered architecture on the back end (Controller → Service → Data).
• Dependency injection of services and DbContext in Program.cs.
• DTOs and models separate concerns.
• On the front end, role-based routing/components via React Router (implied by pages folder).
Additional notes
• Don’t clutter with every single React component—group them by role (Admin UI, Company UI, Contributor UI, Landing UI).