- Node.js 18 LTS or higher
- npm or yarn
- Git
- iOS Simulator (Mac only) or Android Studio
- Expo CLI
- Expo Go app (for physical device testing)
git clone https://github.com/TrustUp-app/TrustUp-Frontend.git
cd TrustUp-Frontendnpm installThis frontend connects to the TrustUp API backend.
The default configuration points to the production API. No additional setup needed.
- Clone and setup the backend repository:
git clone https://github.com/TrustUp-app/TrustUp-API.git
cd TrustUp-API
npm install-
Follow the TrustUp API Contributing Guide
-
Start the API:
npm run start:dev- Update your frontend
.env:
EXPO_PUBLIC_API_URL=http://localhost:4000/api/v1Install Expo CLI globally (if not already installed):
npm install -g expo-cliLogin to Expo (optional, needed for building):
expo login- Download Xcode from the Mac App Store
- Install Xcode Command Line Tools:
xcode-select --install- Open Xcode
- Go to Preferences → Components
- Download your preferred iOS Simulator
sudo gem install cocoapods- Download from developer.android.com
- During installation, ensure these components are selected:
- Android SDK
- Android SDK Platform
- Android Virtual Device
Add to your ~/.bashrc, ~/.zshrc, or equivalent:
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools- Open Android Studio
- Go to Tools → AVD Manager
- Click "Create Virtual Device"
- Select a device (e.g., Pixel 5)
- Download and select a system image (e.g., Android 13)
- Click Finish
npm startThis opens the Expo Developer Tools in your browser.
npm run iosOr press i in the Expo Developer Tools terminal.
npm run androidOr press a in the Expo Developer Tools terminal.
-
Install Expo Go on your device:
-
Ensure your device and computer are on the same network
-
Run
npm startand scan the QR code:- iOS: Use the Camera app
- Android: Use the Expo Go app
npm run webApp.tsx- Application entry pointcomponents/- Reusable UI componentsshared/- Shared components (Layout, Navigation, etc.)
pages/- Screen componentsInvestScreen/- Investment flow screensPayScreen/- Payment flow screens
types/- TypeScript type definitionsassets/- Images, fonts, and static resources
- Create component file in appropriate directory:
// components/shared/Button.tsx
import React from 'react';
import { TouchableOpacity, Text } from 'react-native';
interface ButtonProps {
title: string;
onPress: () => void;
}
export const Button: React.FC<ButtonProps> = ({ title, onPress }) => {
return (
<TouchableOpacity
onPress={onPress}
className="bg-blue-500 px-4 py-2 rounded"
>
<Text className="text-white font-bold">{title}</Text>
</TouchableOpacity>
);
};- Export from index file if needed:
// components/shared/index.ts
export * from './Button';- Create screen directory and component:
// pages/ProfileScreen/ProfileScreen.tsx
import React from 'react';
import { View, Text } from 'react-native';
export const ProfileScreen: React.FC = () => {
return (
<View className="flex-1 p-4">
<Text className="text-2xl font-bold">Profile</Text>
</View>
);
};- Add screen-specific components in subdirectory:
pages/ProfileScreen/
├── ProfileScreen.tsx
└── components/
├── ProfileHeader.tsx
└── ProfileSettings.tsx
Use Tailwind utility classes with the className prop:
<View className="flex-1 bg-white p-4">
<Text className="text-xl font-bold text-gray-900">
Hello World
</Text>
</View># Check for linting errors
npm run lint
# Fix linting errors automatically
npm run format# TypeScript type checking
npx tsc --noEmit# Run unit tests (when configured)
npm test
# Run tests in watch mode
npm run test:watch
# Run E2E tests (when configured)
npm run test:e2e
# Generate coverage report
npm run test:coverageInstall EAS CLI:
npm install -g eas-cliLogin to Expo:
eas loginConfigure EAS:
eas build:configure# Development build
eas build --platform ios --profile development
# Production build
eas build --platform ios --profile productionNote: iOS production builds require an Apple Developer account ($99/year).
# Development build
eas build --platform android --profile development
# Production build
eas build --platform android --profile productionnpm run prebuildThis creates ios/ and android/ directories for advanced customization.
- Use PascalCase for component files:
UserProfile.tsx - Use descriptive names:
LoanApplicationForm.tsxnotForm.tsx - Group related components in directories
components/
├── shared/ # Reusable across entire app
│ ├── Button.tsx
│ └── Input.tsx
└── LoanScreen/ # Domain-specific components
└── LoanScreen.tsx
├── components.tsx
└── LoanCard.tsx
- Always define prop interfaces
- Avoid
anytypes - Use strict mode
- Export types for reusability
// types/Loan.ts
export interface Loan {
id: string;
amount: number;
status: 'pending' | 'active' | 'completed';
}
// components/LoanCard.tsx
import { Loan } from '@/types/Loan';
interface LoanCardProps {
loan: Loan;
onPress: (id: string) => void;
}
export const LoanCard: React.FC<LoanCardProps> = ({ loan, onPress }) => {
// Component implementation
};- Use NativeWind (Tailwind) for styling
- Follow mobile-first approach
- Use consistent spacing scale (p-2, p-4, p-6, etc.)
- Define custom colors in
tailwind.config.js
- Use React hooks (
useState,useEffect) for local state - Consider Context API for shared state
- Implement custom hooks for reusable logic
// hooks/useAuth.ts
export const useAuth = () => {
const [user, setUser] = useState(null);
const [loading, setLoading] = useState(true);
// Authentication logic
return { user, loading, login, logout };
};# Clear Metro bundler cache
npx expo start -c
# Or manually clear cache
rm -rf node_modules/.cache# Reset iOS Simulator
xcrun simctl erase all
# Rebuild iOS project
cd ios
pod install
cd ..
npm run ios# List available AVDs
emulator -list-avds
# Start specific AVD
emulator -avd Pixel_5_API_33
# Cold boot
emulator -avd Pixel_5_API_33 -no-snapshot-load- Restart the development server
- Ensure variables start with
EXPO_PUBLIC_ - Check
.envfile is in root directory - Clear cache:
npx expo start -c
# Regenerate TypeScript definitions
npx expo customize tsconfig.json
# Check for type errors
npx tsc --noEmit- Verify
tailwind.config.jsis properly configured - Check
babel.config.jsincludes NativeWind plugin - Restart Metro bundler with cache clear
- Ensure
classNameprop is used (notstylefor Tailwind)
- Verify
EXPO_PUBLIC_API_URLin.env - Check backend is running (if using local API)
- Ensure device/emulator can reach the API:
- Use
http://10.0.2.2:4000for Android Emulator - Use computer's IP for physical devices (e.g.,
http://192.168.1.100:4000)
- Use
- Create a feature branch:
git checkout -b feature/my-feature-
Make your changes following the conventions above
-
Test your changes:
npm run lint
npm test- Commit with descriptive message:
git commit -m "feat: add loan application form"- Push to your fork:
git push origin feature/my-feature- Open a Pull Request on GitHub with:
- Clear description of changes
- Screenshots/videos for UI changes
- Reference to related issues
Please be respectful and constructive in all interactions. We're building this together! 🚀