Full-stack music streaming app dengan auth Google OAuth & Email OTP.
npm i -g wranglerwrangler logincd worker
wrangler kv:namespace create "KV"
# Copy output id ke wrangler.toml
https://musicfy-worker.YOURNAME.workers.dev/auth/google/callback
onboarding@resend.dev untuk testingcd worker
wrangler secret put GOOGLE_CLIENT_ID
wrangler secret put GOOGLE_CLIENT_SECRET
wrangler secret put RESEND_API_KEY
# Edit wrangler.toml โ tukar WORKER_URL, FRONTEND_URL, ALLOWED_ORIGINS
wrangler deploy
frontend/app.js:
const API_URL = 'https://musicfy-worker.YOURNAME.workers.dev';
frontend/ ke GitHub โ aktifkan GitHub PagesTambah URL frontend anda di wrangler.toml:
ALLOWED_ORIGINS = "https://YOURNAME.github.io,http://localhost:8080"
Kemudian wrangler deploy semula.
Worker:
cd worker
wrangler dev
# Running di http://localhost:8787
Frontend (di terminal lain):
cd frontend
python -m http.server 8080
# Buka http://localhost:8080
Edit app.js: const API_URL = 'http://localhost:8787';
Tanpa Resend API key โ OTP akan log ke terminal Wrangler:
๐ [DEV] OTP untuk user@email.com: 123456
| Method | Path | Keterangan |
|---|---|---|
| GET | /auth/google |
Redirect ke Google |
| GET | /auth/google/callback |
Callback OAuth |
| POST | /auth/email/send-otp |
Hantar OTP |
| POST | /auth/email/verify-otp |
Sahkan OTP โ token |
| GET | /auth/me |
Current user |
| POST | /auth/logout |
Log keluar |
| GET/POST/DELETE | /api/liked |
Liked songs |
| GET/POST/DELETE | /api/playlists |
Playlists |
| Butang | Fungsi |
|---|---|
| Home / Search / Library | Navigate + history |
| Back (โน) / Forward (โบ) | History stack |
| User badge | Login modal / user menu |
| Shuffle | Toggle random order |
| Prev / Next | Track navigation |
| Play / Pause | Audio toggle |
| Repeat | off โ all โ one |
| Progress bar | Seek |
| Volume + Mute | Volume control |
| Like (player & rows) | Sync ke server (login) atau localStorage |
| Liked Songs playlist | Page untuk liked |
| Search input | Live search iTunes |
| Google button | OAuth flow |
| Hantar OTP | Send OTP email |
| Sahkan OTP | Verify + create session |
| Hantar semula / Tukar emel | OTP flow |
| Log Keluar | Clear session |
Kalau nak lagu penuh tanpa had โ integrate dengan Jamendo API atau Deezer API.
MIT