Skip to content

SourceXXL/alian_structure-UI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌍 Alian Structure - Direct Aid Distribution Platform

Free, open-source humanitarian aid platform using Stellar blockchain for transparent, zero-friction direct aid from donors to people in need.

License TypeScript Next.js Stellar Status


πŸ“‹ Table of Contents


🎯 Overview

Alian Structure is a revolutionary humanitarian aid platform that leverages the Stellar blockchain to solve the fundamental problems in charitable giving:

The Problem

Traditional aid systems suffer from:

  • Aid Leakage: 40-60% of donations lost to intermediaries
  • Lack of Transparency: Donors can't verify where money goes
  • Unbanked Exclusion: Recipients without bank accounts can't receive aid
  • Verification Impossibility: No way to prove aid reached intended recipients

Our Solution

Alian Structure enables:

  • βœ… Direct Delivery: Donor β†’ Recipient (zero intermediaries)
  • βœ… Complete Transparency: Immutable on-chain proof of delivery
  • βœ… Financial Inclusion: Stellar wallets accessible globally
  • βœ… AI-Verified Safety: Private need assessment before payment
  • βœ… Cost Efficiency: Near-zero transaction fees (~0.00001 XLM)

πŸ’‘ Why Alian Structure

For Donors

  • πŸ” Verification: See exactly where your money goes via transaction hash
  • πŸ’° Efficiency: 95%+ of donation reaches beneficiaries (vs 40% traditionally)
  • 🌍 Global Reach: Support anyone with internet, no geography barriers
  • πŸ“Š Impact Tracking: Real-time dashboard showing lives affected

For Recipients

  • πŸ’Ό No Bank Required: Only internet connection needed
  • ⚑ Instant Settlement: Receive funds in 3-5 seconds
  • πŸ” Security: Cryptographic proof of ownership
  • 🌐 Global Access: Money works across 150+ countries

For NGOs & Administrators

  • πŸ“ˆ Program Management: Affiliate system, commission tracking, payouts
  • 🧠 AI Verification: Privacy-preserving need assessment
  • πŸ“Š Detailed Reporting: Export data, track metrics, audit trail
  • πŸ”’ Security: Wallet-based authentication, role-based access control

πŸš€ Key Features

Core Platform

  • πŸ§™ Claim Link Creation: Simple interface for donors to create aid claim links
  • πŸ”— Referral System: Share links, earn commissions in XLM
  • πŸ“Š Real-Time Dashboard: Track referrals, earnings, and impact
  • πŸ€– AI Verification: Privacy-first need assessment before settlement
  • ⛓️ On-Chain Proof: Immutable transaction records for transparency

Affiliate Program

  • πŸ’΅ Multi-Tier Commissions: Direct, Tier 2, Tier 3 referral rewards
  • πŸ“Š Earnings Analytics: Charts, breakdowns, trend analysis
  • πŸ’Έ Payout Management: Request payouts, track status, view history
  • πŸ” Secure Wallets: Freighter, Albedo, Ledger wallet support

User Experience

  • ✨ Cosmic UI Theme: Beautiful dark-mode interface with animations
  • πŸ“± PWA Ready: Offline support, installable app, background sync
  • ⚑ Lightning Fast: Advanced caching, optimized performance
  • πŸ”” Push Notifications: Real-time updates on activities
  • πŸŽ“ Educational Mode: Learn best practices for platform use

πŸ› οΈ Technology Stack

Frontend

Technology Purpose Version
Next.js React framework with SSR/SSG 14+
TypeScript Type-safe development 5.0+
Tailwind CSS Utility-first styling 3.x
React Context Global state management Latest
Stellar SDK Blockchain integration Latest

Backend

Technology Purpose Version
NestJS Node.js framework 10+
TypeScript Type-safe backend 5.0+
PostgreSQL Primary database 14+
Redis Caching & queuing 7+
BullMQ Job queue Latest

Blockchain

Service Role Network
Stellar Payment settlement Public/Testnet
Freighter Wallet integration Multi-chain
Albedo Alternative wallet Stellar
Ledger Hardware wallet Stellar

Infrastructure

  • Docker: Containerized deployment
  • OpenTelemetry: Distributed tracing
  • Prometheus: Metrics collection
  • Grafana: Monitoring dashboard

πŸ—οΈ Architecture

System Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Donor / Recipient                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚                            β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”           β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚   Frontend    β”‚           β”‚  Wallet       β”‚
        β”‚  (Next.js)    β”‚           β”‚ (Stellar)     β”‚
        β”‚               β”‚           β”‚               β”‚
        β”‚ β€’ UI/UX       │◄─────────►│ β€’ Freighter   β”‚
        β”‚ β€’ Forms       β”‚           β”‚ β€’ Albedo      β”‚
        β”‚ β€’ Dashboard   β”‚           β”‚ β€’ Ledger      β”‚
        β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚         API Gateway & Auth                 β”‚
        β”‚      (JWT, Wallet Signature)               β”‚
        β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚     Backend Services (NestJS)              β”‚
        β”‚                                            β”‚
        β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”‚
        β”‚ β”‚ Affiliate    β”‚  β”‚   Payment    β”‚        β”‚
        β”‚ β”‚ Service      β”‚  β”‚   Service    β”‚        β”‚
        β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€        β”‚
        β”‚ β”‚ Commission   β”‚  β”‚   AI         β”‚        β”‚
        β”‚ β”‚ Tracking     β”‚  β”‚   Verify     β”‚        β”‚
        β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€        β”‚
        β”‚ β”‚ Payout Mgmt  β”‚  β”‚   Oracle     β”‚        β”‚
        β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚
        β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚                         β”‚                     β”‚
β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”€β”            β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”        β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
β”‚PostgreSQL         β”‚   Redis      β”‚        β”‚  Stellar    β”‚
β”‚Database           β”‚   Cache      β”‚        β”‚  Blockchain β”‚
β”‚                   β”‚              β”‚        β”‚             β”‚
β”‚ β€’ Users           β”‚ β€’ Sessions   β”‚        β”‚ β€’ Payments  β”‚
β”‚ β€’ Affiliates      β”‚ β€’ Jobs       β”‚        β”‚ β€’ Ledger    β”‚
β”‚ β€’ Referrals       β”‚ β€’ Metrics    β”‚        β”‚ β€’ Accounts  β”‚
β”‚ β€’ Payouts         β”‚              β”‚        β”‚             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Flow

  1. User Connection

    • User connects Stellar wallet (Freighter/Albedo/Ledger)
    • Wallet address used for authentication
    • JWT token issued for session
  2. Aid Creation

    • Donor creates claim link with amount
    • Link shared with recipients
    • Recipients access via link
  3. Verification & Settlement

    • AI verifies recipient need (private)
    • Payment executed on Stellar blockchain
    • Transaction hash stored immutably
    • Verification metadata recorded on-chain
  4. Affiliate Tracking

    • Referral tracked via code/link
    • Commission calculated automatically
    • Stored in database and on-chain
    • User can request payout anytime

πŸš€ Quick Start

Prerequisites

# Required
- Node.js 18+ (https://nodejs.org/)
- npm or yarn (https://yarnpkg.com/)
- Git (https://git-scm.com/)

# Optional but recommended
- Docker & Docker Compose
- PostgreSQL 14+ (or use Docker)
- Redis (or use Docker)

Installation

1. Clone Repository

git clone https://github.com/SourceXXL/alian_structure-UI.git
cd alian_structure-UI

2. Install Dependencies

# Using npm
npm install

# Or using yarn
yarn install

3. Environment Setup

# Copy environment template
cp .env.example .env.local

# Edit .env.local with your configuration
# Minimum required:
NEXT_PUBLIC_API_URL=http://localhost:3001
NEXT_PUBLIC_ENVIRONMENT=development
NEXT_PUBLIC_STELLAR_NETWORK=testnet

4. Run Development Server

# Start development server with hot reload
npm run dev

# Visit http://localhost:3000

5. Build for Production

# Build optimized bundle
npm run build

# Run production server
npm run start

6. Run Tests

# Run test suite
npm test

# Watch mode
npm run test:watch

# Coverage report
npm run test:coverage

Docker Setup (Optional)

# Build Docker image
docker build -t alian-structure:latest .

# Run container
docker run -p 3000:3000 \
  -e NEXT_PUBLIC_API_URL=http://localhost:3001 \
  alian-structure:latest

With Docker Compose

# Run full stack (frontend + backend + database)
docker-compose up -d

# View logs
docker-compose logs -f

# Stop services
docker-compose down

πŸ“ Project Structure

alian_structure-UI/
β”œβ”€β”€ app/                              # Next.js app directory
β”‚   β”œβ”€β”€ layout.tsx                   # Root layout
β”‚   β”œβ”€β”€ page.tsx                     # Home page
β”‚   β”œβ”€β”€ affiliates/                  # Affiliate routes
β”‚   β”‚   β”œβ”€β”€ page.tsx
β”‚   β”‚   └── [id]/page.tsx
β”‚   └── api/                         # API routes
β”‚       β”œβ”€β”€ auth/
β”‚       └── affiliates/
β”œβ”€β”€ components/                       # React components
β”‚   β”œβ”€β”€ Navigation.tsx               # Header/nav
β”‚   β”œβ”€β”€ ConnectWallet.tsx            # Wallet connection button
β”‚   β”œβ”€β”€ WalletAddress.tsx            # Address display
β”‚   β”œβ”€β”€ NetworkSwitcher.tsx          # Network selector
β”‚   └── context/
β”‚       └── StellarWalletProvider.tsx # Wallet context
β”œβ”€β”€ features/                         # Feature modules
β”‚   └── affiliate-dashboard/
β”‚       β”œβ”€β”€ components/
β”‚       β”œβ”€β”€ hooks/
β”‚       β”œβ”€β”€ store/
β”‚       β”œβ”€β”€ services/
β”‚       └── types/
β”œβ”€β”€ lib/                             # Utilities & helpers
β”‚   β”œβ”€β”€ stellar.ts                  # Stellar SDK utilities
β”‚   β”œβ”€β”€ stellar-constants.ts        # Network config
β”‚   └── api-client.ts               # API utilities
β”œβ”€β”€ styles/                          # Global styles
β”‚   β”œβ”€β”€ globals.css
β”‚   └── tailwind.config.js
β”œβ”€β”€ public/                          # Static assets
β”‚   β”œβ”€β”€ images/
β”‚   └── icons/
β”œβ”€β”€ tests/                           # Test suite
β”‚   β”œβ”€β”€ __tests__/
β”‚   └── e2e/
β”œβ”€β”€ docs/                            # Documentation
β”‚   β”œβ”€β”€ SETUP.md
β”‚   β”œβ”€β”€ API.md
β”‚   β”œβ”€β”€ ARCHITECTURE.md
β”‚   └── CONTRIBUTING.md
β”œβ”€β”€ .env.example                     # Environment template
β”œβ”€β”€ .env.local                       # Local config (not committed)
β”œβ”€β”€ package.json                     # Dependencies & scripts
β”œβ”€β”€ tsconfig.json                    # TypeScript config
β”œβ”€β”€ next.config.js                   # Next.js config
└── README.md                        # This file

πŸ”§ Configuration

Environment Variables

# API Configuration
NEXT_PUBLIC_API_URL=http://localhost:3001
NEXT_PUBLIC_ENVIRONMENT=development

# Stellar Network
NEXT_PUBLIC_STELLAR_NETWORK=testnet  # testnet | public
NEXT_PUBLIC_STELLAR_RPC_URL=https://soroban-testnet.stellar.org

# Auth
NEXT_PUBLIC_JWT_EXPIRY=7d
SESSION_STORAGE_KEY=alian_session

# Analytics (optional)
NEXT_PUBLIC_ANALYTICS_ID=your-analytics-id

# Feature Flags
NEXT_PUBLIC_ENABLE_AFFILIATE=true
NEXT_PUBLIC_ENABLE_PWA=true

Database Configuration

See backend repository: alian_structure-api


πŸ”— Wallet Integration

Supported Wallets

Wallet Support Version
Freighter βœ… Full 5.0+
Albedo βœ… Full Latest
Ledger βœ… Full Latest

Connection Flow

import { useStellarWallet } from '@/components/context/StellarWalletProvider';

export function MyComponent() {
  const { wallet, connectWallet, disconnectWallet } = useStellarWallet();

  return (
    <div>
      {wallet?.isConnected ? (
        <>
          <p>Connected: {wallet.publicKey}</p>
          <p>Balance: {wallet.balances[0]?.balance} XLM</p>
          <button onClick={disconnectWallet}>Disconnect</button>
        </>
      ) : (
        <button onClick={() => connectWallet('freighter')}>
          Connect Wallet
        </button>
      )}
    </div>
  );
}

πŸ’° Affiliate Program

Commission Structure

Tier Source Rate
Direct Your referrals 10% of volume
Tier 2 Their referrals 5% of volume
Tier 3 Their referrals 2% of volume

Payout Settings

  • Minimum: 100 XLM
  • Frequency: Weekly
  • Processing: 1-2 business days
  • Method: Stellar wallet transfer

Dashboard Features

  • πŸ“Š Real-time earnings tracking
  • πŸ“ˆ Commission breakdown by tier
  • πŸ”— Referral code generation
  • πŸ’Έ Payout request system
  • πŸ“‹ Transaction history
  • πŸ“‘ Earnings reports

πŸ§ͺ Testing

Test Structure

tests/
β”œβ”€β”€ __tests__/
β”‚   β”œβ”€β”€ wallet.test.tsx        # Wallet component tests
β”‚   β”œβ”€β”€ affiliate.test.tsx      # Affiliate dashboard tests
β”‚   └── integration/
β”‚       └── stellar.test.tsx    # Stellar integration tests
└── e2e/
    β”œβ”€β”€ wallet.e2e.test.tsx     # E2E wallet flows
    └── affiliate.e2e.test.tsx  # E2E affiliate flows

Running Tests

# Unit tests
npm test

# Watch mode
npm run test:watch

# Coverage
npm run test:coverage

# E2E tests (requires running app)
npm run test:e2e

πŸ“± Progressive Web App (PWA)

Features

  • βœ… Offline access to cached pages
  • βœ… App installability on mobile/desktop
  • βœ… Background sync for data
  • βœ… Push notifications
  • βœ… Advanced caching strategies

Enable PWA

# Run setup script
chmod +x scripts/setup-pwa.sh
./scripts/setup-pwa.sh

# Or manual setup
npm install next-pwa workbox-webpack-plugin
npm run build

πŸ”’ Security

Best Practices

  • βœ… Never expose private keys
  • βœ… Always validate wallet addresses (56 chars, starts with G)
  • βœ… Use HTTPS in production
  • βœ… Implement rate limiting on API calls
  • βœ… Keep dependencies updated
  • βœ… Regular security audits

Authentication

  • Wallet-based (primary): Freighter/Albedo/Ledger
  • Email/Password (optional): bcrypt hashing, JWT tokens
  • Session persistence: localStorage with encryption
  • Multi-wallet delegation support

Data Protection

  • Stellar address validation on all requests
  • Amount validation and minimum thresholds
  • Transaction hash tracking for audit trail
  • PII-safe metrics export
  • CORS whitelist configuration

🀝 Contributing

We welcome contributions from developers, designers, and community members!

Getting Started

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Contribution Guidelines

  • Follow existing code style (Prettier/ESLint configured)
  • Add tests for new features
  • Update documentation accordingly
  • Keep commits atomic and descriptive
  • Link related issues in PR description

Development Workflow

# Install dependencies
npm install

# Create feature branch
git checkout -b feature/your-feature

# Make changes
# Edit files, write tests, etc.

# Run tests & linting
npm run lint
npm test

# Push and create PR
git push origin feature/your-feature

Reporting Issues

  • πŸ› Bugs: Use issue template, include reproduction steps
  • πŸ’‘ Features: Describe use case and expected behavior
  • ❓ Questions: Use Discussions for general questions

πŸ“š Documentation


πŸ†˜ Support & Community

Getting Help

Community Resources


πŸ“Š Status

  • βœ… Frontend: Active Development
  • βœ… Backend: Active Development
  • βœ… Stellar Integration: Production-Ready
  • πŸ”„ Affiliate System: Testing Phase
  • πŸ“‹ Roadmap: See ROADMAP.md

πŸ“„ License

This project is licensed under the MIT License - see LICENSE file for details.

You are free to:

  • βœ… Use commercially
  • βœ… Modify
  • βœ… Distribute
  • βœ… Use privately

With the requirement to:

  • πŸ“ Include license and copyright notice

πŸ™ Acknowledgments

  • Stellar Development Foundation for the incredible blockchain infrastructure
  • Next.js & Vercel for the amazing React framework
  • Open source community for countless libraries and tools
  • Contributors who help make this project better

πŸ“ˆ Project Stats


Made with ❀️ by SourceXXL

Building transparent, direct humanitarian aid one transaction at a time.

⭐ Star us on GitHub β€’ 🀝 Contribute β€’ πŸ“§ Contact

About

Free, open-source tool for sending aid directly to people in need using the Stellar blockchain. Donors and NGOs create easy claim links; AI checks needs privately; track real impact on-chain. No middlemen, full privacy. Made with Next.js. Help build itβ€”star, fork, contribute! 🌍 #Stellar #OpenSource

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors