How iath-dev/realestateproject works
Project type and purpose
• This is a full-stack application (“Million Real Estate”) comprising:
• Backend: .NET 8/9 C# API that reads/writes property data in MongoDB.
• Frontend: ReactJS (Vite) SPA served behind Nginx.
• Database: MongoDB (with optional Mongo Express UI).
• End-to-end tests via Cypress and unit tests via NUnit.
• Purpose: Expose property listings (with filters) via a REST API and render them in a responsive web UI.
File structure
• Top-level:
• docker-compose.yml & Makefile orchestrate containers (frontend, backend, mongo, mongo-express).
• backend/: “Clean Architecture” with three layers:
– RealEstate.API (Controllers, Program.cs, appsettings.json, Dockerfile)
– RealEstate.Core (DTOs, Entities, Interfaces, Mappings)
– RealEstate.Infrastructure (MongoDbContext, Repositories, Services)
– tests/ for Controllers and Services.
• frontend/: Vite-powered React app, preconfigured with Dockerfile, Nginx config, Cypress e2e tests, global store (Zustand or similar) and hooks.
• Build & deploy artifacts: Dockerfiles in each service, docker-compose.yml, Makefile targets (start, test, stop, clean).
README for additional insights
• Confirms tech stack: .NET + MongoDB + React/Next.js.
• Workflow: make start → builds images, runs containers, opens UI at localhost:3000.
• API endpoints documented via Swagger at localhost:8080.
• Emphasis on clean architecture, modular code, unit tests, performance.
a. Main components
1. User’s Browser (HTTP client)
2. Frontend Container (React SPA + Nginx)
3. Backend Container (ASP.NET Core Web API)
4. MongoDB Container (Data store)
5. Mongo Express Container (Optional DB UI)
b. Relationships & data flows
• Browser ←→ (HTTPS) ←→ Nginx → serves React assets
• React app → (HTTP/REST) → API Controllers in .NET
• Controllers → (calls) → Core Services → (calls) → Repositories → MongoDbContext → MongoDB
• Seed scripts populate MongoDB at startup (backend/data/seed/*.js)
• Cypress tests hit the frontend, mock fixtures for component/e2e tests.
• NUnit tests invoke service layer and controller endpoints directly.
c. Architectural patterns & principles
• Clean (Onion) Architecture: API layer → Core (domain + DTOs) → Infrastructure (DB and external concerns)
• Dependency Injection (services, repositories injected into controllers)
• Repository Pattern (GenericRepository + specialized repos)
• AutoMapper for DTO ↔ Entity mapping (MappingProfile)
• Containerization (Docker) & orchestration (docker-compose)
• Test-driven quality: NUnit + Cypress
d. Key technologies, frameworks, libraries
• Backend: .NET 8/9, C#, ASP.NET Core Web API, MongoDB.Driver, AutoMapper, Swashbuckle (Swagger), NUnit
• Frontend: React (with TSX), Vite, Zustand (store), Axios/fetch wrappers in src/api/services.ts, Cypress for e2e
• Infrastructure: Docker, docker-compose, Nginx
• Dev tools: Makefile, VSCode settings, ESLint/Prettier