A React Native mobile application where users sign in with Google and chat with an AI assistant powered by the Hugging Face Chat Completions API.
demo.webm
- Google Sign-In authentication gate before accessing chat
- Clean chat interface with sent/received message cards
- AI response typing animation for better UX
- Hugging Face API integration with clear runtime error messages
- Boot splash support for smoother app startup
- React Native
0.84.1+ TypeScript - React
19 @react-native-google-signin/google-signinaxiosreact-native-configreact-native-bootsplashreact-native-size-matters- Firebase Messaging dependency scaffold (
@react-native-firebase/messaging)
.
├── App.tsx
├── src
│ ├── api
│ │ └── httpRequest.ts
│ ├── components
│ │ ├── AppHeader.tsx
│ │ ├── EmptyChat.tsx
│ │ ├── InputMessage.tsx
│ │ ├── ResponseMessage.tsx
│ │ ├── SentMessageCard.tsx
│ │ └── TypingEffect.tsx
│ ├── features
│ │ ├── auth
│ │ │ └── GoogleSignIn.tsx
│ │ └── ImagePicker
│ │ └── CameraGallery.tsx
│ ├── notification
│ │ └── useNotifications.ts
│ └── screens
│ ├── AuthScreen.tsx
│ └── ChatScreen.tsx
└── android/app/google-services.json (local setup file)
- Node.js
>= 22.11.0 - npm (or yarn)
- React Native development environment configured:
- Android setup
- iOS setup (macOS only)
npm installCreate .env from the example template:
cp .env.example .envAdd your Hugging Face token in .env:
TOKEN_KEY_HUGGING_FACE=hf_your_token_here- Add your Firebase Android config file to:
android/app/google-services.json
- Ensure
webClientIdinsrc/features/auth/GoogleSignIn.tsxmatches your Google OAuth Web Client ID. - In Firebase/Google Cloud Console, configure:
- Android package name:
com.kamal.chat - SHA-1 / SHA-256 fingerprints for your debug/release keys
- Android package name:
npm start# Android
npm run android# iOS (macOS only)
cd ios && pod install && cd ..
npm run iosApp.tsxstarts atAuthScreenuntil login succeeds.GoogleSignIn.tsxhandles OAuth and notifies the app on successful sign-in.ChatScreen.tsxsends prompts throughsrc/api/httpRequest.ts.httpRequest.tscalls Hugging Face endpointhttps://router.huggingface.co/v1/chat/completions.- Responses are rendered as assistant messages with typing animation.
npm start- start Metro bundlernpm run android- build/run Android appnpm run ios- build/run iOS appnpm test- run Jest testsnpm run lint- run ESLint
-
Missing Hugging Face token
- Ensure
.envexists and includesTOKEN_KEY_HUGGING_FACE - Rebuild the app after editing
.env
- Ensure
-
Hugging Face 401 error
- Verify token value and permissions
- Confirm token is passed without extra quotes or duplicate
Bearerprefix
-
Google Sign-In fails
- Confirm
google-services.jsonbelongs to the same Firebase project - Validate package name and SHA fingerprints
- Check Google Play Services availability on emulator/device
- Confirm
-
Android build issues
- Clean and retry:
cd android && ./gradlew clean && cd .. npm run android
- Clean and retry:
- Keep
.envout of source control - Do not commit production API keys
- Rotate tokens immediately if exposed
- Persist authenticated session across app restarts
- Add sign-out action in chat header
- Save chat history locally or remotely
- Wire notification hook into active app flow
This project currently has no explicit license. Add a LICENSE file before public/open-source distribution.