# RELAMS System Architecture

## 1. Project Overview

RELAMS is an enterprise Real Estate & Land Management System for managing real-estate assets and business operations. It is built as a monolithic web application with server-rendered Blade views and a module-based backend.

## 2. Technology Stack

- PHP ^8.2
- Laravel 12
- Blade templating engine
- Vite frontend build
- Bootstrap CSS
- Axios for AJAX requests
- spatie/laravel-permission for roles and permissions
- barryvdh/laravel-dompdf for PDF generation
- maatwebsite/excel and rap2hpoutre/fast-excel for Excel exports
- Livewire available in dependencies

## 3. Application Structure

### Main directories

- `app/Http/Controllers/V1/Web/` - main web controllers by module
- `app/Models/` - Eloquent models and domain entities
- `app/Enum/` - status and type enums used across the app
- `app/Services/` - business service classes
- `app/Traits/` - shared reusable traits
- `app/Helpers/Helper.php` - global helper functions
- `resources/views/` - Blade templates organized by module
- `resources/js/` - frontend entry points
- `routes/web.php` - web route definitions
- `composer.json` / `package.json` - dependency and script definitions


## 4. Middleware and Controller Architecture

### Controllers
RELAMS is using controllers to define the functionality of the software and is following versioning structure, for the purpose of simplifying scalability and upgrade.
the structure is at follows:
- `Controllers/V1/Web`
- `Controllers/V1/API` etc

The web Controllers are meant to serve the web request via browser. They are as follows :
- `AuthController`
- `AuthController`

### Middlewares
Our middleware structure is straight forward and RELAMS use the existing built-in structure. Our existing middleware are as follows:
- `Authenticate` middleware for authentication.
- `BlockUserAgent` middleware for blocking unwanted agents from accessing the software core functionalities.
- `CheckPermission` middleware for checking the level of user permission.

## 4. Routes Architecture
We have two main routes sections: 
- Web - for web request generated from browser
- API - an api request mostly generated by any type of clients that accept and respond using json.

### Web Routes

#### General
- `/` → Home Page
- `/auth/signin` → `AuthController@signin`
- `/app` → `AuthController@signin`

#### Authentication
- (GET) `auth/` → Sign In Page(supposed to be landing page)
- (GET) `/auth/signin` → Sign In Page
- (POST) `/auth/signin` → Sign In functionality
- (POST) `/auth/signout` → Sign OUT functionality

#### 
- (GET) `auth/` → Sign In Page(supposed to be landing page)
- (GET) `/auth/signin` → Sign In Page
- (POST) `/auth/signin` → Sign In functionality
- (POST) `/auth/signout` → Sign OUT functionality