YouCra v03 Development Assistant
An expert AI assistant for developing and maintaining YouCra v03 (유크라), a React-based real-time chat and YouTube integration social platform for creator-fan communities.
What This Skill Does
This skill provides specialized assistance for the YouCra v03 project, including:
React component development with Firebase integrationGoogle OAuth 2.0 and YouTube Data API implementationReal-time chat features using FirestoreKorean/English bilingual UI developmentDebugging authentication and API integration issuesProject Context
**Project**: YouCra v03 (유크라)
**Type**: Real-time chat + YouTube integration social platform**Purpose**: Creator-fan community app combining YouTube video sharing with live chat**Domain**: ucrachat.com (Vercel deployment)**Repository**: ericsone1/youcra-v03-newTechnical Stack
**Frontend**:
React 18.2.0Tailwind CSSFramer MotionReact Icons, React Modal, React YouTube**Backend**:
Firebase (Firestore, Auth, Storage, Analytics)YouTube Data API v3Google Identity Services (OAuth 2.0)**Deployment**: Vercel
Core Features
1. **User Authentication**: Dual authentication with Firebase Auth + Google OAuth 2.0
2. **Real-time Chat**: Firestore real-time listeners, image uploads, emoji support
3. **YouTube Integration**: Video sharing/playback/likes/subscriptions, fan verification system
4. **Social Features**: Profile management, My Channel, 1:1 DM, popularity reports
Key Components
`Home.js`: YouTube feed, real-time search terms, fan verification`ChatList.js`: Chat room list, "My Chats"/"All" tabs`ChatRoom.js`: Real-time chat, YouTube video sharing, popup player`MyChannel.js`: Profile editing, my video rooms, channel links`GoogleAuth.js`: Google Identity Services implementation, OAuth handling`AuthContext.js`: Global authentication state managementService Layer
`userService.js`: User profile CRUD, points system`chatService.js`: Chat room management, real-time message subscriptions`videoService.js`: YouTube API integrationFirebase Structure
```
Firestore Collections:
├── chatRooms/
│ ├── {roomId}/
│ │ ├── messages/
│ │ ├── participants/
│ │ └── videos/
├── users/
└── reports/
```
Routing Structure
`/`: Home (YouTube feed)`/chat`: Chat room list`/chat/:roomId`: Chat room`/my`: My Channel`/report`: Popularity report`/login`: Login`/profile/:roomId/:uid`: User profile`/dm/:uid`: 1:1 DM`/videos`: Video list`/add-video`: Add videoEnvironment Variables
```
REACT_APP_GOOGLE_CLIENT_ID=234134940808-jtnudlrb28o2hheq2ppmfr4rocgn09pj.apps.googleusercontent.com
REACT_APP_YOUTUBE_API_KEY=[YouTube API Key]
```
Instructions for AI Agent
When assisting with YouCra v03 development, follow these guidelines:
1. Code Style and Conventions
Use functional React components with hooks (useState, useEffect, useContext)Follow existing Tailwind CSS utility class patternsMaintain Korean/English bilingual UI labels where presentUse Framer Motion for animations consistently with existing patternsKeep Firebase operations in service layer files (`userService.js`, `chatService.js`, `videoService.js`)2. Authentication Handling
Always check authentication state via `AuthContext` before protected operationsImplement dual authentication: Firebase Auth + Google OAuth tokenHandle "unregistered_origin" OAuth errors by verifying Google Cloud Console OAuth client settingsStore user profile data in both Firebase Auth and Firestore `users/` collection3. Real-time Features
Use Firestore `onSnapshot` for real-time listenersAlways unsubscribe from listeners in cleanup functionsHandle offline states gracefullyImplement optimistic UI updates for better UX4. YouTube Integration
Use YouTube Data API v3 for video operationsRespect API quota limitsCache video metadata in Firestore when possibleHandle API errors gracefully with user-friendly Korean/English messages5. File Organization
Place new components in `src/components/`Put service layer code in `src/services/`Keep context providers in `src/contexts/`Store utility functions in `src/utils/`6. Testing
Write tests using Jest and React Testing LibraryTest authentication flows thoroughlyMock Firebase and YouTube API calls in tests7. Deployment
Ensure environment variables are configured in VercelTest builds locally with `npm run build` before pushingVerify Firebase security rules before deploying8. Known Issues to Watch For
**Google OAuth "unregistered_origin" error**: Verify authorized JavaScript origins in Google Cloud Console**Real-time listener memory leaks**: Always cleanup subscriptions in useEffect cleanup**YouTube API quota exhaustion**: Implement caching and rate limiting9. Development Commands
```bash
npm start # Development server (localhost:3000)
npm run build # Production build
npm test # Run tests
```
10. Important Files
`src/firebase.js`: Firebase configuration and initialization`src/contexts/AuthContext.js`: Global authentication state`src/components/GoogleAuth.js`: Google OAuth implementation`package.json`: Dependencies and scriptsExamples
Adding a New Firebase Service Function
```javascript
// In src/services/userService.js
import { db } from '../firebase';
import { collection, doc, getDoc, setDoc } from 'firebase/firestore';
export const updateUserPoints = async (uid, points) => {
const userRef = doc(db, 'users', uid);
const userDoc = await getDoc(userRef);
if (userDoc.exists()) {
const currentPoints = userDoc.data().points || 0;
await setDoc(userRef, {
points: currentPoints + points
}, { merge: true });
}
};
```
Creating a Real-time Chat Component
```javascript
// In src/components/ChatMessages.js
import { useEffect, useState } from 'react';
import { collection, query, orderBy, onSnapshot } from 'firebase/firestore';
import { db } from '../firebase';
function ChatMessages({ roomId }) {
const [messages, setMessages] = useState([]);
useEffect(() => {
const messagesRef = collection(db, 'chatRooms', roomId, 'messages');
const q = query(messagesRef, orderBy('createdAt', 'desc'));
const unsubscribe = onSnapshot(q, (snapshot) => {
const newMessages = snapshot.docs.map(doc => ({
id: doc.id,
...doc.data()
}));
setMessages(newMessages);
});
return () => unsubscribe(); // Cleanup
}, [roomId]);
return (
<div className="space-y-4">
{messages.map(msg => (
<div key={msg.id} className="p-3 bg-white rounded-lg shadow">
{msg.text}
</div>
))}
</div>
);
}
```
Constraints
Maintain Korean/English bilingual support in all user-facing textKeep Firebase operations in service layer, not directly in componentsAlways handle authentication state before Firebase operationsRespect YouTube API quota limitsFollow existing code patterns and component structureTest OAuth flows thoroughly before deployment