DTech Rewards Platform ation

Student Incentive Program
Back to Gateway

1. System Overview

What it is:

The DTech Rewards Platform is a digital ecosystem where users can earn points by engaging with advertisements (monetized links) and subsequently redeem those points for real-world rewards like Airtime, Vouchers, or Capitec bank transfers.

What it's for:

It serves as an ad-revenue sharing platform. The administrators generate revenue from ad impressions/clicks via third-party ad networks (like Monetag and direct link providers), and a portion of that value is distributed back to the users in the form of "points." (The internal economy is scaled such that 100 points = R1).

How it works (The User Journey):

1. Registration & Login: Users create an account and log in via the web portal or the dedicated Android app.

2. Earning Points: Users navigate to the "Berserker" page and click on ads. The system tracks these ad interactions.

3. Synchronization: As users watch ads, points are accumulated locally on their device. When they return to the dashboard, these pending points are securely synced to the backend database.

4. Withdrawal: Once enough points are accumulated (e.g., 1000 points for Airtime), users can submit a withdrawal request.

5. Administration: System admins use a hidden admin console to review withdrawal requests, process them, and manage (ban/delete/edit) users.

---

2. System Architecture

The system follows a modern, serverless architecture split into three main components:

A. The Web Frontend (HTML/CSS/JS)

A collection of vanilla HTML files hosted on a web server (e.g., revenue.dtech-services.co.za). It provides the User Interface (UI). It uses standard browser features like localStorage for session management (storing the username and a token) and document.cookie to communicate with the Android App layer.

B. The Native Android App (Kotlin/WebView)

An Android application (android_app/) that acts as a dedicated, specialized browser for the Web Frontend. It wraps the website in a WebView.

Why have an app?

C. The Backend API (Cloudflare Worker & KV)

A serverless edge function (worker.js) hosted on Cloudflare Workers. It acts as the entire backend logic and database layer.

---

3. Detailed File Breakdown

Frontend Web Files

#### index.html (Authentication Gateway)

#### dashboard.html (Main Hub & Sync Engine)

1. Checks localStorage to ensure the user is logged in.

2. The Sync Mechanism: It reads the pending_navigation_points cookie (set by the Android app when an ad is watched) and any dtech_pending_points from localStorage.

3. If pending points exist, it converts them into randomly generated values (e.g., 1 ad watch = a random number of points between 1 and 30).

4. It batches these points and sends a single POST request to /sync-points.

5. Upon success, it clears the cookie and local storage, ensuring points aren't duplicated.

#### berserker.html (The Earning Arena)

#### profile.html (User Status)

#### withdraw.html (Redemption Interface)

#### admin.html (The Control Panel)

---

Android App Files

#### MainActivity.kt (The Core Engine)

#### AndroidManifest.xml

---

4. Comprehensive API Guide (worker.js)

The backend is hosted on Cloudflare Workers (https://crimson-art-f482.lefa4082.workers.dev). All endpoints return standard HTTP status codes (200 OK, 400 Bad Request, etc.) and JSON payloads.

Global Security & CORS

User Endpoints

#### 1. POST /register

#### 2. POST /login

#### 3. GET /user?username={username}

#### 4. POST /sync-points

#### 5. POST /withdraw

#### 6. GET /withdrawals?username={username}

---

Admin Endpoints

All admin endpoints require the custom header X-Admin-Secret: {secret}. The backend compares this header against its environment variable env.ADMIN_SECRET.

#### 7. GET /admin/users

#### 8. POST /admin/action

#### 9. GET /admin/withdrawals

#### 10. POST /admin/withdrawal-action

Visit Live Platform