Skip to content

Derrick-Ryan-Giggs/AgroLink-Mobile-App

Repository files navigation

AgroLink Mobile App

AgroLink is a comprehensive mobile application designed to assist farmers and agricultural stakeholders. It features mapping, weather updates, payment integration, notifications, messaging, and AI-driven agricultural advice.

Tech Stack

  • Frontend: React Native with Expo, NativeWind (Tailwind CSS)
  • Backend: Node.js, Express, Socket.io
  • Database/Services: Firebase Admin, Google Maps/Geoapify (assumed based on maps), Paystack (Payments)

Prerequisites

  • Node.js (LTS recommended)
  • Expo CLI
  • Expo Go app installed on your physical mobile device (available on App Store and Google Play).

Installation

  1. Install Root/Frontend Dependencies:

    npm install
  2. Install Backend Dependencies:

    cd backend
    npm install
    cd ..

Configuration

API Configuration

The app communicates with a local backend. For the app to reach the backend on a physical device, you likely need to update the API URL.

  1. Open services/api.ts.
  2. Update the BASE_URL to use your computer's local IP address instead of localhost or 10.0.2.2 if you are running on a physical device over Wi-Fi or USB (without reverse forwarding).
    // Example
    const BASE_URL = 'http://192.168.1.X:3000/api'; 
    Tip: You can find your IP using ipconfig (Windows) or ifconfig (Mac/Linux).

Running the Project

You need to run both the backend server and the frontend application.

1. Start the Backend

Open a terminal and run:

cd backend
npm start
# OR for development with auto-restart:
npm run dev

The server usually runs on port 3000.

2. Start the Frontend (Expo)

Open a new terminal in the project root and run:

npx expo start

This will start the Metro Bundler.


How to Run on Device

Option A: Expo Go (Wireless - Recommended for Quick Test)

  1. Ensure your phone and computer are connected to the same Wi-Fi network.
  2. Run npx expo start.
  3. Scan the QR code displayed in the terminal:
    • Android: Use the Expo Go app.
    • iOS: Use the Camera app.

Option B: USB Debugging (Android)

If you have connection issues or prefer a wired connection:

  1. Enable USB Debugging on your Android device (Settings > Developer Options > USB Debugging).
  2. Connect your device to the computer via USB.
  3. You can run the app using the Expo Go app over USB, or build a development build.

Using Expo Go over USB:

  1. Connect device.
  2. Run:
    npx expo start --localhost
  3. In the terminal, press a to open on Android. Expo should detect the connected device.

Troubleshooting USB Backend Connection: If running on a physical device via USB, localhost refers to the phone itself. To access your computer's localhost:

  • Solution 1: Use your computer's local IP in services/api.ts (e.g., http://192.168.x.x:3000/api).
  • Solution 2 (ADB Reverse): Route the port from your phone to your computer.
    adb reverse tcp:3000 tcp:3000
    Now, http://localhost:3000 on the phone will forward to your computer.

Project Structure

  • /app: Main application screens and routing (Expo Router).
  • /backend: Node.js/Express server and logic.
  • /components: Reusable UI components.
  • /services: API service interactions (Location, Notification, etc.).
  • /utils: Helper functions and configurations.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors