# Al-Khalil

A support chat system for a business with customers across time zones. It remembers files, business hours and who said what, so nothing gets lost between messages.

Year: 2024
Stack: Node, Socket.IO, MongoDB, AWS S3, React Native, Next.js

## 01 / The problem

Customer support context gets lost when chat, files and follow ups live in separate places. A message sent outside business hours either goes out at a bad time, or gets forgotten until someone remembers to send it. Files also need to stay tied to the right conversation, not scattered across a shared drive.

## 02 / What I built

- **Chat that shows who's around** Realtime chat with typing signals, online status and a read receipt stored on every message.
- **Messages that wait for business hours** Rules set per weekday and per hour, sent in the customer's own time zone.
- **A folder for every conversation** Each conversation gets its own folder on S3, created from a template, so files stay organized from the start.
- **Four roles, checked everywhere** From super admin down to user, checked on nearly every route.
- **One backend, two apps** The same backend serves a mobile app and a web app.

## 03 / Key decisions

### 1. Out of hours messages are real scheduling

The send handler queues a job, tracks its status, and releases the message when business hours start in the customer's time zone. It is not just a toggle.

### 2. Conversation changes moved from REST to sockets

The REST routes were built first, then replaced, so every client sees the same change at the same moment.

### 3. Every conversation gets its own folder

Created from a template, so files stay organized by conversation instead of piling up in one shared place.

### 4. One backend for both apps

Role checks sit on nearly every route, so permissions cannot drift between the mobile app and the web app.

## 04 / Outcome

Al-Khalil is a live client product.

Support staff open one thread and see the whole story: the chat, the files and when a message actually went out.

[See alkhalil-group.com](https://alkhalil-group.com)