A comprehensive discussion platform built with Next.js 15, featuring Twitter integration, beautiful UI/UX, and modern web development best practices.
- Dynamic E-Lafda Pages: Individual discussion pages with rich content
- Twitter Integration: Embedded tweets using
react-tweetpackage - Interactive Polls: Community voting with real-time results
- Comment System: Threaded discussions with replies
- Rich Media Support: Image attachments and media content
- Search & Filtering: Advanced search with category filtering
- Responsive Design: Mobile-first approach with excellent UX
- Server Components: Leverages Next.js 15 app router
- TypeScript: Fully typed for better developer experience
- shadcn/ui: Beautiful, accessible UI components
- SEO Optimized: Dynamic metadata generation
- Loading States: Skeleton UI for better perceived performance
- Error Handling: Custom 404 pages and error boundaries
src/
โโโ app/
โ โโโ e-lafda/
โ โ โโโ [id]/
โ โ โโโ page.tsx # Main e-lafda page
โ โ โโโ loading.tsx # Loading skeleton
โ โ โโโ not-found.tsx # 404 page
โ โ โโโ metadata.ts # SEO metadata
โ โโโ layout.tsx
โ โโโ page.tsx
โโโ components/
โ โโโ ui/ # shadcn/ui components
โ โโโ e-lafda-directory.tsx # Directory listing
โ โโโ search.tsx # Search components
โโโ lib/
โ โโโ mock-data.ts # Mock data for development
โ โโโ utils.ts # Utility functions
โโโ types/
โโโ e-lafda.ts # TypeScript interfaces
- Next.js 15: React framework with app router
- React 19: Latest React with concurrent features
- TypeScript: Type-safe development
- Tailwind CSS: Utility-first CSS framework
- shadcn/ui: Component library built on Radix UI
- react-tweet: Static tweet embedding without Twitter API
- Suspense: Loading states for async tweet loading
- Error Boundaries: Graceful error handling
- Avatar: User profile images with fallbacks
- Badge: Status indicators and tags
- Button: Interactive elements with variants
- Card: Content containers
- Separator: Visual dividers
- Tabs: Organized content sections
- Tooltip: Contextual information
- Uses CSS variables for theme consistency
- Supports light/dark mode (via shadcn/ui)
- Accessible color contrasts
- Hierarchical heading structure
- Readable body text with proper line heights
- Responsive font sizes
- Consistent spacing scale using Tailwind
- Proper visual hierarchy
- Mobile-responsive layouts
- Lists all e-lafdas with filtering
- Search functionality
- Category-based organization
- Pagination support
- Discussion Tab: Comments and attachments
- Tweets Tab: Embedded Twitter content
- Polls Tab: Interactive community polls
- Related Tab: Related discussions
- Custom 404 for non-existent e-lafdas
- Loading skeletons for better UX
- Node.js 18+
- Bun (recommended) or npm/yarn
-
Install Dependencies
bun install
-
Add shadcn/ui Components (if needed)
bunx --bun shadcn@latest add avatar badge button card separator tabs tooltip
-
Install React Tweet
bun add react-tweet
-
Start Development Server
bun run dev
interface ELafda {
id: string
title: string
description: string
author: {
id: string
username: string
displayName: string
avatar?: string
verified?: boolean
}
createdAt: string
updatedAt?: string
views: number
stars: number
replies: number
category: string
tags: string[]
isHot: boolean
isTrending: boolean
status: 'active' | 'closed' | 'archived'
tweets?: ELafdaTweet[]
polls?: ELafdaPoll[]
attachments?: ELafdaAttachment[]
}- Static Rendering: Tweets render without JavaScript
- Server Components: Compatible with Next.js app router
- Automatic Theming: Respects user's color scheme preference
- Fallback Loading: Custom skeleton while tweets load
import { Tweet } from "react-tweet"
import { Suspense } from "react"
function EmbeddedTweet({ tweetId }: { tweetId: string }) {
return (
<div className="my-6">
<Suspense fallback={<TweetSkeleton />}>
<Tweet id={tweetId} />
</Suspense>
</div>
)
}- App Router: Modern routing with layouts
- Server Components: Better performance and SEO
- Dynamic Metadata: SEO optimization per page
- Loading States: Better user experience
- Error Boundaries: Graceful error handling
- TypeScript: Type safety throughout
- Component Composition: Reusable, modular components
- Hooks: Proper state management
- Suspense: Async component loading
- Mobile-First: Responsive design approach
- Accessibility: ARIA labels, keyboard navigation
- Performance: Optimized images and lazy loading
- Visual Hierarchy: Clear content organization
- Skeleton UI: Immediate visual feedback
- Image Optimization: Next.js automatic optimization
- Lazy Loading: Tweets load on demand
- Code Splitting: Automatic route-based splitting
- Dynamic Metadata: Per-page meta tags
- Open Graph: Social media sharing
- Twitter Cards: Enhanced Twitter previews
- Structured Data: Rich snippets support
Avatar- User profile imagesBadge- Status and category tagsButton- Interactive elementsCard- Content containersSeparator- Visual dividersTabs- Content organizationTooltip- Contextual information
ELafdaDirectory- Main listing pageELafdaHeader- Page header with metadataCommentCard- Threaded comment displayPollComponent- Interactive votingTweetSkeleton- Loading placeholder
- Real API integration
- Database persistence
- Authentication system
- Real-time updates
- Push notifications
- User profiles
- Comment voting
- Share functionality
- Advanced search
- Content moderation
- Mobile app
- Redis caching
- CDN integration
- Image optimization
- Bundle analysis
Navigate to /e-lafda/1 to see the demo e-lafda with:
- Embedded tweets
- Interactive polls
- Comment discussions
- Related content
Currently using mock data. To integrate with real API:
- Replace
getELafdaByIdfunction - Add create/edit functionality
- Implement user authentication
- Follow the existing code structure
- Use TypeScript for all new code
- Maintain shadcn/ui design system
- Add proper error handling
- Include loading states
- Write meaningful commit messages
This project is part of the elafda application and follows the same licensing terms.
Built with โค๏ธ using Next.js 15, React 19, and modern web technologies.