A modern, full-featured social casino platform built with Next.js 16, featuring real-time chat, live streaming, social feeds, and comprehensive user interactions.
- Authentication System: JWT-based authentication with dual storage (localStorage + cookies)
- Real-time Chat: SignalR-powered instant messaging with chat rooms
- Live Streaming: Integrated live stream support with Mux player
- Social Feed: User posts, comments, likes, and infinite scroll
- Stories: Instagram-style stories with viewer tracking
- User Profiles: Customizable profiles with media galleries
- Follow System: User following/followers with real-time updates
- Search: Advanced user and content search functionality
- Location Services: Location-based features
- Next.js 16: Latest Next.js with App Router and Server Components
- React 19: Cutting-edge React features
- TypeScript: Full type safety throughout the application
- TanStack Query: Efficient server state management
- Real-time WebSockets: SignalR integration for live features
- Responsive Design: Mobile-first, fully responsive UI
- Production Ready: Docker containerization with security hardening
- Node.js: 20.x or higher
- npm/pnpm: Package manager
- Docker (optional): For containerized deployment
-
Clone the repository
git clone <repository-url> cd social-casino-new
-
Install dependencies
npm install # or pnpm install -
Configure environment variables
Create a
.env.localfile in the root directory:# API Configuration NEXT_PUBLIC_API_URL=https://your-api-url.com # Environment NODE_ENV=development
-
Run the development server
npm run dev
-
Open your browser
Navigate to http://localhost:3000
-
Configure environment variables
Create a
.envfile:NEXT_PUBLIC_API_URL=https://your-api-url.com NODE_ENV=production PORT=4000
-
Build and run the container
docker-compose up -d
-
Access the application
Visit http://localhost:4000
# Build the image
docker build -t social-casino-new .
# Run the container
docker run -p 4000:4000 \
-e NEXT_PUBLIC_API_URL=https://your-api-url.com \
-e NODE_ENV=production \
social-casino-new| Script | Description |
|---|---|
npm run dev |
Start development server with Turbopack |
npm run build |
Build production-ready application |
npm start |
Start production server on port 4000 |
npm run lint |
Run ESLint with strict error checking |
social-casino-new/
βββ public/ # Static assets
β βββ icons/ # App icons
β βββ media/ # Media files
βββ src/
β βββ app/ # Next.js App Router pages
β β βββ auth/ # Authentication pages
β β βββ chat/ # Real-time chat feature
β β βββ profile/ # User profiles
β β βββ search/ # Search functionality
β β βββ streams/ # Live streaming
β β βββ userFeed/ # Social feed
β β βββ layouts/ # Layout components
β βββ components/ # Reusable components
β β βββ livestream/ # Streaming components
β β βββ post/ # Post-related components
β β βββ profile/ # Profile components
β β βββ story/ # Stories feature
β β βββ ui/ # UI primitives (shadcn/ui)
β βββ contexts/ # React contexts
β β βββ AuthContext.tsx
β β βββ UploadProgressContext.tsx
β βββ hooks/ # Custom React hooks
β βββ lib/
β β βββ api/ # API integration
β β βββ types/ # TypeScript definitions
β β βββ utils/ # Utility functions
β βββ middleware.ts # Next.js middleware
βββ docker-compose.yml # Docker Compose configuration
βββ Dockerfile # Docker build instructions
βββ next.config.ts # Next.js configuration
The application uses a secure JWT-based authentication system with:
- Dual Storage: Tokens stored in both localStorage and cookies
- Auto Refresh: Automatic token refresh on expiration
- Route Protection: Middleware-based route guarding
- Server-Side Auth: Cookie-based server component authentication
For detailed authentication documentation, see AUTH_README.md.
The application connects to a backend API using Axios with:
- Automatic token injection
- Request/response interceptors
- Token refresh handling
- Error handling and retry logic
Base URL configuration: NEXT_PUBLIC_API_URL
Built with modern UI libraries:
- shadcn/ui: Beautiful, accessible component library
- Radix UI: Unstyled, accessible primitives
- Tailwind CSS: Utility-first styling
- Lucide Icons: Icon system
- Sonner: Toast notifications
- Live chat messaging
- Typing indicators
- Online presence
- Message read receipts
- Mux player integration
- Stream creation and management
- Viewer interaction
The application uses Next.js middleware for:
- Authentication verification
- Protected route access control
- Automatic redirects for unauthorized users
- Public route handling
Protected routes:
/profile/*/chat/*/streams/*/userFeed/*
Public routes:
/auth/login/auth/signup/(home/feed)
| Package | Version | Purpose |
|---|---|---|
| next | 16.1.6 | React framework |
| react | 19.2.3 | UI library |
| react-dom | 19.2.3 | React DOM renderer |
| @tanstack/react-query | ^5.85.6 | Server state management |
| @microsoft/signalr | ^9.0.6 | Real-time communication |
| @mux/mux-player-react | ^3.8.0 | Video streaming |
| axios | ^1.11.0 | HTTP client |
| tailwindcss | ^4 | Styling |
| typescript | ^5 | Type safety |
- No privilege escalation: Container security hardening
- Read-only filesystem options
- Capability dropping: Minimal container permissions
- HTTPS enforcement: Secure headers configuration
- XSS Protection: Content Security Policy
- Token security: HTTP-only cookies for sensitive data
- Turbopack: Fast development builds
- SWC Minification: Optimized production builds
- Image Optimization: Next.js Image component
- Code Splitting: Automatic route-based splitting
- Compression: Gzip/Brotli response compression
- ETags: Efficient caching strategy
Docker deployment includes:
- Health check endpoint
- Resource limits (CPU: 2.0, Memory: 2G)
- Automatic restart policies
- Structured logging (max 10MB Γ 3 files)
| Variable | Required | Description |
|---|---|---|
NEXT_PUBLIC_API_URL |
Yes | Backend API base URL |
NODE_ENV |
Yes | Environment (development/production) |
PORT |
No | Server port (default: 4000) |
# Run linting
npm run lint
# Type checking
npx tsc --noEmit- Environment variables configured
- API endpoints verified
- Database connections tested
- SSL/TLS certificates installed
- CDN configured for static assets
- Monitoring and logging setup
- Backup strategy implemented
- Build the production image
- Configure reverse proxy (nginx/traefik)
- Set up SSL termination
- Configure domain and DNS
- Run database migrations
- Deploy container
- Verify health checks
- Monitor application logs
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is proprietary and confidential.
For issues and questions:
- Create an issue in the repository
- Contact the development team
- Check the documentation in
AUTH_README.md
- v0.1.0 - Initial production release
- Complete authentication system
- Real-time chat and messaging
- Live streaming capabilities
- Social feed and interactions
- User profiles and following
Built with β€οΈ using Next.js 16.1.6 and React 19.2.3 .