Appearance
Try it — example apps
The repo ships two runnable apps under examples/ that mount <AWChat /> so you can try the SDK before wiring it into your own app. Both have a Mock / Live toggle: Mock runs on built-in sample data with no backend; Live points at a real AW Chat backend.
They are workspace packages, so run them from a clone of the monorepo — install once at the root:
bash
pnpm install| App | Package | SDK it exercises |
|---|---|---|
examples/web | @aw-chat/example-web | @aw-chat/web (Web and TMA) |
examples/react-native | @aw-chat/example-react-native | @aw-chat/react-native (iOS + Android) |
Web (React) — examples/web
bash
pnpm --filter @aw-chat/example-web devOpens a Vite dev server on localhost:41180. Flip Mock / Live at the top. Live config comes from the URL:
?live— force Live mode.?server=https://your-backend— backend base URL (defaults tohttp://localhost:3100on localhost).?token=<jwt>&userId=<id>— required for Live (or build withVITE_DEMO_TOKENS=id:jwt,...). No demo JWTs are committed in the repo.
Example: http://localhost:41180/?live&server=http://localhost:3100&token=<jwt>
This same app is the TMA reference — Telegram Mini Apps use the identical @aw-chat/web package (pass telegramChatId for push).
React Native (mobile) — examples/react-native
There are two ways to run it — a zero-native browser preview, and a real build on a device or simulator.
A. Browser preview — fastest, no native tooling
bash
pnpm --filter @aw-chat/example-react-native webServes the native SDK in a browser via react-native-web on localhost:5181 (the same technique Expo's web target uses). Best for a quick look at the UI and flows. This path resolves the SDK's .web image fallback, so it does not need react-native-fast-image.
B. Device / simulator (Expo)
bash
pnpm --filter @aw-chat/example-react-native ios # or: android / startThis needs a custom dev build — not Expo Go.
The SDK renders every image through react-native-fast-image, a native module. Expo Go ships a fixed set of native modules and cannot load it, so the app must be a dev build that includes it:
bash
npx expo prebuild # generates ios/ + android/
npx expo run:ios # or run:android — builds & installs a dev clientor use an EAS dev build. The same rule applies when you embed the SDK in your own app: react-native-fast-image must be in the binary — it cannot be added over-the-air. (Only that native module is a build-time requirement; your own JS/asset changes still ship OTA.)
Toggle Mock / Live with the floating button. For Live, point the app at your backend and a token — edit App.tsx, or set env vars before starting Expo:
bash
EXPO_PUBLIC_AW_SERVER=https://chat.example.com \
EXPO_PUBLIC_AW_TOKEN=<jwt> \
EXPO_PUBLIC_AW_USER_ID=<id> \
pnpm --filter @aw-chat/example-react-native iosNo backend? Just use Mock
Neither app needs a server in Mock mode — it renders the full UI (chat, tickets, channel, comments) on bundled sample data. Point at Live only when you want to exercise a real backend. For embedding the SDK with mock data directly, see the demo prop in Quick start.