Skip to content

Swordship/API-First-Video-App-Frontend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“± Video Streaming App - Mobile Frontend

A beautiful, secure React Native mobile application for video streaming with JWT authentication and seamless YouTube video playback.

React Native Expo JavaScript


πŸ“Έ App Screenshots

πŸ” Authentication Flow

Login Screen
Login Screen
Secure authentication with email & password
Signup Screen
Signup Screen
New user registration with validation

πŸ“Ί Video Experience

Dashboard
Dashboard
Browse curated startup videos
Video Player
Video Player
Full-screen playback with controls
Settings
Settings
User profile & account management

🎯 Key Features

πŸ” Authentication

  • βœ… JWT-based secure authentication
  • βœ… Persistent login across sessions
  • βœ… Automatic token management
  • βœ… Secure logout with token clearing

πŸ“Ί Video Streaming

  • βœ… YouTube video integration
  • βœ… Full playback controls
  • βœ… Smooth video transitions
  • βœ… Error handling & retry logic

🎨 User Experience

  • βœ… Modern, intuitive UI design
  • βœ… Smooth navigation animations
  • βœ… Pull-to-refresh functionality
  • βœ… Loading states & error messages

⚑ Performance

  • βœ… Optimized API calls
  • βœ… Efficient state management
  • βœ… Fast load times
  • βœ… Responsive on all devices

πŸ› οΈ Tech Stack

Technology Version Purpose
React Native 0.81.5 Cross-platform mobile framework
Expo ~54.0 Development & build platform
React Navigation 7.x Screen navigation & routing
Axios 1.13.4 HTTP client for API calls
AsyncStorage 2.2.0 Local data persistence
react-native-youtube-iframe 2.x YouTube video playback

πŸš€ Quick Start

Prerequisites

  • Node.js 16+
  • Expo Go app (iOS | Android)
  • Backend API running

Installation & Configuration

# Clone and install
git clone <your-repo-url>
cd frontend-repo
npm install

# Configure API endpoint
# Edit src/services/api.js with your backend IP
const API_BASE_URL = 'http://YOUR_IP:5000';

# Start development server
npm start

πŸ“± Architecture

Component Hierarchy

App.js (Root)
β”œβ”€β”€ NavigationContainer
β”‚   β”œβ”€β”€ AuthStack (Unauthenticated)
β”‚   β”‚   β”œβ”€β”€ LoginScreen
β”‚   β”‚   └── SignupScreen
β”‚   β”‚
β”‚   └── MainStack (Authenticated)
β”‚       β”œβ”€β”€ DashboardScreen
β”‚       β”‚   └── VideoTile Γ— 2
β”‚       β”œβ”€β”€ VideoPlayerScreen
β”‚       β”‚   └── YoutubePlayer
β”‚       └── SettingsScreen

Authentication Flow

App Launch β†’ Check Token β†’ [Found? MainStack : AuthStack]
                                      ↓
                              Login β†’ Save Token β†’ MainStack

Data Flow

User Action β†’ Component β†’ API Service β†’ Axios (adds JWT) β†’ Backend
                                                              ↓
UI Update ← Component ← API Service ← Axios ← Response

🎨 Design System

Color Palette

Color Hex Usage
Primary Blue #007AFF Buttons, links, accents
Background #f8f9fa App background
Card #ffffff Card background
Text Primary #1a1a1a Main text
Text Secondary #666666 Secondary text
Player BG #000000 Video player
Error #FF3B30 Error states

Typography

Element Size Weight
Large Title 32px Bold (700)
Title 20px Bold (700)
Headline 18px Semibold (600)
Body 16px Regular (400)
Caption 14px Medium (500)

πŸ“ Project Structure

frontend-repo/
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   └── VideoTile.js
β”‚   β”‚
β”‚   β”œβ”€β”€ screens/
β”‚   β”‚   β”œβ”€β”€ LoginScreen.js
β”‚   β”‚   β”œβ”€β”€ SignupScreen.js
β”‚   β”‚   β”œβ”€β”€ DashboardScreen.js
β”‚   β”‚   β”œβ”€β”€ VideoPlayerScreen.js
β”‚   β”‚   └── SettingsScreen.js
β”‚   β”‚
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ api.js
β”‚   β”‚   └── auth.js
β”‚   β”‚
β”‚   └── utils/
β”‚       └── storage.js
β”‚
β”œβ”€β”€ screenshots/
β”œβ”€β”€ App.js
β”œβ”€β”€ package.json
└── README.md

πŸ”Œ API Integration

Axios Configuration

// Automatic JWT injection
api.interceptors.request.use(async (config) => {
  const token = await AsyncStorage.getItem('authToken');
  if (token) config.headers.Authorization = `Bearer ${token}`;
  return config;
});

// Automatic logout on 401
api.interceptors.response.use(
  (response) => response,
  async (error) => {
    if (error.response?.status === 401) {
      await AsyncStorage.removeItem('authToken');
    }
    return Promise.reject(error);
  }
);

Endpoints

Method Endpoint Purpose
POST /auth/signup Create account
POST /auth/login Authenticate
GET /auth/me Get profile
POST /auth/logout End session
GET /dashboard Get videos
GET /video/:id/stream Get stream URL

πŸ‘€ User Journey

1. First Launch
   └─ No Token β†’ Login Screen

2. Signup
   └─ Enter Details β†’ POST /auth/signup β†’ Success β†’ Login Screen

3. Login
   └─ Credentials β†’ POST /auth/login β†’ JWT β†’ AsyncStorage β†’ Dashboard

4. Browse Videos
   └─ GET /dashboard β†’ Display 2 Videos β†’ Pull-to-refresh

5. Watch Video
   └─ Tap Video β†’ GET /video/:id/stream β†’ YouTube Player

6. Settings
   └─ View Profile β†’ Logout β†’ Clear Token β†’ Login Screen

πŸ› Troubleshooting

Network Error

Problem: Can't connect to backend

Fix:

  1. Backend running? Check http://localhost:5000
  2. Correct IP in api.js? Use computer's IP, not localhost
  3. Same WiFi network?
  4. Test from phone browser: http://YOUR_IP:5000

Video Won't Play

Problem: Error 153 or video fails

Fix:

  1. Using react-native-youtube-iframe? (Not webview)
  2. Android: Set androidLayerType: 'hardware'
  3. Playback token valid?

πŸš€ Production Build

# Install EAS CLI
npm install -g eas-cli

# Android APK
eas build --platform android --profile preview

# iOS (requires Apple Developer account)
eas build --platform ios --profile production

βœ… Assignment Compliance

βœ… React Native mobile app
βœ… Thin client (zero business logic)
βœ… JWT authentication
βœ… Signup & Login screens
βœ… Dashboard with 2 videos
βœ… Video player with controls
βœ… Settings screen
βœ… Professional UI/UX
βœ… Error handling
βœ… Clean code structure


πŸ‘€ Author

Monish S
πŸ“§ monishravi508@gmail.com
πŸ”— GitHub
πŸ’Ό LinkedIn


πŸ“„ License

Educational project demonstrating full-stack mobile development.


Built with ❀️ using React Native & Expo

About

🎬 Frontend for an API-first video streaming app β€” built with JavaScript for seamless media browsing

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors