Skip to content

NextGenXplorer/Coffee_Connect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

128 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Coffee Connect โ˜•

A React Native mobile app for tracking coffee prices from various depots in Karnataka, India. Built with Expo, Firebase Firestore, and TypeScript.

EAS Project GitHub

๐Ÿ“‹ Project Information

  • Package Name: com.master.coffeeconnect
  • EAS Project ID: b5229c37-f73f-4407-a118-90083cb95221
  • Backend URL: https://coffee-connect-mu.vercel.app
  • Firebase Project: coffeeconnect-2d910
  • Platform: Android (React Native/Expo)

โœจ Features

  • โ˜• Real-time coffee price display per 50kg bag
  • ๐ŸŒฑ Variety-wise filtering (Arabica Parchment, Arabica Cherry)
  • ๐Ÿช Depot-wise filtering (Madikeri, Virajpete, Kushalnagar, Somvarpete, Shanivarasanthe, Sakleshpura)
  • ๐Ÿ“Š Price statistics and trends
  • ๐Ÿ“ˆ Interactive charts and analytics
  • ๐ŸŒ Multi-language support (English, Kannada)
  • ๐Ÿ”” Push notifications for price updates
  • ๐Ÿ”Š Text-to-speech price announcements
  • ๐Ÿค– AI-powered data extraction (Gemini AI)
  • ๐Ÿ‘จโ€๐Ÿ’ผ Admin panel for price management
  • ๐Ÿ”„ Real-time updates from Firebase Firestore

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+ installed
  • npm or yarn package manager
  • Expo CLI (npm install -g expo-cli)
  • EAS CLI (npm install -g eas-cli)
  • Android Studio (for Android builds) or Xcode (for iOS builds)

1. Clone Repository

git clone git@github.com:NextGenXplorer/Coffee_Connect.git
cd Coffee_Connect

2. Install Dependencies

npm install

3. Environment Setup

Create a .env file in the root directory with the following structure:

# Firebase Configuration
EXPO_PUBLIC_FIREBASE_API_KEY="your-firebase-api-key"
EXPO_PUBLIC_FIREBASE_AUTH_DOMAIN="your-project.firebaseapp.com"
EXPO_PUBLIC_FIREBASE_PROJECT_ID="your-project-id"
EXPO_PUBLIC_FIREBASE_STORAGE_BUCKET="your-project.firebasestorage.app"
EXPO_PUBLIC_FIREBASE_MESSAGING_SENDER_ID="your-sender-id"
EXPO_PUBLIC_FIREBASE_APP_ID="your-app-id"

# Admin Credentials (Configure 3 admins)
EXPO_PUBLIC_ADMIN_USERNAME_1="admin1"
EXPO_PUBLIC_ADMIN_PASSWORD_1="password1"
EXPO_PUBLIC_ADMIN_ROLE_1="super_admin"
EXPO_PUBLIC_ADMIN_MARKET_1="all"

EXPO_PUBLIC_ADMIN_USERNAME_2="admin2"
EXPO_PUBLIC_ADMIN_PASSWORD_2="password2"
EXPO_PUBLIC_ADMIN_ROLE_2="super_admin"
EXPO_PUBLIC_ADMIN_MARKET_2="all"

EXPO_PUBLIC_ADMIN_USERNAME_3="admin3"
EXPO_PUBLIC_ADMIN_PASSWORD_3="password3"
EXPO_PUBLIC_ADMIN_ROLE_3="super_admin"
EXPO_PUBLIC_ADMIN_MARKET_3="all"

# Backend URL (Vercel deployment)
EXPO_PUBLIC_BACKEND_URL="https://coffee-connect-mu.vercel.app"

# Google Gemini AI (for AI data extraction)
EXPO_PUBLIC_GEMINI_API_KEY="your-gemini-api-key"

4. EAS Environment Variables

Use the provided eascred.sh script to upload environment variables to EAS:

# Dry run first to verify
bash eascred.sh --env .env --dry-run

# Upload to EAS production environment
bash eascred.sh --env .env

Important Note about EXPO_PUBLIC_ variables:

  • Variables prefixed with EXPO_PUBLIC_ are embedded in the compiled app
  • They use "sensitive" visibility in EAS (NOT "secret")
  • They will be visible in plain text in your compiled app
  • Never store truly secret keys in EXPO_PUBLIC_ variables
  • The script automatically handles this correctly

5. Firebase Setup

  1. Go to Firebase Console
  2. Create a new project: coffeeconnect-2d910 (or your own)
  3. Enable Firestore Database
  4. Enable Cloud Messaging for push notifications
  5. Add an Android app with package name: com.master.coffeeconnect
  6. Download google-services.json and place it in the root directory
  7. Set up Firestore security rules (see below)

6. Firestore Database Structure

Create collections with the following structure:

Collection: coffeePrices

{
  breed: string,           // 'CB' (Arabica Parchment) or 'BV' (Arabica Cherry)
  market: string,          // Depot name (Madikeri, Virajpete, etc.)
  maxPrice: number,        // Maximum price per 50kg bag
  minPrice: number,        // Minimum price per 50kg bag
  pricePerKg: number,      // Price used for calculations
  quality: string,         // 'A', 'B', 'C'
  source: string,          // Admin username who added this price
  verified: boolean,       // Admin verification status
  lastUpdated: timestamp,  // Firestore timestamp
  expiresAt: timestamp     // Auto-delete after 7 days
}

Collection: pushTokens

{
  token: string,           // FCM or Expo push token
  platform: string,        // 'fcm' or 'expo'
  createdAt: timestamp
}

Collection: notifications

{
  title: string,
  message: string,
  imageUrl: string | null,
  priceData: object,
  sentAt: timestamp,
  totalSent: number,
  totalFailed: number
}

7. Backend Setup

The backend is deployed on Vercel at: https://coffee-connect-mu.vercel.app

To deploy your own backend:

  1. Navigate to backend directory:
cd backend
  1. Create .env file with Firebase service account:
PORT=3000
FIREBASE_PROJECT_ID=coffeeconnect-2d910
FIREBASE_SERVICE_ACCOUNT={"type":"service_account",...}
  1. Deploy to Vercel:
# Install Vercel CLI
npm install -g vercel

# Deploy
vercel --prod

8. Run the App

# Start Expo development server
npm start

# Run on Android
npm run android

# Run on iOS
npm run ios

# Run on Web
npm run web

๐Ÿ—๏ธ Building for Production

Android APK/AAB Build

# Build APK for testing
eas build --platform android --profile preview

# Build AAB for Google Play Store
eas build --platform android --profile production

iOS Build

# Build for TestFlight/App Store
eas build --platform ios --profile production

๐Ÿ“ฑ App Structure

Coffee_Connect/
โ”œโ”€โ”€ App.tsx                          # Main app entry point
โ”œโ”€โ”€ app.config.js                    # Expo/EAS configuration
โ”œโ”€โ”€ firebase.config.ts               # Firebase initialization
โ”œโ”€โ”€ i18n.ts                          # Internationalization setup
โ”œโ”€โ”€ eascred.sh                       # EAS environment variables script
โ”‚
โ”œโ”€โ”€ screens/                         # App screens
โ”‚   โ”œโ”€โ”€ HomeScreen.tsx               # Main price listing screen
โ”‚   โ”œโ”€โ”€ StatsScreen.tsx              # Analytics and statistics
โ”‚   โ”œโ”€โ”€ MarketScreen.tsx             # Market-wise comparison
โ”‚   โ”œโ”€โ”€ AboutScreen.tsx              # About and contact info
โ”‚   โ”œโ”€โ”€ NotificationsScreen.tsx      # Notification history
โ”‚   โ”œโ”€โ”€ LanguageSelectionScreen.tsx  # Language picker (first launch)
โ”‚   โ”œโ”€โ”€ AdminLoginScreen.tsx         # Admin authentication
โ”‚   โ”œโ”€โ”€ AdminDashboardScreen.tsx     # Admin price management
โ”‚   โ”œโ”€โ”€ AdminPriceFormScreen.tsx     # Manual price entry form
โ”‚   โ””โ”€โ”€ AdminAIExtractScreen.tsx     # AI-powered data extraction
โ”‚
โ”œโ”€โ”€ components/                      # Reusable components
โ”‚   โ””โ”€โ”€ Header.tsx                   # Common header component
โ”‚
โ”œโ”€โ”€ utils/                           # Utility functions
โ”‚   โ”œโ”€โ”€ adminAuth.ts                 # Admin authentication logic
โ”‚   โ””โ”€โ”€ aiExtraction.ts              # Gemini AI integration
โ”‚
โ”œโ”€โ”€ types/                           # TypeScript type definitions
โ”‚   โ””โ”€โ”€ index.ts                     # Common interfaces
โ”‚
โ”œโ”€โ”€ locales/                         # Translation files
โ”‚   โ”œโ”€โ”€ en.json                      # English translations
โ”‚   โ””โ”€โ”€ kn.json                      # Kannada translations
โ”‚
โ”œโ”€โ”€ assets/                          # App assets
โ”‚   โ”œโ”€โ”€ coffee_logo.png              # App icon/logo
โ”‚   โ””โ”€โ”€ ...
โ”‚
โ””โ”€โ”€ backend/                         # Node.js backend (Vercel)
    โ”œโ”€โ”€ server.js                    # Express server with push notifications
    โ”œโ”€โ”€ .env                         # Backend environment variables
    โ””โ”€โ”€ package.json                 # Backend dependencies

๐ŸŽจ Coffee Depots & Varieties

Supported Depots (Markets)

  • Madikeri (เฒฎเฒกเฒฟเฒ•เณ‡เฒฐเฒฟ)
  • Virajpete (เฒตเฒฟเฒฐเฒพเฒœเฒชเณ‡เฒŸเณ†)
  • Kushalnagar (เฒ•เณเฒถเฒพเฒฒเฒจเฒ—เฒฐ)
  • Somvarpete (เฒธเณ‹เฒฎเฒตเฒพเฒฐเฒชเณ‡เฒŸเณ†)
  • Shanivarasanthe (เฒถเฒจเฒฟเฒตเฒพเฒฐเฒธเฒ‚เฒคเณ†)
  • Sakleshpura (เฒธเฒ•เฒฒเณ‡เฒถเฒชเณเฒฐ)

Coffee Varieties

  • CB - Arabica Parchment (เฒ…เฒฐเณ‡เฒฌเฒฟเฒ•เฒพ เฒชเฒพเฒฐเณเฒšเณโ€Œเฒฎเณ†เฒ‚เฒŸเณ)
  • BV - Arabica Cherry (เฒ…เฒฐเณ‡เฒฌเฒฟเฒ•เฒพ เฒšเณ†เฒฐเณเฒฐเฒฟ)

Quality Grades

  • Grade A - Premium quality
  • Grade B - Standard quality
  • Grade C - Basic quality

๐Ÿ” Admin Features

Admin Roles

  • super_admin: Full access to all depots
  • market_admin: Access to specific depot only

Admin Capabilities

  1. Manual Price Entry: Add prices with breed, depot, grade selection
  2. AI Data Extraction: Paste price data (Kannada/English), AI extracts structured data
  3. Price Management: Edit, delete existing prices
  4. Push Notifications: Automatic notifications on price updates
  5. Dashboard Analytics: View statistics and recent updates

Accessing Admin Panel

  1. Open app and navigate to "About" screen
  2. Tap "Admin Panel" at the bottom
  3. Login with admin credentials
  4. Choose between Manual Entry or AI Extraction

๐Ÿค– AI Data Extraction

The app uses Google Gemini AI to extract structured price data from raw text (Kannada or English).

How it works:

  1. Admin pastes depot price data (e.g., from WhatsApp, SMS)
  2. AI automatically identifies:
    • Depot name
    • Date
    • Coffee varieties (Parchment/Cherry)
    • Prices (Max and Min per 50kg bag)
  3. Admin reviews and confirms extracted data
  4. Prices are saved to Firebase

Supported Input Formats:

  • Kannada text with coffee prices
  • English text with coffee prices
  • Mixed Kannada-English text
  • Price tables and lists

๐Ÿ”” Push Notifications

The app supports two notification systems:

  1. FCM (Firebase Cloud Messaging): For Android native push
  2. Expo Push Notifications: Fallback for Expo Go

Notification Triggers:

  • New price added by admin
  • Price update for specific depot/variety

Backend Integration:

  • Node.js server on Vercel
  • Sends notifications to all registered tokens
  • Includes price details and depot information
  • Supports rich notifications with images

๐ŸŒ Internationalization (i18n)

The app supports:

  • English (en)
  • Kannada (kn) - เฒ•เฒจเณเฒจเฒก

Translation files: locales/en.json and locales/kn.json

Language Selection:

  • First launch: Language picker screen
  • Settings: Change language anytime from About screen
  • Persistent: Language preference saved in AsyncStorage

๐Ÿ› ๏ธ Technologies Used

  • React Native - Cross-platform mobile framework
  • Expo (SDK 54) - Development platform
  • TypeScript - Type-safe JavaScript
  • Firebase Firestore - Real-time NoSQL database
  • Firebase Cloud Messaging - Push notifications
  • Google Gemini AI - AI data extraction
  • React Navigation - Navigation library
  • i18next - Internationalization framework
  • Expo Speech - Text-to-speech
  • AsyncStorage - Local data persistence
  • Express.js - Backend server (Node.js)
  • Vercel - Serverless deployment

๐Ÿ“ Migration from Reshme Info

This app was migrated from Reshme Info (silk/cocoon price tracking) to Coffee Connect:

Key Changes:

  • โœ… Package name: com.reshmeinfo โ†’ com.master.coffeeconnect
  • โœ… App name: Reshme Info โ†’ Coffee Connect
  • โœ… Collection: cocoonPrices โ†’ coffeePrices
  • โœ… Markets: Silk markets โ†’ Coffee depots
  • โœ… Breeds: CB/BV (silk) โ†’ CB/BV (coffee varieties)
  • โœ… Price unit: Per kg โ†’ Per 50kg bag
  • โœ… Icons: Leaf โ†’ Coffee bean
  • โœ… Backend: reshme-info.vercel.app โ†’ coffee-connect-mu.vercel.app
  • โœ… EAS Project: New project initialized
  • โœ… Firebase: New project setup
  • โœ… All translations updated
  • โœ… AI extraction retrained for coffee data

๐Ÿค Contributing

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

๐Ÿ“„ License

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

๐Ÿ‘ฅ Authors

๐Ÿ“ž Support

๐Ÿ™ Acknowledgments

  • Coffee farmers and depot managers for price information
  • Firebase for backend infrastructure
  • Google Gemini AI for data extraction capabilities
  • Expo team for the amazing development platform

Made with โค๏ธ for coffee farmers and traders in Karnataka

๐Ÿค– Documentation generated with Claude Code

Releases

No releases published

Packages

 
 
 

Contributors