CommFlock is a community/groups platform where users sign in with a username (email optional), discover or create communities, and coordinate activities. Communities can be public or private, auto-join or approval-required. Each community has announcements, activity, events with capacity control, simple votes, a leaderboard, and owner-defined badges. Payments are Lightning-first via NWC (phase 2); in phase 1 we simulate payments so flows are testable. Multi-tenant by slug (e.g., project.com/gordosbala). i18n en/es from day one. Built with Next.js (App Router), Prisma/Postgres, Auth.js, and shadcn/ui.
- Multi-tenant Communities: Each community has its own space with custom settings and policies
- Lightning Payments: Built-in Lightning Network support for community creation and event payments (simulated in v1)
- Events & Polls: Coordinate activities with events, polls, and community announcements
- Flexible Join Policies: Auto-join, approval-required, or closed communities
- Member Management: Points, badges, and leaderboards
- Internationalization: English and Spanish support
- Modern UI: Built with shadcn/ui and Tailwind CSS
- Frontend: Next.js 15 (App Router) + TypeScript
- Database: PostgreSQL + Prisma ORM
- Authentication: Auth.js with credentials provider
- UI: Tailwind CSS + shadcn/ui
- Internationalization: next-intl
- Validation: Zod
- Forms: react-hook-form
- Node.js 18+
- PostgreSQL 14+ (for local development)
- npm or pnpm
- Clone the repository:
git clone <repository-url>
cd CommFlock
- Install dependencies:
npm install
- Set up environment variables:
cp env.example .env
Edit .env
with your database credentials:
For open source contributors (SQLite):
DATABASE_URL="file:./dev.db"
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="dev-secret-change-later"
For shared development (Neon PostgreSQL):
DATABASE_URL="postgresql://USER:PASSWORD@HOST-POOLER.neon.tech/DB?sslmode=require&pgbouncer=true"
DIRECT_URL="postgresql://USER:PASSWORD@HOST.neon.tech/DB?sslmode=require"
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="dev-secret-change-later"
- Set up the database:
# Run migrations
npm run db:migrate
# Generate Prisma client
npm run db:generate
# Seed the database (optional)
npm run seed
- Start the development server:
npm run dev
- Open http://localhost:3000 in your browser.
- Create a new project in Neon Console
- Copy your connection strings:
- Pooled URL (for runtime):
postgresql://USER:PASSWORD@HOST-POOLER.neon.tech/DB?sslmode=require&pgbouncer=true
- Direct URL (for migrations):
postgresql://USER:PASSWORD@HOST.neon.tech/DB?sslmode=require
- Pooled URL (for runtime):
- Connect your GitHub repository to Netlify
- Set environment variables in Netlify dashboard:
DATABASE_URL=postgresql://USER:PASSWORD@HOST-POOLER.neon.tech/DB?sslmode=require&pgbouncer=true DIRECT_URL=postgresql://USER:PASSWORD@HOST.neon.tech/DB?sslmode=require NEXTAUTH_URL=https://your-site.netlify.app NEXTAUTH_SECRET=your-secret-key-here
- Deploy! Netlify will automatically:
- Run
prisma migrate deploy
- Generate Prisma client
- Build the Next.js app
- Deploy using OpenNext
- Run
- Health Check: Visit
https://your-site.netlify.app/api/health
- Database Test: Create a test community
- Authentication: Test sign-in functionality
- i18n: Verify language switching works
- Health endpoint returns 200
- Database connection successful
- Home page loads correctly
- Language switching works (/en ↔ /es)
- Community creation works
- Authentication flow works
- Images load properly
- API routes respond correctly
src/
├── app/ # Next.js App Router
│ ├── [locale]/ # Internationalized routes
│ │ ├── (auth)/ # Authentication pages
│ │ ├── (public)/ # Public pages
│ │ └── [slug]/ # Community pages
│ ├── api/ # API routes
│ └── globals.css # Global styles
├── components/ # React components
│ └── ui/ # shadcn/ui components
├── lib/ # Utility libraries
│ ├── auth.ts # Auth.js configuration
│ ├── db.ts # Prisma client
│ ├── i18n.ts # Internationalization
│ ├── validators.ts # Zod schemas
│ └── slug.ts # URL slug utilities
├── messages/ # i18n message files
│ ├── en.json
│ └── es.json
└── middleware.ts # Next.js middleware
npm run dev
- Start development servernpm run build
- Build for productionnpm run start
- Start production servernpm run lint
- Run ESLintnpm run prisma:studio
- Open Prisma Studionpm run db:migrate
- Run database migrationsnpm run db:generate
- Generate Prisma clientnpm run seed
- Seed the database
The project uses Prisma as the ORM with PostgreSQL. Database schema is defined in prisma/schema.prisma
.
Key models:
- User: Users with username and optional email
- Community: Multi-tenant communities with various settings
- CommunityMember: User memberships with roles and status
- Event: Community events with capacity and pricing
- Poll: Community polls with voting
- Payment: Simulated Lightning payments
Currently uses a simple credentials provider for development:
- Username (required)
- Email (optional)
- No passwords in v1
The app supports English and Spanish with next-intl:
- Default locale: Spanish (es)
- URL structure:
/en/...
or/es/...
- Message files in
src/messages/
- Real Lightning payments via NWC
- Additional authentication providers (Google, GitHub, Nostr)
- Email/push notifications
- Media uploads for community covers
- Moderation tools
- Metrics dashboard
- E2E tests
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
MIT License - see LICENSE file for details