Hey there! 👋 This is a dashboard built to analyze messages from HSV fans. It's basically a Next.js app that connects to a MariaDB database and shows some cool insights about what fans are talking about.
- Sentiment stuff: Shows you how positive or negative the messages are
- Message stats: Total messages, average length, emoji usage - the usual metrics
- Topic breakdown: Groups messages into topics like "Aufstieg", "Bier/Sponsoring", "Präsidentschaft"
- User tracking: See who's posting the most and their patterns
- Live data: This connects to MariaDB with some German fan messages seeded
- Frontend: Next.js 14, React 18, TypeScript
- Styling: Tailwind CSS (love it), Framer Motion for smooth animations
- Charts: Recharts for the data viz
- Database: MariaDB with sentiment analysis
- Deployment: Docker Compose to make setup easy
- Docker and Docker Compose
- Node.js 18+ and npm
-
Get the dependencies
cd frontend-assessment npm install -
Fire up the database and frontend
# From the root directory (where docker-compose.yml is) docker-compose up --buildThis starts:
- MariaDB on port 3306 with some sample data
- Next.js dev server on port 3000
-
Check it out
http://localhost:3000
The message table has fan messages with these fields:
text: The actual messagesentiment_score: How positive/negative (-1 to 1)sentiment_label: "positive" or "negative"char_count: Character countword_count: Word counthas_emojis: Whether it has emojisuser_uid: User IDcreationdate: When it was posted
This is already pre-seeded with German HSV fan messages and added sentiment analysis.
src/lib/db.tshandles all the database queries- Uses environment variables from
.env - Each query creates a new connection and closes it after use
Stats Cards (src/components/StatsCards.tsx)
- This shows the total messages, unique users, emoji usage
- Nice animated cards with color-coded metrics
Sentiment Chart (src/components/SentimentChart.tsx)
- There is a Pie chart showing positive vs negative messages
- Displays average sentiment scores
Topic Analysis (src/components/TopicAnalysis.tsx)
- There is a Bar chart of top discussion topics
- Uses keyword matching to categorize messages
Message Timeline (src/components/MessageTimeline.tsx)
- Recent messages with sentiment indicators
- Shows character/word counts
- Server components grab data from MariaDB
- Data gets processed and formatted for charts
- Client components render the interactive visualizations
- Updates in real-time when database changes
# Just start the database
docker-compose up db
# In another terminal, start the frontend
cd frontend-assessment
npm run devCreate a .env file in the frontend-assessment directory:
DB_HOST=localhost
DB_PORT=3306
MYSQL_USER
MYSQL_PASSWORD
MYSQL_DATABASEnpm run test:dbRuns the database connection and query tests.
frontend-assessment/
├── src/
│ ├── app/ # Next.js app router
│ ├── components/ # React components
│ ├── lib/
│ | ├── db.ts # Database queries
| |
│ └── test/
| ├── db.test.ts # Database tests
|
├── db/ # SQL initialization scripts
└── docker-compose.yml # Docker setup
The dashboard gives you practical insights into fan engagement patterns, sentiment trends, and what topics HSV fans are discussing most.