> For the complete documentation index, see [llms.txt](https://docs.skypaybd.top/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.skypaybd.top/deployment-and-setup/deployment.md).

# Deployment & GitBook Sync

This guide provides step-by-step instructions for publishing and synchronizing this modular Markdown documentation repository to **GitBook** via **GitHub**, configuring automatic navigation structures, and binding the custom subdomain `docs.skypaybd.top`.

***

## 1. Step-by-Step GitHub Setup Guide

Follow these commands to push the documentation suite to a new GitHub repository:

### Step 1: Initialize Git Repository

In your local documentation directory containing the Markdown files:

```bash
# Navigate to docs folder
cd skypay-docs

# Initialize git tracking
git init

# Create initial commit
git add .
git commit -m "feat: initial skypay gitbook documentation suite"
```

### Step 2: Create a New GitHub Repository

1. Log in to your [GitHub Account](https://github.com/).
2. Click **New Repository** (`+` icon in top navigation).
3. Name the repository: `skypay-docs`.
4. Choose **Public** or **Private** (GitBook supports private repository synchronization).
5. Leave "Initialize this repository with a README" **unchecked** (we already have one).
6. Click **Create repository**.

### Step 3: Link Remote & Push to `main`

```bash
# Rename branch to main
git branch -M main

# Add your GitHub remote URL
git remote add origin https://github.com/skypay-core/skypay-docs.git

# Push files to GitHub
git push -u origin main
```

***

## 2. Linking GitHub Repository to GitBook Space

GitBook provides native two-way synchronization with GitHub repositories, ensuring that every commit pushed to `main` automatically updates your published documentation.

### Step 1: Create a GitBook Space

1. Log in to your [GitBook Dashboard](https://app.gitbook.com/).
2. Select your organization or personal workspace.
3. Click **+ New Space** and title it **SkyPay Developer Documentation**.

### Step 2: Configure GitHub Integration

1. Inside the newly created Space, navigate to **Space Settings** (gear icon in the left sidebar).
2. Select **Integrations** > **GitHub**.
3. Click **Install / Configure GitHub App** and authorize GitBook to access your GitHub account or organization.
4. Select the repository `skypay-docs`.
5. Select the sync branch: `main`.
6. Select the documentation root directory: `/` (repository root).
7. Choose the sync direction: **GitHub to GitBook (Single-direction push)** or **Bi-directional (Two-way sync)**.
8. Click **Save & Synchronize**.

GitBook will pull all Markdown files and compile the documentation suite within seconds.

***

## 3. How GitBook Compiles Navigation from `SUMMARY.md`

GitBook uses `SUMMARY.md` as the architectural blueprint for your documentation portal:

### 1. Mobile-First Navigation Drawer

* GitBook translates every `# Section` and bulleted list item (`* \`Page Title -> filename\`\`) into a responsive sidebar menu.
* On mobile and tablet screens, this sidebar automatically collapses into an accessible, touch-optimized **hamburger drawer menu**.

### 2. Global Full-Text Search Engine

* GitBook automatically indexes every Markdown heading (`#`, `##`, `###`), body paragraph, table, and code snippet into its client-side search engine.
* The top search bar (`Cmd + K` or `Ctrl + K`) instantly searches across all pages with zero server-side setup required.

### 3. Automated Previous / Next Bottom Cards

* GitBook reads the sequential order of links in `SUMMARY.md` and generates modern **Previous** and **Next** navigation cards at the bottom of every page.
* This ensures that developers can read through the integration guide linearly across all devices.

***

## 4. Binding Custom Subdomain (`docs.skypaybd.top`)

To host the documentation under your branded subdomain (`docs.skypaybd.top`) with automatic SSL/TLS encryption:

### Step 1: Configure Custom Domain in GitBook

1. In your GitBook Space, navigate to **Space Settings > Custom Domains**.
2. Click **Add Custom Domain**.
3. Enter your custom subdomain: `docs.skypaybd.top`.
4. GitBook will display the required DNS target record (typically `hosting.gitbook.io`).

### Step 2: Configure DNS CNAME Record

Log in to your DNS provider (Cloudflare, cPanel, Namecheap, or Route53) and add the following CNAME record:

| Record Type | Host / Name | Target / Value       | TTL               | Proxy Status (Cloudflare) |
| ----------- | ----------- | -------------------- | ----------------- | ------------------------- |
| **`CNAME`** | `docs`      | `hosting.gitbook.io` | `Auto` (or `300`) | **DNS Only** (Grey Cloud) |

{% hint style="warning" %} **Cloudflare Proxy Caution**: If you manage DNS through Cloudflare, set the CNAME record to **DNS Only** (grey cloud) during initial verification. This allows GitBook's Let's Encrypt engine to complete the ACME HTTP-01 SSL challenge and issue a dedicated SSL certificate. {% endhint %}

### Step 3: SSL Verification & Activation

* GitBook automatically provisions an SSL/TLS certificate via Let's Encrypt within 5 to 15 minutes.
* Once the DNS status badge turns green (**Active**), your documentation is live at <https://docs.skypaybd.top>.

***

## 5. Continuous Deployment & Content Maintenance

Every future documentation update follows standard Git version control:

```bash
# Make edits to markdown files
git checkout -b feature/update-endpoints
git commit -am "docs: update bKash fee parameters"
git push origin feature/update-endpoints

# Open Pull Request and merge to main
# GitBook automatically deploys the updated content immediately upon merge!
```

***

## 6. Navigation

* [← Previous: Changelog](/system-and-devices/changelog.md)
* [Back to Home: Overview](/readme.md)
