# MakLinkApp — TFSBD Platform

**maklinkapp.tfsbd.com** — A ClassLink-style unified app launchpad for Trade Finance Solution Bangladesh (TFSBD). Built for trade finance professionals, it provides single sign-on access to all TFSBD digital tools.

---

## Stack

| Layer      | Technology                     |
|------------|-------------------------------|
| Frontend   | HTML5 · CSS3 · Vanilla JS     |
| Backend    | PHP 8.3 (auth/CRUD) · Python 3.12 Flask (API) |
| Database   | MySQL 8.3                     |
| Cache      | Redis 7.2                     |
| Container  | Docker + Docker Compose        |
| CI/CD      | GitHub Actions → SSH deploy   |
| Server     | Nginx 1.27 + PHP-FPM          |

---

## Quick Start (Local)

```bash
# 1. Clone and enter
git clone https://github.com/tfsbd/maklinkapp.git
cd maklinkapp

# 2. Configure environment
cp .env.example .env
# Edit .env with your DB passwords, JWT secret, mail credentials

# 3. Start all services
docker compose up -d

# 4. Run database migrations
docker exec maklinkapp-db mysql -u maklinkapp_user -p maklinkapp < database/schema.sql
docker exec maklinkapp-db mysql -u maklinkapp_user -p maklinkapp < database/seed.sql

# 5. Open in browser
open http://localhost
```

---

## Project Structure

```
maklinkapp/
├── frontend/
│   ├── index.html          ← Login page
│   ├── register.html       ← Registration page
│   ├── dashboard.html      ← Main launchpad (add this)
│   ├── settings.html       ← User settings
│   ├── styles/
│   │   ├── main.css        ← Global styles + TFSBD brand tokens
│   │   ├── auth.css        ← Login/register layout
│   │   ├── dashboard.css   ← Dashboard layout
│   │   └── settings.css    ← Settings page
│   ├── scripts/
│   │   ├── auth.js         ← Login, register, MFA/OTP logic
│   │   ├── app.js          ← Dashboard, launchpad, nav
│   │   └── settings.js     ← Tab switching, dark mode, save
│   └── data/
│       └── config.json     ← App config, feature flags
├── backend/
│   ├── api/
│   │   ├── login.php        ← Auth: credential login + MFA
│   │   ├── roster_server.py ← Flask: users, roster, analytics
│   │   └── ...
│   ├── config/
│   │   ├── db_connect.php   ← PDO MySQL connection
│   │   └── settings.py      ← Flask config, email helpers
│   └── services/
│       └── auth.asp         ← Legacy ASP (if needed)
├── database/
│   ├── schema.sql           ← Full DB schema (9 tables)
│   └── seed.sql             ← Default admin + 7 apps
├── apps/
│   └── [app-name]/          ← Modular sub-apps (Docker each)
├── docker/
│   ├── nginx.conf           ← Nginx virtual host config
│   └── supervisord.conf     ← Process manager config
├── .github/
│   └── workflows/
│       └── deploy.yml       ← CI/CD: test → build → SSH deploy
├── Dockerfile               ← Multi-stage production build
├── docker-compose.yml       ← App + DB + Redis services
├── .env.example             ← Environment variable template
└── README.md
```

---

## GitHub Secrets Required

Set these in **Settings → Secrets → Actions** before first deploy:

| Secret           | Description                          |
|------------------|--------------------------------------|
| `SSH_HOST`       | Server IP or hostname                |
| `SSH_USER`       | SSH username (e.g. `deploy`)         |
| `SSH_PRIVATE_KEY`| Private key for SSH access           |
| `SSH_PORT`       | SSH port (default: 22)               |
| `DB_PASS`        | MySQL app user password              |
| `DB_ROOT_PASS`   | MySQL root password                  |
| `JWT_SECRET`     | 256-bit JWT signing secret           |
| `REDIS_PASS`     | Redis password                       |
| `MAIL_HOST`      | SMTP server                          |
| `MAIL_USER`      | SMTP username                        |
| `MAIL_PASS`      | SMTP password                        |

---

## Adding a New App Module

```bash
# 1. Create app folder
mkdir apps/my-new-app

# 2. Add Dockerfile inside
# 3. Add to docker-compose.yml under services:
# 4. Add route in nginx.conf: location /apps/my-new-app/ { ... }
# 5. INSERT INTO apps (slug, name, ...) VALUES ('my-new-app', ...);
```

---

## Branding

| Token      | Value     | Usage                        |
|------------|-----------|------------------------------|
| Navy       | `#0D1B3E` | Primary brand, sidebar, text |
| Gold       | `#C49A2A` | Accents, active states, CTA  |
| Cream      | `#F7F3EC` | Page background              |
| Gold Light | `#F5E9C8` | Tile hover, badge background |

---

## Contact

**Trade Finance Solution Bangladesh (TFSBD)**  
Hadi Mansion, 687 E/2, Pranhoridas Road, Pahartoli, Chittagong-4219, Bangladesh  
📞 +880312772319 · 📧 a.karim@tfsbd.com · 🌐 www.tfsbd.com

---

*MakLinkApp v1.0 · Built for TFSBD · 2026*
