Skip to content

D-Bluemoon/trust-link-frontend

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌐 TrustLink β€” Frontend

The Web2 experience. The Web3 guarantee.

Next.js TailwindCSS TypeScript Stellar Stellar Wave PRs Welcome


Overview

The TrustLink frontend is a Next.js 14 web application that makes decentralized escrow feel as simple as sending a payment link. Vendors generate a Smart Escrow Link in seconds. Buyers click a link, pay with a Stellar wallet, and their funds are held by a Soroban contract until the order is delivered.

No wallets to explain. No blockchain jargon. No friction.

Key User Journeys

VENDOR FLOW                          BUYER FLOW
───────────────────────────────      ─────────────────────────────────
1. Connect Freighter wallet          1. Click Smart Escrow Link
2. Fill order form                   2. See order summary & price
   (item, price, shipping window)    3. Connect wallet or use hosted
3. Get a shareable link              4. Approve USDC payment
4. Share on WhatsApp / Instagram     5. Track shipment status
5. Track escrow status               6. Confirm delivery OR
6. Receive payout on delivery           raise a dispute

Features

  • πŸ”— Smart Link Generator β€” Vendors create escrow links with one form. Links are shareable anywhere β€” DMs, bios, stories.
  • πŸ’³ Wallet-native Payments β€” Integrates Freighter SDK for in-browser Stellar transaction signing. No private key exposure.
  • πŸ“¦ Shipment Tracker β€” Live shipment status pulled from logistics APIs (Terminal Africa / GIGL) displayed inline.
  • βš–οΈ Dispute Dashboard β€” Buyers can flag issues, upload evidence, and track resolution status.
  • πŸ”” Real-time Notifications β€” Email and SMS alerts via SendGrid/Twilio at every state change.
  • πŸ“± Mobile-first Design β€” Built for the social commerce audience β€” primarily on mobile.
  • 🌍 No Crypto Knowledge Required β€” Blockchain complexity is entirely abstracted from the buyer experience.

Architecture

trustlink-frontend/
β”‚
β”œβ”€β”€ app/                            # Next.js App Router
β”‚   β”œβ”€β”€ (vendor)/                   # Vendor-authenticated routes
β”‚   β”‚   β”œβ”€β”€ dashboard/              # Vendor escrow dashboard
β”‚   β”‚   β”œβ”€β”€ create/                 # Smart Escrow Link generator
β”‚   β”‚   └── disputes/               # Outgoing dispute view
β”‚   β”‚
β”‚   β”œβ”€β”€ pay/[escrowId]/             # Buyer payment page (public)
β”‚   β”œβ”€β”€ track/[escrowId]/           # Order tracking page (public)
β”‚   β”œβ”€β”€ dispute/[escrowId]/         # Buyer dispute submission
β”‚   β”‚
β”‚   β”œβ”€β”€ admin/                      # Admin dispute resolution panel
β”‚   └── api/                        # Next.js API routes
β”‚       β”œβ”€β”€ escrow/                 # Escrow creation & status
β”‚       β”œβ”€β”€ webhooks/               # Logistics API webhooks
β”‚       └── notifications/          # Email/SMS triggers
β”‚
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ ui/                         # shadcn/ui base components
β”‚   β”œβ”€β”€ escrow/                     # Escrow-domain components
β”‚   β”‚   β”œβ”€β”€ EscrowLinkCard.tsx
β”‚   β”‚   β”œβ”€β”€ PaymentForm.tsx
β”‚   β”‚   β”œβ”€β”€ TrackingTimeline.tsx
β”‚   β”‚   └── DisputeForm.tsx
β”‚   β”œβ”€β”€ wallet/                     # Freighter wallet components
β”‚   β”‚   β”œβ”€β”€ WalletConnectButton.tsx
β”‚   β”‚   └── WalletProvider.tsx
β”‚   └── layout/                     # Shared layout components
β”‚
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ stellar/                    # Stellar / Soroban SDK wrappers
β”‚   β”‚   β”œβ”€β”€ contract.ts             # Contract interaction helpers
β”‚   β”‚   β”œβ”€β”€ freighter.ts            # Freighter wallet integration
β”‚   β”‚   └── horizon.ts              # Horizon API utilities
β”‚   β”œβ”€β”€ api/                        # Backend API client
β”‚   └── utils/                      # Shared utilities
β”‚
β”œβ”€β”€ hooks/                          # Custom React hooks
β”‚   β”œβ”€β”€ useEscrow.ts
β”‚   β”œβ”€β”€ useWallet.ts
β”‚   └── useTracking.ts
β”‚
└── types/                          # Shared TypeScript types

Getting Started

Prerequisites

Environment Variables

Create a .env.local file at the project root:

# Backend API
NEXT_PUBLIC_API_URL=http://localhost:3001

# Stellar Network
NEXT_PUBLIC_STELLAR_NETWORK=testnet
NEXT_PUBLIC_CONTRACT_ID=C...              # Your deployed Soroban contract ID
NEXT_PUBLIC_USDC_CONTRACT=C...            # USDC token contract address (testnet)

# Horizon RPC
NEXT_PUBLIC_HORIZON_URL=https://horizon-testnet.stellar.org
NEXT_PUBLIC_SOROBAN_RPC_URL=https://soroban-testnet.stellar.org

# Optional: Analytics
NEXT_PUBLIC_POSTHOG_KEY=phc_...

Installation & Development

# Clone the repository
git clone https://github.com/your-org/trustlink-frontend
cd trustlink-frontend

# Install dependencies
npm install

# Start the development server
npm run dev

Open http://localhost:3000 in your browser.

Build for Production

npm run build
npm start

Key Integrations

Freighter Wallet (Stellar)

Wallet interactions are wrapped in a reusable hook:

import { useWallet } from "@/hooks/useWallet";

const { isConnected, publicKey, signTransaction } = useWallet();

// Connect wallet
await connect();

// Sign and submit a Soroban contract call
const result = await signTransaction(xdr, { network: "TESTNET" });

Soroban Contract Calls

Smart Escrow Link generation triggers a contract interaction:

import { fundEscrow } from "@/lib/stellar/contract";

// Buyer funds the escrow β€” this prompts Freighter for signature
const { hash } = await fundEscrow({
  escrowId,
  buyerAddress: publicKey,
  amount: BigInt(escrow.amount),
});

Logistics API (Terminal Africa)

Real-time shipment status is polled from the backend and rendered as a visual timeline:

// TrackingTimeline.tsx
const { tracking } = useTracking(escrowId);
// Renders: ORDER_PLACED β†’ PICKED_UP β†’ IN_TRANSIT β†’ DELIVERED

Testing

# Unit tests (Jest + React Testing Library)
npm run test

# End-to-end tests (Playwright)
npm run test:e2e

# Type checking
npm run type-check

# Lint
npm run lint

Test Coverage Goals

  • Wallet connect / disconnect flows
  • Escrow link generation form validation
  • Payment page β€” funded vs unfunded state
  • Tracking timeline rendering
  • Dispute form submission
  • Mobile responsiveness (Playwright viewport tests)

Design System

TrustLink uses shadcn/ui components built on Radix UI primitives, styled with TailwindCSS. The design language is intentionally clean and "trust-signalling" β€” we're asking people to commit real money through a social media link.

Color Tokens

Token Value Usage
--primary #1B2A6B (navy) CTAs, headers
--accent #7B68EE (stellar purple) Highlights, links
--success #22C55E Delivery confirmed, funds released
--warning #F59E0B In transit, awaiting confirmation
--destructive #EF4444 Dispute raised, errors

Component Rules

  • All payment-facing pages must show the escrow contract address in a visible trust badge.
  • State changes (Funded, Shipped, Completed) must trigger visible feedback β€” no silent updates.
  • Skeleton loaders for all async data β€” no layout shift.

Contributing via Stellar Wave

This repo is part of the Stellar Wave Program β€” join the sprint, pick an issue, earn rewards.

Good First Issues

Look for good first issue and Stellar Wave labels.

Example beginner-friendly tasks:

  • Add loading skeleton to the TrackingTimeline component
  • Improve mobile layout of the payment confirmation page
  • Add form field validation messages to EscrowLinkGenerator
  • Write a unit test for useWallet hook
  • Improve accessibility (ARIA labels) on the dispute form

Example medium tasks:

  • Implement dark mode support
  • Add a "Copy Link" with QR code generator on the link creation success page
  • Build the vendor analytics dashboard page
  • Add i18n support for Nigerian Pidgin / French (West Africa focus)

Contribution Workflow

# 1. Fork the repo and create your branch
git checkout -b feat/your-feature-name

# 2. Make your changes and write tests

# 3. Ensure everything passes
npm run test && npm run lint && npm run type-check

# 4. Commit using conventional commits
git commit -m "feat: add QR code to escrow link success page"

# 5. Open a Pull Request β€” describe what you did and reference the issue

πŸ—ΊοΈ Roadmap

  • Vendor dashboard (escrow creation, link sharing)
  • Buyer payment page (wallet connect + fund)
  • Order tracking timeline
  • Dispute form
  • Admin dispute resolution panel
  • Vendor analytics dashboard (transaction volume, payout history)
  • Mobile app wrapper (React Native / PWA)
  • WhatsApp Pay integration (for non-wallet buyers)
  • Multi-language support (FR, HA, YO)
  • Vendor pro tier (custom branding)

πŸ“œ License

MIT Β© TrustLink Contributors


Powered by Next.js Β· Secured by Stellar Soroban Β· Part of the Stellar Wave ecosystem.

About

Frontend For Trust-Link Project:

Resources

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 98.8%
  • Other 1.2%