A decentralized chat platform for web3 communities, built with React, Express, and blockchain authentication.
- π Secure Chat with end-to-end encryption
- π Web3 Integration with MetaMask and Coinbase Wallet
- π₯ Private & public chat rooms
- π€ Friend system with request management
- π¨ Custom usernames & profiles
- π¬ Real-time messaging
- π Emoji reactions
- β¨οΈ Typing indicators
- Frontend: React, TypeScript, TailwindCSS
- Backend: Express.js, Node.js
- Database: NeonDB (Serverless Postgres)
- Authentication: Web3 (MetaMask/Coinbase Wallet)
- Real-time: WebSocket (local) or Pusher (production)
- Click the "Run" button to start the development server
- The application will be available on port 5000
- Connect your Web3 wallet (MetaMask or Coinbase Wallet)
- Start chatting!
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Start production server
npm startBuzzy.Chat supports two methods for real-time messaging:
WebSockets are used by default in development mode. This is a direct connection between the client and server that provides real-time message delivery.
For production deployments, especially on platforms like Netlify that don't support WebSockets, Buzzy.Chat uses Pusher as a real-time messaging service.
- Create a free account at Pusher.com
- Create a new Channels app in the Pusher dashboard
- Note your app credentials:
- App ID
- Key
- Secret
- Cluster
- Add these credentials to your
.envfile:PUSHER_APP_ID=your_app_id PUSHER_KEY=your_key PUSHER_SECRET=your_secret PUSHER_CLUSTER=your_cluster
The application will automatically detect whether to use WebSockets or Pusher based on:
- The presence of Pusher credentials in your environment
- Whether you're running on Netlify (automatically uses Pusher)
To verify if Pusher is working correctly:
- Open your browser console on your deployed site
- Run:
fetch('/.netlify/functions/debug-env').then(r => r.json()).then(console.log) - You should see your Pusher configuration status
When running the application on localhost, you can use test wallets without needing to install MetaMask or Coinbase Wallet:
- Start the development server with
npm run dev - Access the application on
http://localhost:5000 - Click on "Connect Wallet"
- In the dropdown menu, you'll see "Local Testing" options with test wallets
- Select any test wallet to login without a real wallet
This feature is only available in the local development environment and allows you to test the application without connecting an actual Web3 wallet.
For a complete testing experience, you can add pre-configured test wallets to your database:
- Make sure your PostgreSQL database is running and configured properly
- Make sure you've run database migrations with
npm run db:push - Run the following command to add test wallets:
npm run db:seed-test-wallets
This will add three test wallets to your database with the following details:
| Address | Username | Nickname |
|---|---|---|
| 0x71C7656EC7ab88b098defB751B7401B5f6d8976F | test_user1 | Test User 1 |
| 0x2546BcD3c84621e976D8185a91A922aE77ECEc30 | test_user2 | Test User 2 |
| 0xbDA5747bFD65F08deb54cb465eB87D40e51B197E | test_user3 | Test User 3 |
These test wallets match the addresses used in the mock wallet implementation, allowing you to test user interactions between different accounts.
The application supports both NeonDB (cloud/serverless PostgreSQL) and local PostgreSQL. You can easily switch between them by changing the .env configuration.
- Sign up for a free account at NeonDB
- Create a new PostgreSQL database
- Copy your connection string
- Create a
.envfile in the project root (or copy from.env.example) with:# NeonDB Configuration NEON_DATABASE_URL=your_neon_database_url_here USE_NEON_DB=true
- Download PostgreSQL for Windows from the official website
- Run the installer with these settings:
- Select all components during installation
- Choose a password for the postgres superuser
- Use the default port 5432
- After installation, create a new database:
- Open pgAdmin (installed with PostgreSQL)
- Connect to your local server
- Right-click on "Databases" and select "Create" β "Database"
- Name your database (e.g., "buzzy_chat")
- Create a
.envfile in the project root (or copy from.env.example) with:# Local PostgreSQL Configuration LOCAL_DATABASE_URL=postgresql://postgres:your_password@localhost:5432/buzzy_chat USE_NEON_DB=false
There are two easy ways to switch between database types:
We've added convenience scripts to quickly switch database types:
# Switch to local PostgreSQL
npm run db:local
# Switch to NeonDB (cloud)
npm run db:neonAfter switching, restart your server to apply the changes.
Alternatively, you can manually edit your .env file:
- Open your
.envfile - Set
USE_NEON_DB=trueto use NeonDB (cloud) - Set
USE_NEON_DB=falseto use local PostgreSQL - Restart your server
This allows you to develop locally with PostgreSQL and deploy to production with NeonDB without changing your code.
- Run the database migrations after setting up your database:
npm run db:push
βββ client/ # Frontend React application
βββ server/ # Backend Express server
βββ shared/ # Shared types and schemas
βββ public/ # Static assets
Feel free to open issues and submit pull requests to contribute to this project.
MIT License
This project can be deployed to Netlify for hosting. Follow these steps:
-
Create a Netlify account at netlify.com
-
Install the Netlify CLI:
npm install -g netlify-cli
-
Login to Netlify:
netlify login
-
Initialize your site:
netlify init
-
Set up environment variables in the Netlify dashboard:
NEON_DATABASE_URL- Your NeonDB connection stringUSE_NEON_DB- Set to "true"PUSHER_APP_ID- Your Pusher app IDPUSHER_KEY- Your Pusher keyPUSHER_SECRET- Your Pusher secretPUSHER_CLUSTER- Your Pusher cluster
-
Deploy your site:
netlify deploy --prod
-
Database Configuration: This project uses NeonDB (serverless PostgreSQL) which works well with Netlify. Make sure you've set up your NeonDB database and provided the connection string as an environment variable.
-
Real-time Communication: Netlify Functions don't support WebSockets natively, so this project automatically uses Pusher for real-time communication when deployed to Netlify. Make sure you've set up all Pusher environment variables.
-
Connection Status: The chat interface shows a connection indicator that displays whether you're connected via Pusher or WebSockets.
-
Hybrid Mode: The application can fall back to HTTP polling if both WebSockets and Pusher are unavailable, ensuring chat functionality works in all environments.
-
Function Timeout: Netlify Functions have a timeout limit (default 10 seconds). Make sure your database operations complete within this timeframe.
-
Cold Starts: Serverless functions experience "cold starts" when they haven't been used recently. The first request might be slower than subsequent ones.