Skip to main content

Overview

d-sports-engage-native (package name: engage-native) is the native mobile app for D-Sports. It mirrors the core PWA experience on iOS and Android: wallet, shop, leaderboard, locker room, and profile.
  • Run: bunx expo start or bun run start — then press a for Android or i for iOS, or scan the QR code with Expo Go.

Tech stack

CategoryTechnology
FrameworkExpo 54, React Native 0.81, React 19
AuthClerk (Expo)
PaymentsRevenueCat (react-native-purchases)
Web3Thirdweb
StateZustand
StorageMMKV
UILucide React Native
NavigationExpo Router
PackageBun

Features

  • Wallet — Tokens, holdings, pack opening, crypto checkout (via PWA backend)
  • Shop — Collectibles, cart, coin bundles, checkout
  • Leaderboard — Rankings and filters
  • Locker room — Social feed and engagement
  • Profile — User profile and settings
  • Theme — Dark/light mode (default dark)

API client architecture

All backend communication flows through a shared API client in lib/api/. The client automatically injects Clerk auth tokens and parses the normalized response envelope used by d-sports-api.

Normalized response envelope

Every API response is unwrapped into a standard ApiResponse<T> shape:
interface ApiResponse<T> {
  success: boolean;
  data?: T;
  error?: string;
  code?: string; // machine-readable error code from the backend
}
The client detects whether a response uses the { success, data } envelope or a legacy bare JSON body and normalizes both into ApiResponse<T>. On non-2xx responses the client extracts error and code fields from the body when available.

API modules

You access all modules through the useApi() hook:
import { useApi } from "@/lib/api";

const api = useApi();
const result = await api.leaderboard.getLeaderboard();
if (result.success) {
  console.log(result.data);
}
ModuleFileEndpoints
Useruser-api.tsProfile, stats, follow/unfollow
Leaderboardleaderboard-api.tsRankings, stats, search, seasons, winners
Questsquests-api.tsQuest list, start, complete step, daily visit, rewards
Collectiblescollectibles-api.tsPacks, purchase, open, inventory, opened packs
Walletwallet-api.tsBalances, transactions, connected wallets
Shopshop-api.tsProduct catalog and featured items
Locker roomlocker-room-api.tsSocial feed, posts, comments
Teamsteams-api.tsTeam listings and membership
Checkoutcheckout-api.tsCrypto checkout and verification

MMKV cache layer

The client includes a cache-first fetching utility (lib/api/cache.ts) backed by MMKV. Each domain has a configured TTL (for example, 2 minutes for leaderboard and quests, 5 minutes for teams). Stale cache entries are served as a fallback when the network request fails.

Environment variables

Set these in your .env (or Expo config) before running the app:
VariablePurpose
EXPO_PUBLIC_API_URLBase URL for the d-sports-api backend
EXPO_PUBLIC_CLERK_PUBLISHABLE_KEYClerk publishable key
EXPO_PUBLIC_THIRDWEB_CLIENT_IDThirdweb client ID for web3 features
EXPO_PUBLIC_REVENUECAT_APPLE_KEYRevenueCat Apple API key
EXPO_PUBLIC_REVENUECAT_GOOGLE_KEYRevenueCat Google API key
EXPO_PUBLIC_SENTRY_DSNSentry DSN for error tracking
On Android emulators the client automatically rewrites localhost / 127.0.0.1 in EXPO_PUBLIC_API_URL to 10.0.2.2 so requests reach the host machine.

Getting started

  1. Clone the repository and run bun install.
  2. Copy .env.example to .env and fill in the values above.
  3. Run bunx expo start.
  4. For development builds: bun run build:dev (EAS) or run with Expo dev client.
The app targets both native and web (responsive) and uses the same backend (d-sports-api) as the PWA for API and checkout flows.

Ecosystem overview

See how the native app fits with the PWA, site, and Mic’d Up.