A comprehensive full-stack music streaming application featuring a production NestJS backend, a Next.js client application with advanced rendering strategies, and a Vite-based admin dashboard. This project demonstrates modern web development practices including OAuth authentication, SEO optimization, and multiple rendering strategies (CSR, SSG, SSR).
Interactive track detail page with advanced audio player features:
- Waveform Visualization: Real-time waveform display with playback progress
- Playback Controls: Play, pause, seek, volume control
- Track Information: Title, artist, album art display
- Progress Tracking: Current time and total duration
- Like System: One-click track liking with heart icon
- Play Count: Track play statistics
- Main Player: Large waveform visualization with orange progress indicator
- Album Art: High-quality cover image display
- Controls: Shuffle, previous, play/pause, next, volume slider
- Persistent Player Bar: Bottom player bar for continuous playback
- Comments Section: User comments and interactions
- Wavesurfer.js: Advanced waveform rendering and audio visualization
- React H5 Audio Player: Customizable audio player component
- Real-time Updates: Live progress tracking and state management
- Responsive Design: Optimized for all screen sizes
Comprehensive SEO implementation following industry best practices:
- Sitemap Generation: Dynamic XML sitemap (
/sitemap.xml) - Robots.txt: Configurable crawler directives
- Meta Tags: Dynamic Open Graph, Twitter Cards
- Structured Data: JSON-LD for rich snippets
- Canonical URLs: Proper URL canonicalization
- Image Optimization: Next.js Image component with responsive images
- Code Splitting: Automatic route-based code splitting
- Lazy Loading: Component and image lazy loading
- Bundle Optimization: Tree shaking, minification
- First Load JS: Optimized to 305 kB shared bundle
- Dynamic Meta Tags: Per-page title, description, keywords
- Semantic HTML: Proper heading hierarchy, ARIA labels
- URL Structure: SEO-friendly slugs and paths
- Content Optimization: Proper heading tags, alt text
SEO Checklist Implementation:
- β Sitemap.xml generation
- β Robots.txt configuration
- β Meta tags optimization
- β Open Graph tags
- β Twitter Card tags
- β Structured data (JSON-LD)
- β Image optimization
- β Mobile responsiveness
- β Page speed optimization
- β Accessibility (WCAG compliance)
The project implements comprehensive authentication with multiple providers, demonstrating industry-standard OAuth flows:
- Provider: GitHub OAuth 2.0
- Scopes:
read:user,user:email - Implementation: NextAuth.js with custom backend integration
- Features:
- Secure token exchange
- User profile synchronization
- Automatic account creation
- Session management with JWT
- Provider: Google OAuth 2.0
- Scopes: Email, Profile
- Implementation: NextAuth.js Google Provider
- Features:
- Account chooser integration
- Multi-account support
- Seamless sign-in experience
- Profile data synchronization
Authentication Flow:
- User initiates OAuth flow via NextAuth.js
- Redirect to provider (GitHub/Google) authorization page
- User grants permissions
- Provider redirects back with authorization code
- Backend exchanges code for access tokens
- User profile created/updated in database
- JWT tokens issued for session management
The Next.js client application demonstrates mastery of all three primary rendering strategies:
- Use Cases: Interactive components, user-specific content, real-time updates
- Implementation: React hooks, client-side data fetching
- Benefits: Dynamic content, reduced server load, better interactivity
- Use Cases: Track pages, profile pages, public content
- Implementation:
getStaticProps,getStaticPaths - Benefits:
- Lightning-fast page loads
- Excellent SEO performance
- CDN-friendly content delivery
- Reduced server costs
- Use Cases: Search results, personalized content, dynamic routes
- Implementation:
getServerSideProps, Server Components (Next.js 14) - Benefits:
- Always fresh content
- SEO-friendly dynamic pages
- Personalized user experience
- Server-side data fetching
Route Analysis:
/playlist- 190 kB (Dynamic rendering)/profile/[slug]- 270 kB (SSG with dynamic paths)/track/[slug]- 191 kB (SSG with ISR)/search- 128 kB (SSR for real-time results)/test/[slug]- 4.9 kB (SSG examples)
soundcloud-app/
βββ soundcloud-be/ # NestJS Backend (Production)
β βββ src/
β β βββ auth/ # Authentication module
β β β βββ auth.controller.ts
β β β βββ auth.service.ts
β β β βββ jwt-auth.guard.ts
β β β βββ local-auth.guard.ts
β β β βββ passport/ # Passport strategies
β β βββ users/ # User management
β β βββ tracks/ # Track/audio management
β β βββ playlists/ # Playlist functionality
β β βββ comments/ # Comment system
β β βββ likes/ # Like/favorite system
β β βββ files/ # File upload handling
β β βββ mail/ # Email service
β β βββ databases/ # Database utilities
β β βββ health/ # Health checks
β β βββ core/ # Core utilities
β β βββ delay.middleware.ts
β β βββ http-exception.filter.ts
β β βββ transform.interceptor.ts
β βββ public/ # Static assets
β β βββ images/ # Uploaded images
β β βββ tracks/ # Audio files
β βββ postman/ # API documentation
β βββ package.json
β
βββ soundcloud-fe/
β βββ soundcloud-nextjs-client/ # Next.js 14 Client App
β β βββ src/
β β β βββ app/ # App Router (Next.js 14)
β β β β βββ (guest)/ # Guest routes
β β β β β βββ auth/
β β β β βββ (user)/ # Protected user routes
β β β β β βββ page.tsx # Home page
β β β β β βββ playlist/ # Playlist management
β β β β β βββ like/ # Favorites page
β β β β β βββ profile/ # User profiles
β β β β β βββ track/upload/ # Track upload
β β β β βββ api/ # API routes
β β β β β βββ auth/ # NextAuth.js
β β β β β βββ revalidate/ # ISR revalidation
β β β β βββ search/ # Search functionality
β β β β βββ track/[slug]/ # Dynamic track pages
β β β β βββ layout.tsx # Root layout
β β β β βββ sitemap.ts # Sitemap generation
β β β β βββ robots.ts # Robots.txt
β β β βββ components/ # React components
β β β β βββ auth/ # Auth components
β β β β βββ header/ # Navigation header
β β β β βββ footer/ # Footer component
β β β β βββ track/ # Track components
β β β β βββ theme-registry/ # MUI theme
β β β βββ lib/ # Utilities & wrappers
β β β βββ utils/ # Helper functions
β β β βββ types/ # TypeScript types
β β βββ public/ # Static files
β β βββ middleware.ts # Auth middleware
β β βββ package.json
β β
β βββ soundcloud-vite-admin/ # Vite Admin Dashboard
β βββ src/
β β βββ screens/ # Page components
β β β βββ users.page.tsx
β β β βββ tracks.page.tsx
β β β βββ comments.page.tsx
β β βββ components/ # Reusable components
β β β βββ users/
β β β βββ tracks/
β β β βββ comments/
β β βββ main.tsx # App entry point
β βββ package.json
β
βββ soundcloud-showcase/ # Project showcase images
βββ auth_github_page.png
βββ auth_google_page.png
βββ CSR_SSG_SSR.png
βββ SEO.png
βββ home_page.png
βββ search_page.png
βββ playlist_page.png
βββ favourite_page.png
βββ upload_page_1.png
βββ upload_page_2.png
βββ admin_vite_page.png
Core:
- NestJS 10.0.3, TypeScript, Express, RxJS 7.8.1
Database:
- MongoDB, Mongoose 7.4.2, @nestjs/mongoose 10.0.0
Authentication & Security:
- @nestjs/passport 10.0.0, passport-jwt 4.0.1, passport-local 1.0.0
- @nestjs/jwt 10.1.0, bcryptjs 2.4.3
- helmet ^7.0.0, @nestjs/throttler 4.1.0
Validation & Documentation:
- class-validator 0.14.0, class-transformer 0.5.1
- @nestjs/swagger 7.0.4
File & Email:
- Multer (file upload), @nestjs-modules/mailer 1.9.1
- nodemailer 6.9.3, handlebars 4.7.7
Performance & Utilities:
- @nestjs/cache-manager 2.1.0, cache-manager 5.2.3
- axios 1.4.0, api-query-params 5.4.0
- @nestjs/schedule 3.0.1, @nestjs/terminus 10.0.1
- Next.js 14.0.2: React framework with App Router
- React 18.2.0: UI library
- TypeScript 5.2.2: Type safety
- next-auth 4.24.5: Authentication library
- GitHub OAuth provider
- Google OAuth provider
- Credentials provider
- JWT session management
- Token refresh mechanism
- @mui/material 5.14.7: Material-UI component library
- @mui/icons-material 5.14.7: Material icons
- @emotion/react 11.11.1: CSS-in-JS
- @emotion/styled 11.11.0: Styled components
- @emotion/cache 11.11.0: Emotion cache
- react-h5-audio-player 3.8.6: Audio player component
- wavesurfer.js 7.3.1: Waveform visualization
- react-dropzone 14.2.3: File upload with drag & drop
- axios 1.5.0: HTTP client
- query-string 8.1.0: URL query parsing
- react-slick 0.29.0: Carousel component
- slick-carousel 1.8.1: Carousel styles
- next-nprogress-bar 2.1.2: Progress bar
- dayjs 1.11.10: Date manipulation
- slugify 1.6.6: URL slug generation
- sass 1.67.0: CSS preprocessor
- sharp ^0.34.5: Image optimization
- Vite 4.4.5: Build tool and dev server
- React 18.2.0: UI library
- TypeScript 5.0.2: Type safety
- @vitejs/plugin-react-swc 3.3.2: SWC plugin for fast refresh
- Ant Design 5.8.4: Enterprise UI component library
- @ant-design/icons ^5.6.1: Ant Design icons
- react-router-dom 6.15.0: Client-side routing
- sass 1.66.1: CSS preprocessor
- Upload Tracks: Multi-step upload process with metadata
- Audio Playback: Custom audio player with waveform visualization
- Track Details: Comprehensive track information pages
- Track Search: Full-text search with filters
- Track Categories: Organization by genre, mood, etc.
- Create Playlists: User-created playlists
- Add/Remove Tracks: Dynamic playlist management
- Playlist Sharing: Share playlists with other users
- Playlist Organization: Multiple playlists per user
- Like Tracks: One-click track liking
- Favorites Collection: View all liked tracks
- Like Counts: Track popularity metrics
- Track Comments: Comment on tracks
- Nested Comments: Reply to comments
- Comment Management: Edit and delete own comments
- Full-Text Search: Search tracks, artists, playlists
- Search Filters: Filter by genre, date, popularity
- Search Suggestions: Auto-complete functionality
- Recent Searches: Search history
- User Profiles: Public user profiles
- Profile Customization: Avatar, bio, social links
- Track History: View user's uploaded tracks
- Statistics: Track counts, likes, followers
- Multiple Auth Methods:
- Email/Password (Credentials)
- GitHub OAuth
- Google OAuth
- Session Management: JWT-based sessions
- Token Refresh: Automatic token renewal
- Protected Routes: Middleware-based route protection
- Multi-Step Upload: Guided upload process
- File Validation: Audio format validation
- Metadata Input: Title, description, tags, genre
- Image Upload: Cover art upload
- Progress Tracking: Upload progress indicator
- Draft Saving: Save uploads as drafts
- User Management: CRUD operations for users
- Track Management: Approve, edit, delete tracks
- Comment Moderation: Manage comments
- Analytics: Basic statistics and metrics
- Content Moderation: Review and moderate content
- Featured Tracks: Curated content
- Trending Tracks: Popular tracks
- Category Carousels: Genre-based sections
- Recently Played: User listening history
- Recommendations: Personalized suggestions
Production-ready NestJS backend with modular architecture:
soundcloud-be/
βββ src/
β βββ auth/ # Authentication (JWT, Local, OAuth)
β βββ users/ # User management
β βββ tracks/ # Track management
β βββ playlists/ # Playlist system
β βββ comments/ # Comment system
β βββ likes/ # Like/favorite system
β βββ files/ # File upload (Multer)
β βββ mail/ # Email service (Nodemailer)
β βββ databases/ # Database utilities
β βββ health/ # Health checks
β βββ core/ # Core utilities (Filters, Interceptors, Middleware)
βββ public/ # Static assets (images, tracks)
βββ postman/ # API documentation
Technologies:
- NestJS 10.0.3 (Modular architecture)
- MongoDB + Mongoose 7.4.2
- Passport.js (JWT, Local strategies)
- Swagger/OpenAPI documentation
- Helmet (Security), Throttler (Rate limiting)
- Class-validator, Class-transformer
- Cache Manager, Email Service
App Router Structure (Next.js 14):
app/
βββ (guest)/auth/signin/ # Guest routes
βββ (user)/ # Protected routes
β βββ page.tsx # Home
β βββ playlist/ # Playlist management
β βββ like/ # Favorites
β βββ profile/[slug]/ # User profiles
β βββ track/upload/ # Track upload
βββ api/auth/[...nextauth]/ # NextAuth.js
βββ search/ # Search (SSR)
βββ track/[slug]/ # Dynamic tracks (SSG)
βββ sitemap.ts # SEO
βββ robots.ts # SEO
Rendering Strategies:
- SSG:
/track/[slug],/profile/[slug] - SSR:
/search, user-specific pages - CSR: Interactive components
Structure:
src/
βββ screens/ # Pages (users, tracks, comments)
βββ components/ # Reusable components
βββ main.tsx # App entry (React Router v6)
- Node.js: v18.x or higher
- MongoDB: v6.x or higher
- npm or yarn: Package manager
- Git: Version control
git clone https://github.com/nvminh162/soundcloud-app.git
cd soundcloud-appcd soundcloud-be
npm installEnvironment Variables (.env):
# Database
MONGODB_URI=mongodb://localhost:27017/soundcloud
# JWT
JWT_SECRET=your-secret-key
JWT_EXPIRE=7d
REFRESH_TOKEN_SECRET=your-refresh-secret
REFRESH_TOKEN_EXPIRE=30d
# Server
PORT=8000
NODE_ENV=development
# Email (Optional)
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USER=your-email@gmail.com
MAIL_PASS=your-app-password
# OAuth (for social login)
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secretRun Backend:
# Development
npm run start:dev
# Production
npm run build
npm run start:prodcd soundcloud-fe/soundcloud-nextjs-client
npm installEnvironment Variables (.env.local):
# Backend API
NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
# NextAuth
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-nextauth-secret
# Token Configuration
TOKEN_EXPIRE_NUMBER=7
TOKEN_EXPIRE_UNIT=days
# OAuth Providers
GITHUB_ID=your-github-client-id
GITHUB_SECRET=your-github-client-secret
GOOGLE_ID=your-google-client-id
GOOGLE_SECRET=your-google-client-secretRun Next.js Client:
# Development
npm run dev
# Production Build
npm run build
npm startcd soundcloud-fe/soundcloud-vite-admin
npm installEnvironment Variables (.env):
VITE_BACKEND_URL=http://localhost:8000Run Admin Dashboard:
# Development
npm run dev
# Production Build
npm run build
npm run preview- Start MongoDB: Ensure MongoDB is running
- Start Backend:
cd soundcloud-be && npm run start:dev - Start Next.js Client:
cd soundcloud-fe/soundcloud-nextjs-client && npm run dev - Start Admin Dashboard (optional):
cd soundcloud-fe/soundcloud-vite-admin && npm run dev
- Next.js Client: http://localhost:3000
- Backend API: http://localhost:8000
- Admin Dashboard: http://localhost:5173 (Vite default)
- API Documentation: http://localhost:8000/api (Swagger)
- RESTful API design, Modular architecture
- Authentication (JWT, OAuth 2.0, Passport.js)
- MongoDB schema design, Mongoose ODM
- File upload (Multer), Email service
- Security (Helmet, Throttler, Validation)
- API documentation (Swagger), Health checks
- Next.js 14 App Router, Server/Client Components
- Rendering strategies (CSR, SSG, SSR, ISR)
- Dynamic routes, API routes, Middleware
- SEO (Meta tags, Sitemap, Robots.txt)
- NextAuth.js (OAuth, JWT sessions)
- TypeScript, Image optimization
- Vite build tooling, React Router v6
- Ant Design UI, Component architecture
- MongoDB connection:
MONGODB_URIin.env - JWT:
JWT_SECRET,JWT_EXPIRE,REFRESH_TOKEN_SECRET - Rate limiting: Configure in
app.module.ts - OAuth: GitHub, Google client IDs/secrets
- Next.js:
next.config.js(image domains, optimizations) - API:
NEXT_PUBLIC_BACKEND_URLin.env.local - NextAuth:
NEXTAUTH_URL,NEXTAUTH_SECRET - Theme:
src/components/theme-registry/theme.ts
Next.js Bundle Sizes:
- First Load JS: 305 kB (shared)
- Middleware: 63 kB
/profile/[slug]: 270 kB/track/[slug]: 191 kB/playlist: 190 kB
Optimizations: Code splitting, Tree shaking, Image optimization, Lazy loading, Caching
Backend:
cd soundcloud-be
npm run test # Unit tests
npm run test:watch # Watch mode
npm run test:cov # Coverage
npm run test:e2e # E2E testsFrontend:
cd soundcloud-fe/soundcloud-nextjs-client
npm run lint # LintingDocker configuration available:
soundcloud-fe/soundcloud-nextjs-client/Dockerfilesoundcloud-fe/soundcloud-nextjs-client/build-docker/docker-compose.yml
cd soundcloud-fe/soundcloud-nextjs-client/build-docker
docker-compose upSwagger: http://localhost:8000/api
Postman Collection: soundcloud-be/postman/soundcloud-app-backend-api.postman_collection.json
Main Endpoints:
- Auth:
/api/v1/auth/register,/login,/refresh,/social-media - Tracks:
/api/v1/tracks(GET, POST, PUT, DELETE) - Users:
/api/v1/users(GET, PUT, DELETE) - Playlists:
/api/v1/playlists(GET, POST, PUT, DELETE) - Comments:
/api/v1/comments(GET, POST, PUT, DELETE) - Likes:
/api/v1/likes(GET, POST, DELETE)
This project was developed as part of a comprehensive learning journey. The following resources were instrumental:
- Udemy Course: React Next.js MUI TypeScript Course
- Comprehensive full-stack development course
- Covers React, Next.js, Material-UI, TypeScript
- Backend development with NestJS
- Authentication and authorization
- SEO optimization
- Performance optimization
- Full-Stack Development: End-to-end application development
- Modern React: Hooks, Context, Server Components
- Next.js 14: App Router, Server Actions, ISR
- NestJS: Modular architecture, dependency injection
- TypeScript: Advanced types, generics, utility types
- Authentication: OAuth 2.0, JWT, session management
- Database Design: MongoDB, Mongoose, schema design
- API Design: RESTful APIs, error handling, validation
- SEO: Meta tags, sitemaps, structured data
- Performance: Code splitting, lazy loading, optimization
This is a learning project, but contributions and suggestions are welcome! If you'd like to contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed for educational purposes. All rights reserved by the author.
LICENSED By @nvminh162
- GitHub: @nvminh162
- Facebook: facebook.com/nvminh162
- Telegram: @nvminh162
- Website: nvminh162.com
This project was developed as a comprehensive learning exercise to master modern full-stack web development. It demonstrates proficiency in:
- Backend Development: NestJS, MongoDB, RESTful APIs
- Frontend Development: Next.js 14, React 18, TypeScript
- Authentication: OAuth 2.0, JWT, NextAuth.js
- SEO Optimization: Meta tags, sitemaps, structured data
- Performance Optimization: Code splitting, lazy loading, caching
- Modern Tooling: Vite, TypeScript, ESLint
Special thanks to:
- Udemy Instructor: For the comprehensive course content
- Open Source Community: For the amazing tools and libraries
- NestJS Team: For the excellent framework
- Next.js Team: For the powerful React framework
- Material-UI Team: For the beautiful component library
- Ant Design Team: For the enterprise UI components
The project includes comprehensive screenshots demonstrating all major features:
- Authentication: GitHub and Google OAuth flows
- Rendering Strategies: CSR, SSG, SSR demonstration
- SEO Features: Optimization and best practices
- Home Page: Main landing page with featured content
- Search: Full-text search functionality
- Playlists: Playlist management interface
- Favorites: Liked tracks collection
- Upload: Multi-step track upload process
- Admin Dashboard: Content management interface
All showcase images are available in the soundcloud-showcase/ directory.
Potential improvements and features for future development:
- Real-time Features: WebSocket integration for live updates
- Advanced Search: Elasticsearch integration
- Recommendation Engine: ML-based track recommendations
- Social Features: Followers, following, activity feed
- Analytics: User behavior tracking, insights
- Mobile App: React Native mobile application
- PWA: Progressive Web App features
- Internationalization: Multi-language support
- Payment Integration: Premium subscriptions
- Advanced Admin: More comprehensive admin features
- Some routes may have performance optimization opportunities
- Image optimization can be further enhanced
- Additional error handling in edge cases
- More comprehensive test coverage needed
For questions, issues, or suggestions:
- Open an issue on GitHub
- Contact via Telegram: @nvminh162
- Reach out on Facebook: facebook.com/nvminh162
Built with β€οΈ by @nvminh162
This project is part of a comprehensive learning journey in modern full-stack web development.











