A modern, real-time team collaboration platform built with Next.js, featuring AI-powered compose assistance, workspace management, and real-time messaging capabilities.
- Multi-workspace support with organization-based access control
- Workspace creation and management powered by Kinde Auth
- Role-based permissions and member management
- Real-time channels with instant message delivery
- Thread-based conversations for organized discussions
- Message reactions and emoji support
- Image attachments via UploadThing
- Presence tracking to see who's online
- AI-enhanced message composition
- Smart content suggestions and improvements
- Powered by OpenRouter AI SDK
- Rate-limited and security-protected AI interactions
- Comprehensive security middleware with Arcjet
- Bot detection and prevention
- Rate limiting (sliding window)
- Sensitive information detection
- Shield protection against common attacks
- Request validation and sanitization
- Secure authentication with Kinde
- Beautiful, responsive design with Tailwind CSS
- Dark/Light theme support
- Rich text editor with TipTap
- Smooth animations with Framer Motion
- Custom UI components with Radix UI
- Framework: Next.js 16 (React 19)
- Styling: Tailwind CSS 4
- UI Components: Radix UI
- Animations: Framer Motion
- Rich Text Editor: TipTap
- State Management: TanStack Query
- API: oRPC - Type-safe RPC framework
- Database: PostgreSQL with Prisma
- Authentication: Kinde Auth
- Real-time: PartyKit (Cloudflare Durable Objects)
- File Upload: UploadThing
- AI SDK: @ai-sdk/react with OpenRouter
- Security: Arcjet
- Bot detection
- Rate limiting
- Sensitive info detection
- Shield protection
- Language: TypeScript
- Package Manager: pnpm
- Linting: ESLint
- Edge Runtime: Cloudflare Workers (via Wrangler)
- Node.js 20.x or higher
- pnpm (recommended) or npm
- PostgreSQL database
- Kinde account for authentication
- UploadThing account for file uploads
- OpenRouter API key for AI features
- Arcjet API key for security features
git clone <your-repo-url>
cd team-flow-aipnpm installCreate a .env file in the root directory with the following variables:
# Database
DATABASE_URL="postgresql://..."
# Kinde Auth
KINDE_CLIENT_ID="..."
KINDE_CLIENT_SECRET="..."
KINDE_ISSUER_URL="..."
KINDE_SITE_URL="http://localhost:3000"
KINDE_POST_LOGOUT_REDIRECT_URL="http://localhost:3000"
KINDE_POST_LOGIN_REDIRECT_URL="http://localhost:3000/workspace"
# Kinde Management API
KINDE_MANAGEMENT_CLIENT_ID="..."
KINDE_MANAGEMENT_CLIENT_SECRET="..."
# UploadThing
UPLOADTHING_TOKEN="..."
# OpenRouter AI
OPENROUTER_API_KEY="..."
# Arcjet Security
ARCJET_KEY="..."
# PartyKit (for real-time features)
NEXT_PUBLIC_PARTYKIT_HOST="..."pnpm prisma generate
pnpm prisma db pushpnpm devOpen http://localhost:3000 to see the application.
For real-time features, deploy the PartyKit server:
pnpm wrangler deployteam-flow-ai/
βββ app/ # Next.js app directory
β βββ (dashboard)/ # Dashboard routes (workspace UI)
β βββ (marketing)/ # Marketing pages
β βββ api/ # API routes
β βββ middlewares/ # Security and auth middlewares
β βββ router/ # oRPC route handlers
β βββ schemas/ # Zod validation schemas
β βββ rpc/ # RPC endpoint
βββ components/ # Reusable React components
β βββ general/ # General components
β βββ rich-text-editor/ # TipTap editor components
β βββ ui/ # UI library components
βββ hooks/ # Custom React hooks
βββ lib/ # Utility functions and configs
β βββ generated/prisma/ # Generated Prisma client
β βββ query/ # TanStack Query setup
βββ prisma/ # Database schema
βββ providers/ # React context providers
βββ realtime/ # PartyKit real-time server
βββ public/ # Static assets
The app uses Kinde organizations to manage workspaces. Each workspace can have multiple channels and members with role-based access control.
PartyKit (Cloudflare Durable Objects) powers the real-time features, providing:
- Instant message delivery
- Presence tracking
- Live updates across all connected clients
The AI assistant helps users compose better messages by:
- Analyzing current message content
- Providing intelligent suggestions
- Improving clarity and tone
- Rate-limited to prevent abuse
Multiple security layers protect the application:
- Authentication: Kinde provides secure user authentication
- Bot Protection: Arcjet detects and blocks malicious bots
- Rate Limiting: Prevents API abuse with sliding window rate limits
- Sensitive Data: Automatically detects and blocks sensitive information
- Shield: Protects against common web attacks
# Development
pnpm dev # Start development server
pnpm build # Build for production
pnpm start # Start production server
# Linting
pnpm lint # Run ESLint
# Database
pnpm prisma studio # Open Prisma Studio
pnpm prisma generate # Generate Prisma client- Push your code to GitHub
- Import project to Vercel
- Add environment variables
- Deploy
pnpm wrangler deployThis project is private and proprietary.
This is a private project. Please contact the maintainer for contribution guidelines.
Built with β€οΈ using Next.js, Prisma, and modern web technologies.