This guide provides comprehensive instructions for setting up the AnonChat project locally for development.
- Prerequisites
- Initial Setup
- Environment Configuration
- Running the Project
- Database Setup
- Troubleshooting
Before you begin, ensure you have the following installed on your system:
- Node.js (v18 or higher) - Download
- Git - Download
- pnpm (v8 or higher) - Install globally with:
npm install -g pnpm
- GitHub account - For forking and contributing to the repository
- Supabase account - For database and authentication services (Sign up)
- Stellar Wallet - For Web3 wallet authentication testing
- VS Code - Download
- PostGres Client - For database management
- Stellar Lab - For testing blockchain interactions (Link)
# Fork the repository on GitHub first, then clone your fork
git clone https://github.com/YOUR-USERNAME/AnonChat.git
cd AnonChatTo keep your fork synchronized with the original repository:
git remote add upstream https://github.com/original-owner/AnonChat.git
git fetch upstreamUsing pnpm (recommended for this project):
pnpm installThis will install all dependencies listed in package.json, including:
- Next.js - React framework
- Tailwind CSS - Utility-first CSS framework
- Radix UI - Headless UI components
- Stellar Wallet Kit - Web3 wallet integration
- Supabase - Backend services and authentication
pnpm --version
node --versionCreate a .env.local file in the root directory for local development:
cp .env.example .env.local # If .env.example exists, or create manuallyAdd the following environment variables to .env.local:
# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
# Optional: Supabase Service Role Key (for server-side operations)
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key- Go to Supabase Dashboard
- Create a new project or select existing one
- Navigate to Settings → API
- Copy:
- Project URL →
NEXT_PUBLIC_SUPABASE_URL - Anon Key →
NEXT_PUBLIC_SUPABASE_ANON_KEY - Service Role Key →
SUPABASE_SERVICE_ROLE_KEY
- Project URL →
Add Stellar-specific configuration to .env.local:
# Stellar Configuration
NEXT_PUBLIC_STELLAR_NETWORK=testnet # Use 'testnet' for development, 'public' for production
# Stellar Blockchain Integration (for on-chain group metadata)
STELLAR_NETWORK=testnet
STELLAR_SOURCE_SECRET=S... # Your Stellar testnet account secret key
STELLAR_HORIZON_URL=https://horizon-testnet.stellar.org
STELLAR_TRANSACTION_TIMEOUT=30000 # Optional: Transaction timeout in milliseconds (default: 30000)- Go to Stellar Laboratory
- Click Generate keypair to create a new account
- Copy the Secret Key (starts with 'S') →
STELLAR_SOURCE_SECRET - Copy the Public Key (starts with 'G')
- Click Fund account with Friendbot to get testnet XLM
- Verify your account has funds on Stellar Expert
Ensure your .env.local file is in the root directory and contains all required variables:
# List environment files (should show .env.local)
ls -la | grep envThe database schema is managed through Supabase migrations. SQL migration files are located in the scripts/ directory:
001_create_profiles.sql- Creates user profiles table002_create_profile_trigger.sql- Creates database trigger for profile creation003_room_members_and_removal_votes.sql- Room membership and wallet-based removal voting
- Go to Supabase Dashboard → Your Project
- Navigate to SQL Editor
- Click New Query
- Copy and paste the contents of
scripts/001_create_profiles.sql - Click Run
- Repeat for
scripts/002_create_profile_trigger.sqlandscripts/003_room_members_and_removal_votes.sql
# Install Supabase CLI (if not already installed)
npm install -g supabase
# Login to Supabase
supabase login
# Push migrations
supabase db pushCheck that tables are created in Supabase:
- Go to Supabase Dashboard → Table Editor
- Verify
profilestable exists with expected columns
Start the development server:
pnpm devThe application will be available at http://localhost:3000
Build the project for production:
pnpm buildAfter building, start the production server:
pnpm startCheck code for style violations:
pnpm lintAnonChat/
├── app/ # Next.js app directory
│ ├── api/ # API routes
│ │ ├── auth/ # Authentication endpoints
│ │ ├── messages/ # Message handling
│ │ └── rooms/ # Chat rooms
│ ├── chat/ # Chat pages
│ ├── layout.tsx # Root layout
│ └── page.tsx # Home page
├── components/ # Reusable React components
├── lib/ # Utility functions and services
│ └── supabase/ # Supabase client configurations
├── public/ # Static assets
├── scripts/ # Database migration scripts
├── styles/ # Global CSS
├── package.json # Project dependencies
├── tsconfig.json # TypeScript configuration
└── next.config.mjs # Next.js configuration
| Layer | Technology |
|---|---|
| Frontend Framework | Next.js 16 / React 19 |
| Styling | Tailwind CSS 4, Radix UI |
| Language | TypeScript 5 |
| Web3 Auth | Stellar Wallet Kit |
| Backend | Supabase (PostGres + APIs) |
| Forms | React Hook Form, Zod validation |
| Real-time | Supabase Realtime |
| Deployment | Vercel |
# 1. Create a new feature branch
git checkout -b feature-[issue-number]
# 2. Make changes and test
pnpm dev
# 3. Lint and build
pnpm lint
pnpm build
# 4. Commit with proper message
git commit -m "Feat: description (#issue-number)"
# 5. Push to your fork
git push origin feature-[issue-number]
# 6. Create a Pull Request on GitHub# Fetch latest changes
git fetch upstream
# Rebase your branch on latest main
git rebase upstream/main
# If there are conflicts, resolve them and continue
git rebase --continueBefore submitting a PR, test locally:
- Application starts without errors:
pnpm dev - No console errors or warnings
- Responsive design works on mobile/tablet/desktop
- Web3 wallet connection works (if modified)
- Chat functionality works as expected
- All linting passes:
pnpm lint - Production build succeeds:
pnpm build
Solution:
# Clear pnpm cache
pnpm store prune
# Clean install
rm -rf node_modules pnpm-lock.yaml
pnpm installSolution:
# Run on different port
pnpm dev -- -p 3001Solution:
- Verify
.env.localhas correct Supabase credentials - Check internet connection
- Verify Supabase project is active in dashboard
- Try refreshing Supabase auth token:
supabase logout supabase login
Solution:
- Verify you're using correct Supabase project
- Check SQL syntax in migration files
- Try running migrations manually in Supabase Dashboard SQL Editor
- Check Supabase logs for errors
Solution:
# Rebuild TypeScript
pnpm tsc --noEmit
# Clean and reinstall
rm -rf node_modules .next
pnpm install
pnpm buildSolution:
- Ensure you're using a testnet wallet for development
- Check wallet browser extension is installed and enabled
- Verify
NEXT_PUBLIC_STELLAR_NETWORKis set totestnet - Try a different wallet (Freighter, Lobstr, etc.)
- Check existing issues on GitHub
- Ask in discussions or comments on related issues
- Review documentation: README.md, CONTRIBUTING.md
- Consult references:
- Next.js: https://nextjs.org/docs
- Supabase: https://supabase.com/docs
- Tailwind: https://tailwindcss.com/docs
- ✅ Read the README.md to understand the project
- ✅ Review CONTRIBUTING.md for contribution guidelines
- ✅ Check design.md for UI/UX specifications
- ✅ Look at open issues and find one to work on
- ✅ Follow the branch naming conventions mentioned in CONTRIBUTING.md
- ✅ Submit your first PR!
- Stellar Documentation: https://developers.stellar.org
- Next.js Documentation: https://nextjs.org/docs
- Supabase Documentation: https://supabase.com/docs
- Tailwind CSS Documentation: https://tailwindcss.com/docs
- Radix UI Documentation: https://www.radix-ui.com
Happy Coding! 🎉
If you encounter any issues during setup, please open an issue on GitHub with details about your environment and the error message.