An enterprise-grade full-stack platform for renting and operating self-storage units end-to-end — from live interactive unit maps, timed payment holds, and PayOS webhooks to QR/PIN smart door access, Vietnamese PDF contracts, renewals, inspections, and deposit refunds across 12 facilities and 5 user roles.
About · Rental Lifecycle · 5 Role Portals · Engineering Highlights · Architecture & Workers · Quickstart · Demo Accounts
SafeSpace was engineered as a capstone team project at FPT University (Sep – Nov 2026) and defended before the university's evaluation council.
- The original team repository (with full sprint issues & pull requests) lives at
ryocoding13/SSFRMS. - This repository preserves the full commit history and serves as my actively maintained edition where I continue refining workflows, UI polish, and operational reliability.
| Metric | Scope |
|---|---|
| Facilities & Roles | 12 facilities across Ho Chi Minh City & neighboring areas · 5 strictly scoped roles |
| Domain Data Model | 25 SQL Server tables modeled via EF Core + idempotent DbSeeder |
| Backend Automation | 6 background workers (PayOS reconciliation, cash hold & renewal expiry, overdue escalation, emails, workflows) |
| Automated Verification | 50 backend unit test files + 8 API integration test files (xUnit) + 30+ frontend test suites & Playwright E2E |
flowchart LR
A["1. Browse 12 Facilities\n(Leaflet Map & Live Unit Grid)"] --> B["2. Reserve & Hold Unit\n(15m Online / 24h Counter)"]
B --> C["3. PayOS QR Webhook\nor Counter Cash Collection"]
C --> D["4. QuestPDF Contract\n+ MailKit Email Delivery"]
D --> E["5. Staff Handover\n(Unit -> OCCUPIED, Contract -> ACTIVE)"]
E --> F["6. QR / PIN Smart Door\n(Valid During Rental Window)"]
F --> G{"End of Term?"}
G -->|"Extend"| H["Renewal Approval\n& Optional Unit Move"]
G -->|"Return"| I["Return Inspection\n+ Photo Evidence"]
I --> J["Manager Settlement\n& Deposit Refund"]
| Role | Portal Scope & Capabilities |
|---|---|
| 👤 Customer | Explore all 12 facilities on an interactive Leaflet map; inspect live unit availability by start date; book units for 1–99 months; pay online via PayOS or at the counter; unlock doors with time-bound QR / PIN credentials; download Vietnamese PDF contracts; request renewals, book return appointments, and submit contract-linked support tickets. |
| 🧑🔧 Facility Staff | Dedicated daily task board for scheduled check-ins, returns, and support requests; collect counter payments; execute formal unit handovers; perform physical return inspections with photo evidence; log and resolve on-site facility incidents. |
| 🧑💼 Facility Manager | Manage facility unit inventory, statuses, and pricing; allocate units and approve contract renewals (including unit moves); monitor overdue contracts & cases; confirm final settlements and deposit refunds in one click; review facility performance reports. |
| 📊 Operations Manager | Cross-facility business governance across all 12 sites; author and version deposit, renewal, cancellation, return, and overdue policies (with tracked customer consent); configure fee schedules & discounts; monitor system-wide revenue and occupancy analytics. |
| 🛡️ System Admin | Manage user accounts, roles, and facility-scoped active assignments (max 1 active facility per staff/manager); audit login history and activity logs; operate built-in Smart Door QR Simulator and demo/rate/contract diagnostic tools. |
- 🗺️ Live Interactive Unit Map & Timed Holds: Displays
AVAILABLE,OCCUPIED(with expected end date),RETURN_PENDING,MAINTENANCE, and actively held units with a live countdown timer — preventing double-bookings during checkout. - 🔐 Time-Bound QR / PIN Door Access & Simulator: Credentials are validated server-side against active contract windows and automatically locked starting from the return appointment date. Includes an interactive camera/image QR Door Simulator (
jsQR+ live door state scenes) for testing physical access flows without hardware. - 💳 PayOS Gateway & Payment Integrity: Supports real-time PayOS webhook confirmation plus a background
PayOSReconcileWorkerfor resilience, paired with timed holds (15 min online, 24 h at the counter) enforced byExpiredCashHoldWorker. - 📄 Automated Vietnamese Legal Contracts: Generates structured Vietnamese rental contracts on the server with QuestPDF and dispatches them asynchronously via MailKit (
CustomerEmailWorker). - 🧾 Strict Domain Rules (
BR01–BR30):- Half-open rental intervals
[start_date, end_date)(s1 < e2 && s2 < e1non-overlap guarantee — a unit is never double-allocated). - Transactional & idempotent critical workflows (reservation, allocation, payment, renewal, handover).
- Immutable price snapshots locked on contracts and renewals so future rate edits never rewrite historical agreements.
- Decoupled physical inspection vs. financial settlement: units return to
AVAILABLEonly after a completed inspection, and overdue contracts never silently free up occupied units. - Server-side facility-scoped RBAC and full audit trail on every role, pricing, policy, allocation, contract, and payment mutation.
- Half-open rental intervals
flowchart TB
subgraph Client["React 19 + Vite 8 Multi-Portal SPA (SafeSpace-Customer-UI)"]
CUST["Customer Portal\n(#/home, #/find, #/units, #/payments, #/support)"]
OPS["Staff & Manager Portals\n(#/staff/*, #/manager/*)"]
BIZ["Operations & Admin Portals\n(#/business/*, #/admin/*, QR Door Simulator)"]
end
subgraph Api["StorageProject.Api (.NET 10 Minimal API)"]
EP["20+ Endpoint Modules\nJWT Auth · Rate Limits · Swagger · /health"]
WK["6 Background Workers\nPayOSReconcile · ExpiredCashHold · ExpiredRenewal\nOverdue · FacilityWorkflow · CustomerEmail"]
end
subgraph Domain["Core & Infrastructure Layers"]
CORE["StorageProject.Core\n25 Entities · DTOs · Service Interfaces"]
INFRA["StorageProject.Infrastructure\n40+ Domain Services · EF Core · Migrations · DbSeeder"]
end
subgraph External["Data & External Integrations"]
SQL[("Microsoft SQL Server\nDatabase: SSFRMS")]
EXT["PayOS Payments · MailKit SMTP · QuestPDF"]
end
Client -->|"REST + Bearer JWT"| EP
EP --> CORE
WK --> INFRA
CORE --> INFRA
INFRA --> SQL
INFRA --> EXT
| Worker | Responsibility |
|---|---|
PayOSReconcileWorker |
Reconciles pending PayOS checkouts against the payment gateway if webhooks are delayed or missed |
ExpiredCashHoldWorker |
Releases timed unpaid holds (15 min online / 24 h counter) back into live unit inventory |
ExpiredRenewalWorker |
Automatically expires unapproved or unpaid renewal requests past deadline |
OverdueWorker |
Transitions past-due contracts without return evidence into OVERDUE and creates unique OverdueCase records |
FacilityWorkflowWorker |
Drives scheduled unit start activations and facility operational state transitions |
CustomerEmailWorker |
Dispatches queued contract PDFs, receipts, and customer notifications asynchronously via SMTP |
| Layer | Technologies |
|---|---|
| Frontend | React 19 · Vite 8 · Leaflet (interactive facility maps) · qrcode / jsQR · jsPDF + html2canvas · Manrope & Inter typography |
| Backend | ASP.NET Core (.NET 10) Minimal API · Entity Framework Core · JWT Bearer Auth · BCrypt · Swagger / OpenAPI |
| Database | Microsoft SQL Server (DECIMAL(15,2) VND precision, 25 normalized tables, EF Core migrations) |
| Integrations | PayOS (Vietnam QR payment gateway & webhooks) · MailKit (SMTP email) · QuestPDF (Vietnamese contract PDFs) |
| Testing | xUnit (50 unit + 8 integration test files) · Node Test Runner (30+ frontend test suites) · Playwright E2E |
| DevOps & Infra | Docker & Docker Compose (dev / staging / production + dedicated DB migrator image) · Caddy / Nginx · GitHub Actions CI/CD |
- .NET 10 SDK
- Node.js
>= 22.12 - Microsoft SQL Server (Express, Developer, LocalDB, or Docker)
Configure your connection string in StorageProject.Api/appsettings.json (default: Server=.\SQLEXPRESS;Database=SSFRMS;...), then apply migrations and start the API:
dotnet tool restore
dotnet ef database update --project StorageProject.Infrastructure --startup-project StorageProject.Api
dotnet run --project StorageProject.Api --launch-profile http- API Base URL:
http://localhost:5151 - Swagger UI:
http://localhost:5151/index.html - Health Check:
http://localhost:5151/health
On first launch,
DbSeederidempotently seeds roles, permissions, all 12 facilities, unit types, pricing tables, policies, and demo accounts.
cd SafeSpace-Customer-UI/SafeSpace-Customer-UI
npm install
cp .env.example .env.local # Set VITE_USE_API=true, VITE_API_URL=http://localhost:5151
npm run devOpen http://127.0.0.1:5173. (Set VITE_USE_API=false or run npm run dev:mock to preview the UI standalone without a running backend.)
From the repository root (starts Backend + Frontend + ngrok tunnel for PayOS webhooks):
npm ci
npm --prefix SafeSpace-Customer-UI/SafeSpace-Customer-UI ci
npm run dev# Backend: 50 unit test files + 8 API integration test files
dotnet test StorageProject.slnx
# Frontend: 30+ workflow, reducer, mapper, UI & QR tests
cd SafeSpace-Customer-UI/SafeSpace-Customer-UI
npm test
npm run test:render
npm run test:auth-support # Playwright E2E| Role | Username | Password | Scope |
|---|---|---|---|
| Customer | customer01 |
Customer@123 |
Self-service booking, payments, QR door, renewals & support |
| Facility Staff | Staff_NLB |
Staff@123 |
Single assigned facility (NLB) |
| Facility Manager | Manager_NLB |
Manager@123 |
Single assigned facility (NLB) |
| Operations Manager | ops01 |
Ops@123 |
System-wide policies, pricing & revenue across all 12 facilities |
| System Admin | admin |
Admin@123 |
Accounts, roles, facility scopes, audit logs & Door Simulator |
12 Facility Codes: Replace
NLBwith any ofHL,PX,TT,PMH,BTH,NB,BC,TD,GV,TB,BTAto log in as that facility's Staff or Manager.
SafeSpace/
├── StorageProject.Api/ # .NET 10 Minimal API endpoints, JWT auth, rate limits & 6 background workers
├── StorageProject.Core/ # 25 domain entities, DTOs & service interfaces
├── StorageProject.Infrastructure/ # EF Core DbContext, 40+ domain services, migrations & idempotent seeder
├── StorageProject.Tests/ # 50 xUnit unit test suites
├── StorageProject.IntegrationTests/ # 8 end-to-end API integration test suites
├── SafeSpace-Customer-UI/ # React 19 + Vite 8 multi-portal UI (Customer, Staff, Manager, Ops, Admin)
├── deploy/ # Docker Compose (dev/staging/prod), migrator Dockerfile, Caddyfile & Nginx
├── .github/workflows/ # CI quality gate & production deployment pipelines
└── docs/ # Architecture, business rules (BR01–BR30), CI/CD, deployment & rollback guides
- System Architecture
- Business Rules & State Transitions (
BR01–BR30) - Operations API Specification
- QR Door Access & Simulator Guide
- CI/CD Pipeline · Production Deployment · Rollback Runbook
| Member | GitHub |
|---|---|
| Thắng Nguyễn | @VectorNguyen |
| Teammate | @ryocoding13 |
| Teammate | @maingocse |
| Teammate | @TienPhanSE |
My core contributions: Designed the UI system in Figma and built the majority of the React 19 multi-portal frontend (Customer, Facility Staff, Facility Manager, Operations Manager, and System Admin), engineered the backend return, deposit refund, and contract renewal services, and implemented the core domain business rules for timed unit holds, overdue escalation, and QR/PIN door access.