A modern real-time chat application designed for connecting people through text and video chat. Built with Next.js, Socket.IO, and integrated with Supabase authentication and database.
- Node.js 18.0.0 or higher
- npm or yarn package manager
- Supabase account for authentication and database
- Xata account for additional database features (optional)
- Clone the repository:
git clone <repository-url>
cd TinChat- Install dependencies for both client and server:
# Install client dependencies
npm install
# Install server dependencies
cd server
npm install
cd ..- Environment Setup:
- Copy
.env.exampleto.env.localand configure your environment variables - Set up Supabase authentication and database
- Configure Xata database connection (if using)
Required environment variables:
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key- Database Setup:
- Run the migration script in
supabase_migration.sqlin your Supabase SQL editor - Enable authentication providers in Supabase Dashboard β Authentication
- Set redirect URLs to include
your_domain/auth/callback
Start the development servers:
# Start the Next.js development server (port 9002)
npm run dev
# In another terminal, start the Socket.IO server
npm run server:devThe application will be available at http://localhost:9002
# Build the client
npm run build
# Build the server
cd server
npm run buildTinChat/
βββ src/ # Next.js application source
β βββ app/ # App router pages and layouts
β βββ components/ # Reusable React components
β βββ hooks/ # Custom React hooks
β βββ lib/ # Utility libraries and configurations
β βββ styles/ # Global styles and CSS
β βββ types/ # TypeScript type definitions
β βββ utils/ # Utility functions
βββ server/ # Socket.IO server
β βββ config/ # Server configuration
β βββ managers/ # Connection and room managers
β βββ routes/ # API routes
β βββ services/ # Business logic services
β βββ types/ # Server type definitions
β βββ utils/ # Server utilities
βββ public/ # Static assets
βββ components.json # shadcn/ui configuration
- Next.js 15 - React framework with App Router
- React 18 - UI library
- TypeScript - Type safety
- Tailwind CSS - Styling
- shadcn/ui - UI component library
- Framer Motion - Animations
- Socket.IO Client - Real-time communication
- Socket.IO - Real-time bidirectional communication
- Node.js - Runtime environment
- TypeScript - Type safety
- Supabase Auth - Authentication and user management
- Supabase - Primary database and real-time features
- Xata - Additional database features (optional)
- Redis (ioredis) - Caching and session management
- Vercel Analytics - Performance monitoring
- Sentry - Error tracking
- AWS S3 - File storage
- Google Cloud Storage - Additional file storage
- Uses shadcn/ui components with Radix UI primitives
- Tailwind CSS for consistent styling
- 98.css theme available for retro styling
- Custom theme provider supporting multiple themes
src/styles/globals.css- Global styles and CSS variablestailwind.config.ts- Tailwind configurationsrc/components/theme-provider.tsx- Theme management
All UI components are located in src/components/ and follow shadcn/ui patterns:
- Consistent API design
- Accessible by default
- Customizable with CSS variables
- TypeScript support
npm run dev # Start development server with Turbopack
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
npm run typecheck # TypeScript type checkingnpm run server:dev # Start server in development mode
cd server && npm run dev # Alternative server dev command
cd server && npm run build # Build server for productionnpm run genkit:dev # Start Genkit development server
npm run genkit:watch # Start Genkit with file watching@radix-ui/*- Accessible UI primitivestailwindcss- Utility-first CSS frameworkframer-motion- Animation librarylucide-react- Icon library
socket.io- Real-time communicationsocket.io-client- Client-side Socket.IO
@tanstack/react-query- Server state managementreact-hook-form- Form handlingzod- Schema validation
@supabase/auth-helpers-nextjs- Supabase authentication for Next.js@supabase/auth-helpers-react- React hooks for Supabase auth@supabase/auth-ui-react- Pre-built auth UI components@supabase/supabase-js- Supabase client@xata.io/client- Xata database client
The application is configured for deployment on Vercel with the following setup:
- Next.js application on Vercel
- Socket.IO server can be deployed separately
- Supabase handles authentication and database hosting
- Environment variables configured for production
- CSP headers configured for security
- Create a Supabase project
- Run the migration script from
supabase_migration.sql - Configure authentication providers
- Set production redirect URLs
- Add environment variables to your deployment platform
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
This project is licensed under the MIT License.
This project has been migrated from Clerk to Supabase authentication. Key benefits:
- Cost-effective: No per-user pricing limits
- Integrated: Authentication and database in one platform
- Open source: Full control and transparency
- Feature-rich: Built-in OAuth, email verification, and more
- β Database schema updated with Supabase auth integration
- β Authentication components converted to Supabase
- β Middleware updated for session management
- β Row Level Security (RLS) policies implemented
- β Automatic user profile creation on signup
- Check
MIGRATION_TO_SUPABASE_AUTH.mdfor detailed migration notes - Run
supabase_migration.sqlto set up the database schema - Update any remaining Clerk references in custom components
For more detailed documentation on specific features, check the migration guide MIGRATION_TO_SUPABASE_AUTH.md or refer to the inline code comments.