Developer Documentation

Your guide to integrating and using our platform.

SaaS Translation Platform Documentation

1. Technical Architecture

A. Roles and Relationships

  • Admin: Manages the platform, super users, and overall settings.
  • Super User: Sole distributor for a region; manages their wallet and appoints users.
  • User (Developer): Appointed by a super user; manages their wallet and creates/manages websites for end customers.
  • End Customer: Receives the website/application from the user.

B. Key Entities and Tables

| Table | Key Fields/Relationships | |----------------------|------------------------------------------------------------------------------------------| | users | id, name, email, password, role (admin/super_user/user), region_id, super_user_id (nullable) | | regions | id, name, code, super_user_id | | wallets | id, user_id, balance, last_recharge_at, type (super_user/user) | | wallet_transactions | id, wallet_id, amount, type (credit/debit), description, created_at | | websites | id, user_id, region_id, customer_name, api_key, status, created_at | | commissions | id, from_user_id, to_user_id, amount, website_id, created_at | | customers | id, user_id, name, email, phone, website_id |

C. Key Flows

1. Super User Onboarding & Wallet Recharge

  • Admin creates a super user and assigns a region.
  • Super user recharges wallet (via payment gateway).
  • Super user can now appoint users.

2. User Onboarding & Wallet Recharge

  • Super user invites/creates a user (developer).
  • User recharges wallet through the super user (super user wallet is debited, user wallet is credited).
  • User can now create websites for customers.

3. Website Creation & Customer Billing

  • User creates a website for a customer (wallet is debited for platform fee).
  • User can bill customer directly (outside the platform or via optional invoicing module).
  • Commissions (if any) are credited to the super user.

4. White Label Support

  • Each super user can brand their dashboard and user/customer-facing portals.

5. Reporting & Dashboards

  • Real-time dashboards for admin, super users, and users: wallet balances, transactions, websites, commissions.

D. Entity Relationship Diagram (ERD)

[Admin]
   |
[SuperUser]----<manages>----[Region]
   |
[User]----<creates>----[Website]----<for>----[Customer]
   |
[Wallet]----<tracks>----[WalletTransaction]
   |
[Commission]

2. Sample Agreements

A. Super User Agreement (Excerpt)

Super User Distribution Agreement

This agreement ("Agreement") is made between [Your Company Name] ("Company") and [Super User Name] ("Super User") for the exclusive distribution of [SaaS Product Name] in the region of [Region Name].

1. Appointment & Exclusivity:
The Company appoints the Super User as the sole distributor for the region of [Region Name]. The Super User agrees not to distribute competing products in this region.

2. Wallet Recharge & Usage:
The Super User must maintain a positive wallet balance to access platform features and appoint users. All transactions are prepaid.

3. User Management:
The Super User may appoint users (developers) within their region and is responsible for their conduct and wallet recharges.

4. Commissions & Fees:
The Super User earns commissions on all wallet recharges and website creations by their users, as per the platform's commission structure.

5. Branding:
The Super User may white-label the platform within their region, subject to Company approval.

6. Term & Termination:
Either party may terminate this agreement with 30 days' notice. Misconduct or breach may result in immediate termination.

7. Dispute Resolution:
Disputes will be resolved under the laws of [Jurisdiction].

[Signature Section]

B. User Agreement (Excerpt)

User (Developer) Agreement

This agreement ("Agreement") is between [Your Company Name] ("Company") and [User Name] ("User"), appointed by [Super User Name].

1. Appointment:
The User is authorized to create and manage websites for customers using the platform.

2. Wallet Recharge:
The User must recharge their wallet through their appointed Super User to access platform features.

3. Customer Management:
The User is responsible for their customers and may set their own pricing for website creation.

4. Fees & Commissions:
The User agrees to the platform's fee structure and understands that commissions are shared with their Super User.

5. Branding:
The User may use the white-labeled platform as provided by their Super User.

6. Term & Termination:
Either party may terminate this agreement with notice as per platform policy.

[Signature Section]


3. Example: Wallet Recharge Logic (Laravel Eloquent)

// When a super user recharges a user's wallet
DB::transaction(function() use ($superUser, $user, $amount) {
    if ($superUser->wallet->balance < $amount) {
        throw new \Exception('Insufficient super user wallet balance');
    }
    $superUser->wallet->decrement('balance', $amount);
    $user->wallet->increment('balance', $amount);

    WalletTransaction::create([
        'wallet_id' => $superUser->wallet->id,
        'amount' => -$amount,
        'type' => 'debit',
        'description' => "Transferred to user {$user->name}"
    ]);
    WalletTransaction::create([
        'wallet_id' => $user->wallet->id,
        'amount' => $amount,
        'type' => 'credit',
        'description' => "Received from super user {$superUser->name}"
    ]);
});

4. Next Steps

  • Define your commission structure and region boundaries.
  • Build onboarding flows and dashboards as described.
  • Draft and finalize agreements with legal counsel.
  • Implement, test, and iterate on the wallet and user management modules.