Delete KeyStone_Photo_Cloud_Project_Plan.md
Browse files
KeyStone_Photo_Cloud_Project_Plan.md
DELETED
|
@@ -1,363 +0,0 @@
|
|
| 1 |
-
# Personal Photo Cloud – Project Plan
|
| 2 |
-
|
| 3 |
-
## Vision
|
| 4 |
-
|
| 5 |
-
Build a private Google Photos alternative that automatically backs up photos directly from mobile devices to cloud storage under the user's control.
|
| 6 |
-
|
| 7 |
-
### Goals
|
| 8 |
-
|
| 9 |
-
- Automatic background backup
|
| 10 |
-
- Android, iOS, and Web support
|
| 11 |
-
- No dependency on Google Photos APIs
|
| 12 |
-
- Fast uploads with resumable sync
|
| 13 |
-
- Deduplication
|
| 14 |
-
- AI-ready architecture
|
| 15 |
-
- Self-hostable on Hugging Face Spaces
|
| 16 |
-
|
| 17 |
-
---
|
| 18 |
-
|
| 19 |
-
# Technology Stack
|
| 20 |
-
|
| 21 |
-
## Frontend
|
| 22 |
-
|
| 23 |
-
- Expo
|
| 24 |
-
- React Native
|
| 25 |
-
- React Native Web
|
| 26 |
-
- Expo Router
|
| 27 |
-
- Expo Media Library
|
| 28 |
-
- React Query
|
| 29 |
-
- Zustand
|
| 30 |
-
- Supabase JS SDK
|
| 31 |
-
|
| 32 |
-
## Backend
|
| 33 |
-
|
| 34 |
-
- FastAPI
|
| 35 |
-
- SQLAlchemy
|
| 36 |
-
- Alembic
|
| 37 |
-
- Pillow
|
| 38 |
-
- Uvicorn
|
| 39 |
-
- BackgroundTasks
|
| 40 |
-
|
| 41 |
-
## Authentication
|
| 42 |
-
|
| 43 |
-
- Supabase Auth
|
| 44 |
-
- Email/Password
|
| 45 |
-
- Google OAuth
|
| 46 |
-
- JWT Verification
|
| 47 |
-
|
| 48 |
-
## Database
|
| 49 |
-
|
| 50 |
-
Supabase PostgreSQL
|
| 51 |
-
|
| 52 |
-
## Storage
|
| 53 |
-
|
| 54 |
-
Hugging Face Bucket
|
| 55 |
-
|
| 56 |
-
```
|
| 57 |
-
originals/
|
| 58 |
-
thumbnails/
|
| 59 |
-
previews/
|
| 60 |
-
```
|
| 61 |
-
|
| 62 |
-
---
|
| 63 |
-
|
| 64 |
-
# High-Level Architecture
|
| 65 |
-
|
| 66 |
-
```text
|
| 67 |
-
React Native/Web
|
| 68 |
-
│
|
| 69 |
-
Supabase Auth
|
| 70 |
-
│
|
| 71 |
-
JWT Access Token
|
| 72 |
-
│
|
| 73 |
-
FastAPI Backend
|
| 74 |
-
│
|
| 75 |
-
├── Upload API
|
| 76 |
-
├── Sync Engine
|
| 77 |
-
├── Gallery API
|
| 78 |
-
├── AI Services
|
| 79 |
-
│
|
| 80 |
-
├── Supabase PostgreSQL
|
| 81 |
-
└── Hugging Face Bucket
|
| 82 |
-
```
|
| 83 |
-
|
| 84 |
-
---
|
| 85 |
-
|
| 86 |
-
# Milestone 1 — Foundation
|
| 87 |
-
|
| 88 |
-
- Repository setup
|
| 89 |
-
- Docker
|
| 90 |
-
- Environment variables
|
| 91 |
-
- CI
|
| 92 |
-
- FastAPI scaffold
|
| 93 |
-
- Expo scaffold
|
| 94 |
-
|
| 95 |
-
Deliverable:
|
| 96 |
-
- Login screen
|
| 97 |
-
- Health endpoint
|
| 98 |
-
- Docker deployment
|
| 99 |
-
|
| 100 |
-
---
|
| 101 |
-
|
| 102 |
-
# Milestone 2 — Authentication
|
| 103 |
-
|
| 104 |
-
Frontend:
|
| 105 |
-
- Login
|
| 106 |
-
- Register
|
| 107 |
-
- Forgot password
|
| 108 |
-
- Session persistence
|
| 109 |
-
|
| 110 |
-
Backend:
|
| 111 |
-
- Verify Supabase JWT
|
| 112 |
-
- User middleware
|
| 113 |
-
- Protected routes
|
| 114 |
-
|
| 115 |
-
Deliverable:
|
| 116 |
-
- Secure authenticated API
|
| 117 |
-
|
| 118 |
-
---
|
| 119 |
-
|
| 120 |
-
# Milestone 3 — Database
|
| 121 |
-
|
| 122 |
-
Tables:
|
| 123 |
-
|
| 124 |
-
## users
|
| 125 |
-
|
| 126 |
-
- id
|
| 127 |
-
- supabase_id
|
| 128 |
-
- email
|
| 129 |
-
- created_at
|
| 130 |
-
|
| 131 |
-
## devices
|
| 132 |
-
|
| 133 |
-
- id
|
| 134 |
-
- user_id
|
| 135 |
-
- device_name
|
| 136 |
-
- platform
|
| 137 |
-
- last_sync
|
| 138 |
-
|
| 139 |
-
## photos
|
| 140 |
-
|
| 141 |
-
- id
|
| 142 |
-
- user_id
|
| 143 |
-
- sha256
|
| 144 |
-
- filename
|
| 145 |
-
- bucket_path
|
| 146 |
-
- thumbnail_path
|
| 147 |
-
- width
|
| 148 |
-
- height
|
| 149 |
-
- size
|
| 150 |
-
- created_at
|
| 151 |
-
- uploaded_at
|
| 152 |
-
- deleted
|
| 153 |
-
|
| 154 |
-
## upload_jobs
|
| 155 |
-
|
| 156 |
-
- id
|
| 157 |
-
- status
|
| 158 |
-
- retries
|
| 159 |
-
|
| 160 |
-
Deliverable:
|
| 161 |
-
- Database migrations
|
| 162 |
-
- CRUD models
|
| 163 |
-
|
| 164 |
-
---
|
| 165 |
-
|
| 166 |
-
# Milestone 4 — Upload Pipeline
|
| 167 |
-
|
| 168 |
-
Workflow
|
| 169 |
-
|
| 170 |
-
Camera Roll
|
| 171 |
-
|
| 172 |
-
↓
|
| 173 |
-
|
| 174 |
-
Find new photos
|
| 175 |
-
|
| 176 |
-
↓
|
| 177 |
-
|
| 178 |
-
Compute SHA256
|
| 179 |
-
|
| 180 |
-
↓
|
| 181 |
-
|
| 182 |
-
Check duplicate
|
| 183 |
-
|
| 184 |
-
↓
|
| 185 |
-
|
| 186 |
-
Upload
|
| 187 |
-
|
| 188 |
-
↓
|
| 189 |
-
|
| 190 |
-
Generate thumbnail
|
| 191 |
-
|
| 192 |
-
↓
|
| 193 |
-
|
| 194 |
-
Save metadata
|
| 195 |
-
|
| 196 |
-
↓
|
| 197 |
-
|
| 198 |
-
Complete
|
| 199 |
-
|
| 200 |
-
Requirements
|
| 201 |
-
|
| 202 |
-
- Multipart uploads
|
| 203 |
-
- Progress reporting
|
| 204 |
-
- Retry queue
|
| 205 |
-
- Idempotency
|
| 206 |
-
|
| 207 |
-
Deliverable:
|
| 208 |
-
- Reliable uploads
|
| 209 |
-
|
| 210 |
-
---
|
| 211 |
-
|
| 212 |
-
# Milestone 5 — Mobile Sync
|
| 213 |
-
|
| 214 |
-
Features
|
| 215 |
-
|
| 216 |
-
- Camera Roll permission
|
| 217 |
-
- Background scanning
|
| 218 |
-
- Queue management
|
| 219 |
-
- Pause/resume
|
| 220 |
-
- Retry failed uploads
|
| 221 |
-
|
| 222 |
-
Rules
|
| 223 |
-
|
| 224 |
-
- Never upload duplicate hashes
|
| 225 |
-
- Resume interrupted uploads
|
| 226 |
-
- Battery-aware syncing
|
| 227 |
-
- Wi-Fi only option
|
| 228 |
-
|
| 229 |
-
Deliverable:
|
| 230 |
-
- Automatic backup
|
| 231 |
-
|
| 232 |
-
---
|
| 233 |
-
|
| 234 |
-
# Milestone 6 — Gallery
|
| 235 |
-
|
| 236 |
-
Features
|
| 237 |
-
|
| 238 |
-
- Infinite scrolling
|
| 239 |
-
- Lazy loading
|
| 240 |
-
- Cached thumbnails
|
| 241 |
-
- Favorites
|
| 242 |
-
- Albums
|
| 243 |
-
- Search
|
| 244 |
-
- Timeline
|
| 245 |
-
|
| 246 |
-
Deliverable:
|
| 247 |
-
- Responsive gallery
|
| 248 |
-
|
| 249 |
-
---
|
| 250 |
-
|
| 251 |
-
# Milestone 7 — Settings
|
| 252 |
-
|
| 253 |
-
- Auto sync toggle
|
| 254 |
-
- Cellular upload toggle
|
| 255 |
-
- Thumbnail quality
|
| 256 |
-
- Storage usage
|
| 257 |
-
- Logout
|
| 258 |
-
- Device management
|
| 259 |
-
|
| 260 |
-
---
|
| 261 |
-
|
| 262 |
-
# Milestone 8 — AI
|
| 263 |
-
|
| 264 |
-
- CLIP embeddings
|
| 265 |
-
- OCR
|
| 266 |
-
- Face clustering
|
| 267 |
-
- Duplicate detection
|
| 268 |
-
- Blur detection
|
| 269 |
-
- Natural language search
|
| 270 |
-
- Auto albums
|
| 271 |
-
|
| 272 |
-
---
|
| 273 |
-
|
| 274 |
-
# API Design
|
| 275 |
-
|
| 276 |
-
Authentication
|
| 277 |
-
|
| 278 |
-
- POST /auth/verify
|
| 279 |
-
|
| 280 |
-
Sync
|
| 281 |
-
|
| 282 |
-
- POST /sync/check
|
| 283 |
-
- POST /sync/start
|
| 284 |
-
|
| 285 |
-
Uploads
|
| 286 |
-
|
| 287 |
-
- POST /upload
|
| 288 |
-
- POST /upload/batch
|
| 289 |
-
|
| 290 |
-
Gallery
|
| 291 |
-
|
| 292 |
-
- GET /photos
|
| 293 |
-
- GET /photos/{id}
|
| 294 |
-
- DELETE /photos/{id}
|
| 295 |
-
|
| 296 |
-
Albums
|
| 297 |
-
|
| 298 |
-
- GET /albums
|
| 299 |
-
- POST /albums
|
| 300 |
-
|
| 301 |
-
Health
|
| 302 |
-
|
| 303 |
-
- GET /health
|
| 304 |
-
|
| 305 |
-
---
|
| 306 |
-
|
| 307 |
-
# Security
|
| 308 |
-
|
| 309 |
-
- JWT validation
|
| 310 |
-
- HTTPS only
|
| 311 |
-
- Rate limiting
|
| 312 |
-
- SHA256 integrity
|
| 313 |
-
- File type validation
|
| 314 |
-
- Size limits
|
| 315 |
-
- Signed URLs (future)
|
| 316 |
-
|
| 317 |
-
---
|
| 318 |
-
|
| 319 |
-
# Future Enhancements
|
| 320 |
-
|
| 321 |
-
- Video transcoding
|
| 322 |
-
- Live Photos
|
| 323 |
-
- HEIC support
|
| 324 |
-
- Shared albums
|
| 325 |
-
- End-to-end encryption
|
| 326 |
-
- Desktop sync client
|
| 327 |
-
- NAS support
|
| 328 |
-
- S3-compatible storage
|
| 329 |
-
- Object versioning
|
| 330 |
-
|
| 331 |
-
---
|
| 332 |
-
|
| 333 |
-
# Deployment
|
| 334 |
-
|
| 335 |
-
Frontend
|
| 336 |
-
|
| 337 |
-
- Hugging Face Space (Static)
|
| 338 |
-
|
| 339 |
-
Backend
|
| 340 |
-
|
| 341 |
-
- Hugging Face Space (Docker)
|
| 342 |
-
|
| 343 |
-
Services
|
| 344 |
-
|
| 345 |
-
- Supabase Auth
|
| 346 |
-
- Supabase PostgreSQL
|
| 347 |
-
- Hugging Face Bucket
|
| 348 |
-
|
| 349 |
-
---
|
| 350 |
-
|
| 351 |
-
# Definition of Done
|
| 352 |
-
|
| 353 |
-
- User can register and log in.
|
| 354 |
-
- Photos sync automatically from the mobile camera roll.
|
| 355 |
-
- Duplicate photos are skipped.
|
| 356 |
-
- Uploads resume after interruptions.
|
| 357 |
-
- Thumbnails are generated.
|
| 358 |
-
- Gallery loads quickly with pagination.
|
| 359 |
-
- Metadata is stored in PostgreSQL.
|
| 360 |
-
- Originals are stored in the Hugging Face bucket.
|
| 361 |
-
- Backend validates Supabase JWTs.
|
| 362 |
-
- Docker deployment runs successfully on Hugging Face Spaces.
|
| 363 |
-
- Architecture supports future AI-powered organization and search.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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