How mr-jafri/crudify works
Project Type and Purpose
• Crudify is a full-stack CRUD application.
• Backend: ASP.NET Core Web API using Clean Architecture layers (API, Application, Domain, Infrastructure).
• Frontend: Next.js + TypeScript SPA/SSR for user login and student management.
File Structure
• Top-level Division:
• crudify-api (backend)
• crudify-web (frontend)
• Backend Layers (Clean Architecture):
• Api: Controllers, Middlewares, ActionFilters, Swagger setup
• Application: DTOs, Interfaces, Services (AuthService, StudentsService, TokenService, LoggingService)
• Domain: Core entities (Student, ApplicationUser, RefreshToken, JwtSettings, ActivityLog, ExceptionLog)
• Infrastructure: EF Core DbContext, Migrations, FluentConfigurations, SQL seed scripts, context factory
• Frontend Modules:
• app/: Pages (login, students list, add/edit forms)
• auth/: Context API for JWT authentication, ProtectedRoute
• components/: Reusable UI (buttons, hook-form helpers)
• services/: axios instance, studentService for API calls
• hooks, routes, sections: navigation, parametrization, form and view components
README for Additional Insights
• Clean Architecture pattern on backend
• JWT-based auth, Swagger UI for testing
• Automatic EF migrations and SQL seeding
• Next.js routed pages with ‘use client’ segregation
• Protected routes and AuthContext challenges
a. Main Components
• Frontend (Next.js)
– Pages: Login, StudentList, StudentForm
– AuthContext & ProtectedRoute
– HTTP client (axios)
• API Gateway (ASP.NET Core Web API)
– Controllers: AuthController, StudentsController
– Middlewares: ActivityLogging, ExceptionLogging
– ActionFilters: TokenAuthentication
– Swagger UI
• Application Layer (Business Logic)
– AuthService, StudentsService, TokenService, LoggingService
• Domain Layer (Entities & Models)
• Infrastructure Layer
– EF Core DbContext (ApplicationContext)
– Fluent Entity Configurations
– Migrations + SQL Seed Scripts
• Database (SQL Server or configured RDBMS)
• External Clients
– Swagger UI for manual testing
– HTTP clients (Postman, browser via axios)
b. Relationships and Data Flow
1. User → Browser → Next.js Page
2. Next.js (AuthContext) attaches JWT → axios → API Controller
3. Controller calls Application Service → Domain Entities → Infrastructure DbContext
4. DbContext executes SQL (migrations/seedings) → Database
5. Responses bubble back through layers → Controller → Frontend
6. Middleware logs activities/exceptions to DB
c. Architectural Patterns & Design Principles
• Layered (Clean) Architecture
• Dependency Injection in API and Infrastructure
• Separation of Concerns: UI / API / Business Logic / Data Access
• JWT Authentication filter & context provider
• Middleware pipeline for cross-cutting concerns
• EF Core Code-First Migrations + Embedded SQL seeding
d. Key Technologies & Frameworks
• Backend: .NET 9, ASP.NET Core, EF Core, Swagger, SQL Server
• Frontend: Next.js, React, TypeScript, axios, React Context API
• Testing: xUnit for API/Application unit tests
Detail and Separation
• DbContext and seed execution sub-component
• Next.js AuthContext and ProtectedRoute module