# 🚀 Madika Server: Windows Installation Guide

Welcome **Madika**! Here are the steps to install and run **Madika Server** on Windows.

---

## ⚡ Option 1: Automated 1-Click Installation (Recommended)

An automated installer script [`install.ps1`](file:///c:/Users/madik/Desktop/MadikaServer/install.ps1) has been created for you.

### Steps:
1. Open PowerShell and run:
   ```powershell
   cd C:\Users\madik\Desktop\MadikaServer
   powershell -ExecutionPolicy Bypass -File .\install.ps1
   ```
2. The script will:
   - Request Administrator elevation (UAC prompt).
   - Create the installation root at `C:\MadikaServer`.
   - Copy `madikad.exe` and the `ui/` dashboard.
   - Add `C:\MadikaServer` to your Windows System `PATH`.
   - Create a **"Madika Server"** shortcut on your Desktop.
   - Initialize the Windows `hosts` file with isolated marker tags.

---

## 🛠️ Option 2: Manual Installation Steps

If you prefer to configure everything manually:

### 1. Create the Directory Tree
Run in PowerShell:
```powershell
New-Item -ItemType Directory -Force -Path "C:\MadikaServer\data", "C:\MadikaServer\sites", "C:\MadikaServer\ssl", "C:\MadikaServer\logs", "C:\MadikaServer\nginx\vhosts", "C:\MadikaServer\php", "C:\MadikaServer\mysql"
```

### 2. Copy the Files
```powershell
Copy-Item "C:\Users\madik\Desktop\MadikaServer\madikad.exe" "C:\MadikaServer\madikad.exe"
Copy-Item "C:\Users\madik\Desktop\MadikaServer\ui" "C:\MadikaServer\ui" -Recurse
```

---

## 🏃 How to Run Madika Server

### Step 1: Start the Background Daemon
Run from your terminal or double-click `madikad.exe`:
```powershell
C:\MadikaServer\madikad.exe
```
> Output:
> `🚀 Starting Madika Server Engine (v1.0.0)...`
> `⚡ Madika Daemon API listening on http://127.0.0.1:48120`

### Step 2: Open the Dashboard
Double-click or open [`C:\MadikaServer\ui\index.html`](file:///C:/MadikaServer/ui/index.html) (or [`ui/index.html`](file:///c:/Users/madik/Desktop/MadikaServer/ui/index.html)) in any browser (Chrome, Edge, Firefox).

---

## 🌐 Adding Optional Runtime Binaries (Nginx, PHP, MySQL, mkcert)

To connect real portable runtime binaries:
1. **Nginx**: Extract portable `nginx.exe` into `C:\MadikaServer\nginx\`
2. **PHP Versions**: Extract portable PHP zip files into `C:\MadikaServer\php\8.3\`, `C:\MadikaServer\php\8.2\`, etc.
3. **MySQL**: Place MySQL community server in `C:\MadikaServer\mysql\`
4. **mkcert**: Place `mkcert.exe` in `C:\MadikaServer\bin\` or ensure it is in your system `PATH`.
