Skip to content

Commit 126c08e

Browse files
Zeff01claude
andcommitted
docs: Update documentation and organize project structure
- Update CLAUDE.md with comprehensive onboarding system documentation - Add detailed applicant workflow (applying → testing → onboarding → waitlist → accepted) - Document new database schema additions for quiz, commitment, and mobile capability - Update video URLs to use Supabase Storage (codebility/onboarding-videos/) Database & Types: - Create TypeScript types for applicant and onboarding tables (types/database/applicant.ts) - Add project category many-to-many migration - Create migrations README with naming conventions and categories - Document all onboarding-related database fields Documentation: - Add comprehensive VIDEO_UPLOAD_GUIDE.md for Supabase Storage - Include upload instructions via dashboard and CLI - Document video optimization and troubleshooting tips - Add storage policies and CORS configuration Organization: - Move project-category migration to proper location (supabase/migrations/) - Add DEPRECATION_NOTICE.md for old migration-scripts folder - Clarify that migration-scripts/ is deprecated for historical reference only - Establish proper migration workflow in apps/codebility/supabase/migrations/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 43a6980 commit 126c08e

7 files changed

Lines changed: 674 additions & 8 deletions

File tree

‎CLAUDE.md‎

Lines changed: 79 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ This is a Turborepo monorepo with pnpm workspaces containing multiple Next.js ap
6969
**Authentication Flow:**
7070
- Middleware-based route protection in `middleware.ts`
7171
- Role-based access control with `roles` table
72-
- Application status workflow: `applying` → `pending` → `passed`/`failed`
72+
- Application status workflow: `applying` → `testing` → `onboarding` → `waitlist` → `accepted`/`denied`
7373
- Email verification requirements
74+
- Comprehensive onboarding system with video watching, quizzes, and digital commitment signing
7475

7576
**State Management Pattern:**
7677
- Zustand stores in `store/` directories for global state
@@ -119,9 +120,83 @@ All shared packages must be prefixed with `@codevs/` (e.g., `@codevs/ui`, `@code
119120
### Database Schema
120121
The project uses Supabase (PostgreSQL) with the following key tables:
121122
- **Core**: `codev` (users), `roles` (permissions), `project`, `project_members`
122-
- **Job System**: `job_listings`, `job_applications`
123+
- **Applicant System**: `applicant` (test results, onboarding progress, quiz scores, commitments)
124+
- **Onboarding**: `onboarding_video_progress` (video completion tracking)
125+
- **Job System**: `job_listings`, `job_applications`
123126
- **Attendance**: `attendance`, `attendance_summary`
124127
- **Gamification**: `skill_categories`, `codev_points`
125128
- **Kanban**: `kanban_board`, `kanban_column`, `kanban_sprint`, `task`
126-
127-
For detailed schema information, relationships, and SQL examples, see `database-schema.md` in the root directory.
129+
- **Communication**: `notifications`, `news_banners`, `surveys`
130+
131+
For detailed schema information, relationships, and SQL examples, see `database-schema.md` in the root directory.
132+
133+
### Applicant Onboarding System
134+
135+
**Overview:**
136+
A comprehensive 4-step onboarding system that guides applicants from initial application through to acceptance:
137+
138+
1. **Applying** - Submit application
139+
2. **Testing** - Complete coding assessment
140+
3. **Onboarding** - Watch 4 videos, pass quiz (70%), sign commitment
141+
4. **Waitlist** - Await admin review and acceptance
142+
143+
**Key Features:**
144+
- **Video System**: 4 onboarding videos with 90% watch completion validation
145+
- **Sequential Unlocking**: Videos unlock only after completing previous ones
146+
- **Quiz System**: 6 questions focusing on understanding that Codebility is:
147+
- FREE (no payment required)
148+
- For portfolio building and upskilling
149+
- NOT for quick employment
150+
- Requires 3-6 months commitment
151+
- Requires twice-weekly mandatory meetings
152+
- **Digital Commitment**: Canvas-based signature capture
153+
- **Mobile Capability**: Tracks if applicant can do React Native development
154+
- **Progress Persistence**: State saved across page refreshes
155+
- **Email Notifications**: Automated emails at each stage transition
156+
- **Admin Dashboard**: View quiz scores, mobile capability, commitment status
157+
158+
**File Locations:**
159+
- Onboarding UI: `apps/codebility/app/applicant/onboarding/`
160+
- Waitlist UI: `apps/codebility/app/applicant/waiting/`
161+
- Admin View: `apps/codebility/app/home/applicants/`
162+
- Migrations: `apps/codebility/supabase/migrations/`
163+
- Videos: Stored in Supabase Storage at `public/onboarding-videos/`
164+
165+
**Database Fields Added:**
166+
- `applicant.quiz_score` - Score achieved on quiz
167+
- `applicant.quiz_total` - Total quiz questions
168+
- `applicant.quiz_passed` - Boolean pass/fail status
169+
- `applicant.quiz_completed_at` - Completion timestamp
170+
- `applicant.can_do_mobile` - Mobile development capability
171+
- `applicant.commitment_signed_at` - Digital signature timestamp
172+
- `applicant.signature_data` - Base64 signature image
173+
174+
**Admin Actions:**
175+
- **Accept**: Sends acceptance email with /home access instructions
176+
- **Deny**: Sends denial email with reapplication information
177+
- **View Progress**: See quiz scores, mobile capability, and commitment status
178+
179+
### File Storage
180+
181+
**Supabase Storage Buckets:**
182+
- `public/onboarding-videos/` - Onboarding video files (part1.mp4 - part4.mp4)
183+
- Upload via Supabase Dashboard → Storage → Select bucket → Upload files
184+
- Videos are referenced by path in video player component
185+
- Total size: ~5.8GB (too large for git, excluded via .gitignore)
186+
187+
### Database Migrations
188+
189+
All database migrations are located in `apps/codebility/supabase/migrations/`
190+
191+
**Migration Naming Convention:** `YYYYMMDD_description.sql`
192+
193+
**Key Migrations:**
194+
- `add_quiz_and_commitment_fields.sql` - Onboarding system fields
195+
- `create_onboarding_videos_table.sql` - Video progress tracking
196+
- `create_notification_system.sql` - Notification infrastructure
197+
- `create_attendance_tables.sql` - Attendance tracking
198+
- `20251127_project_category_many_to_many.sql` - Project categories
199+
200+
**Legacy Migrations:**
201+
The `migration-scripts/` folder in the root contains deprecated migration tools and scripts.
202+
Do not add new migrations there. See `migration-scripts/DEPRECATION_NOTICE.md` for details.

‎apps/codebility/app/applicant/onboarding/_components/OnboardingClient.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ interface OnboardingClientProps {
1717
}
1818

1919
const VIDEO_URLS = {
20-
1: "/assets/onboardingvideos/part1.mp4", // Introduction - About Codebility
21-
2: "/assets/onboardingvideos/part2.mp4", // Benefits, Culture & Expectations
22-
3: "/assets/onboardingvideos/part3.mp4", // Roadmaps, Milestones & Tech Stack
23-
4: "/assets/onboardingvideos/part4.mp4", // Portal Tour - Gamification & Workflow (to be added)
20+
1: "https://hibnlysaokybrsufrdwp.supabase.co/storage/v1/object/public/codebility/onboarding-videos/part1.mp4", // Introduction - About Codebility
21+
2: "https://hibnlysaokybrsufrdwp.supabase.co/storage/v1/object/public/codebility/onboarding-videos/part2.mp4", // Benefits, Culture & Expectations
22+
3: "https://hibnlysaokybrsufrdwp.supabase.co/storage/v1/object/public/codebility/onboarding-videos/part3.mp4", // Roadmaps, Milestones & Tech Stack
23+
4: "https://hibnlysaokybrsufrdwp.supabase.co/storage/v1/object/public/codebility/onboarding-videos/part4.mp4", // Portal Tour - Gamification & Workflow
2424
};
2525

2626
const VIDEO_TITLES = {
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
# Onboarding Video Upload Guide
2+
3+
This guide explains how to upload and manage onboarding videos in Supabase Storage.
4+
5+
## Current Video Configuration
6+
7+
The onboarding videos are stored in Supabase Storage and accessed via public URLs:
8+
9+
- **Bucket**: `codebility`
10+
- **Path**: `onboarding-videos/`
11+
- **Files**: `part1.mp4`, `part2.mp4`, `part3.mp4`, `part4.mp4`
12+
13+
### Current Video URLs
14+
15+
```
16+
https://hibnlysaokybrsufrdwp.supabase.co/storage/v1/object/public/codebility/onboarding-videos/part1.mp4
17+
https://hibnlysaokybrsufrdwp.supabase.co/storage/v1/object/public/codebility/onboarding-videos/part2.mp4
18+
https://hibnlysaokybrsufrdwp.supabase.co/storage/v1/object/public/codebility/onboarding-videos/part3.mp4
19+
https://hibnlysaokybrsufrdwp.supabase.co/storage/v1/object/public/codebility/onboarding-videos/part4.mp4
20+
```
21+
22+
## Uploading Videos via Supabase Dashboard
23+
24+
### Step 1: Access Supabase Storage
25+
26+
1. Go to your Supabase Dashboard: https://app.supabase.com
27+
2. Select your project
28+
3. Navigate to **Storage** in the left sidebar
29+
4. Select the `codebility` bucket (or create it if it doesn't exist)
30+
31+
### Step 2: Create Folder (if needed)
32+
33+
1. Click **Create folder**
34+
2. Name it `onboarding-videos`
35+
3. Click **Create**
36+
37+
### Step 3: Upload Videos
38+
39+
1. Navigate into the `onboarding-videos` folder
40+
2. Click **Upload file**
41+
3. Select your video files:
42+
- `part1.mp4` - Introduction - About Codebility
43+
- `part2.mp4` - Benefits, Culture & Expectations
44+
- `part3.mp4` - Roadmaps, Milestones & Tech Stack
45+
- `part4.mp4` - Portal Tour - Gamification & Workflow
46+
4. Click **Upload**
47+
48+
### Step 4: Make Files Public
49+
50+
1. For each uploaded file, click the **⋮** menu
51+
2. Select **Get URL**
52+
3. Toggle **Public** to ON
53+
4. Copy the public URL
54+
55+
### Step 5: Update Video URLs (if needed)
56+
57+
If you upload to a different bucket or path, update the URLs in:
58+
59+
`apps/codebility/app/applicant/onboarding/_components/OnboardingClient.tsx`
60+
61+
```typescript
62+
const VIDEO_URLS = {
63+
1: "https://YOUR_PROJECT.supabase.co/storage/v1/object/public/YOUR_BUCKET/YOUR_PATH/part1.mp4",
64+
2: "https://YOUR_PROJECT.supabase.co/storage/v1/object/public/YOUR_BUCKET/YOUR_PATH/part2.mp4",
65+
3: "https://YOUR_PROJECT.supabase.co/storage/v1/object/public/YOUR_BUCKET/YOUR_PATH/part3.mp4",
66+
4: "https://YOUR_PROJECT.supabase.co/storage/v1/object/public/YOUR_BUCKET/YOUR_PATH/part4.mp4",
67+
};
68+
```
69+
70+
## Uploading Videos via Supabase CLI
71+
72+
### Prerequisites
73+
74+
```bash
75+
# Install Supabase CLI
76+
npm install -g supabase
77+
78+
# Login to Supabase
79+
supabase login
80+
```
81+
82+
### Upload Command
83+
84+
```bash
85+
# Navigate to your project
86+
cd apps/codebility
87+
88+
# Upload a single video
89+
supabase storage upload codebility/onboarding-videos/part1.mp4 path/to/your/part1.mp4 --project-ref YOUR_PROJECT_REF
90+
91+
# Upload all videos
92+
supabase storage upload codebility/onboarding-videos path/to/your/videos/*.mp4 --project-ref YOUR_PROJECT_REF
93+
```
94+
95+
### Make Files Public via CLI
96+
97+
```bash
98+
# Create a public bucket policy
99+
supabase storage update codebility --public true --project-ref YOUR_PROJECT_REF
100+
```
101+
102+
## Video File Specifications
103+
104+
### Recommended Settings
105+
106+
- **Format**: MP4 (H.264 codec)
107+
- **Resolution**: 1080p (1920x1080) or 720p (1280x720)
108+
- **Bitrate**: 2-5 Mbps for good quality
109+
- **Audio**: AAC codec, 128-192 kbps
110+
- **Frame Rate**: 30fps
111+
112+
### Current File Sizes
113+
114+
- part1.mp4: ~716 MB
115+
- part2.mp4: ~2.4 GB
116+
- part3.mp4: ~1.4 GB
117+
- part4.mp4: ~1.3 GB
118+
- **Total**: ~5.8 GB
119+
120+
### Size Optimization Tips
121+
122+
If you need to reduce file sizes:
123+
124+
1. **Use HandBrake or FFmpeg**:
125+
```bash
126+
# Example with FFmpeg to reduce size while maintaining quality
127+
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k output.mp4
128+
```
129+
130+
2. **Recommended CRF values**:
131+
- 18-22: High quality (larger files)
132+
- 23-28: Good quality (balanced)
133+
- 28+: Lower quality (smaller files)
134+
135+
3. **Consider streaming optimization**:
136+
```bash
137+
# Add web optimization flag
138+
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k -movflags +faststart output.mp4
139+
```
140+
141+
## Bucket Configuration
142+
143+
### Storage Policies
144+
145+
Ensure your Supabase Storage bucket has the correct RLS policies:
146+
147+
```sql
148+
-- Allow public access to onboarding videos
149+
CREATE POLICY "Public Access for Onboarding Videos"
150+
ON storage.objects FOR SELECT
151+
TO public
152+
USING (bucket_id = 'codebility' AND (storage.foldername(name))[1] = 'onboarding-videos');
153+
```
154+
155+
### CORS Configuration
156+
157+
If videos don't play due to CORS issues:
158+
159+
1. Go to **Settings** → **API** in Supabase Dashboard
160+
2. Add your application domain to **CORS allowed origins**
161+
3. Include both development and production URLs:
162+
- `http://localhost:3000`
163+
- `https://www.codebility.tech`
164+
165+
## Troubleshooting
166+
167+
### Videos Not Playing
168+
169+
1. **Check public access**: Ensure files are set to public in Supabase Storage
170+
2. **Verify URLs**: Make sure URLs in code match actual storage paths
171+
3. **Browser console**: Check for CORS errors or 404s
172+
4. **File format**: Ensure videos are in MP4 format with H.264 codec
173+
174+
### Slow Loading
175+
176+
1. **Enable CDN**: Supabase uses CloudFlare CDN automatically for public storage
177+
2. **Optimize video files**: Use the compression tips above
178+
3. **Consider adaptive streaming**: For very large files, consider HLS or DASH streaming
179+
180+
### Upload Failures
181+
182+
1. **File size limits**: Check your Supabase plan's storage limits
183+
2. **Timeout issues**: For large files, use the CLI instead of dashboard
184+
3. **Network stability**: Ensure stable internet connection during upload
185+
186+
## Updating Videos
187+
188+
When you need to replace a video:
189+
190+
1. Upload the new video with the same filename
191+
2. Supabase will automatically overwrite the old version
192+
3. No code changes needed if filename stays the same
193+
4. Old URLs will automatically serve the new video
194+
195+
## Best Practices
196+
197+
1. **Name consistently**: Use descriptive, sequential names (part1, part2, etc.)
198+
2. **Optimize before upload**: Compress videos before uploading to save storage space
199+
3. **Test after upload**: Always verify videos play correctly after uploading
200+
4. **Backup originals**: Keep original high-quality versions as backups
201+
5. **Version control**: If you need to keep multiple versions, use folders like `v1/`, `v2/`
202+
203+
## Cost Considerations
204+
205+
Supabase Storage pricing (as of 2024):
206+
- **Free tier**: 1 GB storage
207+
- **Pro tier**: 100 GB storage included
208+
- **Additional**: $0.021 per GB/month
209+
210+
Current videos (~5.8 GB) will use:
211+
- Pro tier: Covered under 100 GB limit
212+
- Additional cost: ~$0.12/month if over free tier
213+
214+
## Security Notes
215+
216+
- Videos are public and can be accessed by anyone with the URL
217+
- Do not include sensitive information in videos
218+
- Consider watermarking videos if needed
219+
- Monitor storage bucket for unauthorized uploads

0 commit comments

Comments
 (0)