MediHub is a full-stack medical learning and collaboration platform built with Next.js 14, Express, Prisma, PostgreSQL, and Socket.IO.
MediHub brings together the tools medical students, doctors, researchers, and educators need in one place. The app combines a polished landing experience with authenticated workspace features for learning, collaboration, communication, and career growth.
What the app covers
- π° Medical news browsing and trending topics
- π Event discovery, registration, and Eventbrite sync support
- π Notebook workspace for subjects, notes, blocks, and tasks
- π«Ά Social feed for posts, likes, bookmarks, reposts, and comments
- π₯ Community groups with threads, replies, votes, and resources
- π¬ Real-time chat with files, join requests, and pinned conversations
- π€ AI assistant for questions, document summaries, and extracted text
- π Notifications for chat, groups, events, and system actions
- πΌ Opportunities and applications for medical roles and internships
This version moves the backend from MongoDB/Mongoose to PostgreSQL with Prisma and Docker-based local database setup.
- π PostgreSQL replaces MongoDB as the main database
- π§© Prisma is used for schema management, queries, and migrations
- π³ Docker Compose is provided for local PostgreSQL startup
- π¨ The frontend UI has been refreshed with a cleaner landing page, updated navigation, responsive cards, and a more polished visual system
- β‘ Real-time chat, notifications, AI assistant, notebook, events, groups, opportunities, and feed features are wired into the current app structure
flowchart LR
U[User] --> F[Next.js Frontend]
F --> A[Express API]
F <--> S[Socket.IO]
A --> P[Prisma Client]
P --> D[(PostgreSQL)]
A --> U1[Uploads / Documents]
A --> N[Notifications]
A --> AI[AI Assistant]
The frontend handles the UI, routing, and client-side state. The backend provides the API, authentication, real-time messaging, and file/document workflows. Prisma connects the backend to PostgreSQL, and Docker provides a local database container for development.
Core product modules
| Area | What it does |
|---|---|
| π° News | Lists medical news, supports cache refresh, and exposes trending topics |
| π Events | Lists events, registers users, creates events, and supports Eventbrite syncing |
| π Notebook | Manages subjects, notes, note blocks, reorder actions, and tasks |
| π«Ά Feed | Supports posts, likes, bookmarks, reposts, comments, and image uploads |
| π₯ Groups | Handles communities, members, threads, replies, votes, pins, and resources |
| π¬ Chat | Supports conversations, direct and group chat, file messages, and join requests |
| π€ Assistant | Lets users chat with AI, summarize docs, extract text, and save message history |
| π Notifications | Tracks unread counts, read states, and bulk clearing |
| πΌ Opportunities | Lists roles, filters, applications, and user submissions |
| π€ Users | Handles register, login, profile fetch, and protected user listing |
The current frontend is not just functional; it is visually structured to feel like a complete product.
UI highlights
- β¨ A redesigned landing page with a stronger brand presence and feature-led storytelling
- π§ A sticky navigation bar with app shortcuts and notification controls
- π± Dedicated app pages for home, feed, events, groups, chat, notebook, assistant, opportunities, login, and signup
- ποΈ A clearer visual language with refined spacing, cards, borders, shadows, and color system
- π Responsive layouts that adapt to desktop and mobile screens
- π€ An assistant workspace with document upload, summary generation, and message history
| Route | Purpose |
|---|---|
/ |
Public landing page |
/login |
Sign in page |
/signup |
Sign up page |
/home |
Main authenticated dashboard |
/feed |
Community feed |
/events |
Events page |
/groups |
Communities and threads |
/chat |
Messaging |
/notebook |
Notes and tasks |
/assistant |
AI assistant |
/opportunities |
Roles and applications |
| Path | Role |
|---|---|
frontend/ |
Next.js app and UI |
backend/ |
Express API, Prisma schema, routes, controllers, and utilities |
docker-compose.yml |
Local PostgreSQL container |
backend/prisma/ |
Prisma schema and migrations |
backend/uploads/ |
Stored uploaded files |
- Node.js 18+ recommended
- npm
- Docker Desktop or another Docker runtime
- (Optional) Ollama running locally if you want to use the AI assistant. Pull the default model with
ollama pull smollm:1.7b.
From the repository root:
npm run install:allThis installs root, frontend, and backend dependencies.
cp backend/.env.example backend/.envThen open backend/.env and set at minimum:
JWT_SECRETβ any long random stringEVENTBRITE_TOKEN/NEWS_API_KEYβ optional, leave blank to disable events / news fetching
The default DATABASE_URL matches the Docker Compose setup below.
docker compose up -dThis starts the PostgreSQL container defined in docker-compose.yml on port 5432.
From the backend/ folder:
npx prisma migrate deploy
npx prisma generate(Use npx prisma migrate dev instead if you intend to author new migrations.)
From the repository root:
npm run devThat starts the frontend on http://localhost:3000 and the backend on http://localhost:5000.
| Command | Purpose |
|---|---|
npm run install:all |
Install frontend and backend dependencies |
npm run dev:frontend |
Start the frontend only |
npm run dev:backend |
Start the backend only |
npm run dev |
Run both apps together |
| Command | Purpose |
|---|---|
npm run dev |
Start Next.js in development mode |
npm run build |
Build the frontend |
npm run start |
Start the production build |
npm run lint |
Lint the frontend |
| Command | Purpose |
|---|---|
npm run dev |
Start the Express server with nodemon |
npm start |
Start the Express server |
POST /api/users/registerPOST /api/users/loginGET /api/users/meGET /api/users
GET /api/postsPOST /api/postsPUT /api/posts/:id/likePUT /api/posts/:id/bookmarkPOST /api/posts/:id/commentsDELETE /api/posts/:postId/comments/:commentIdPOST /api/posts/:id/repostDELETE /api/posts/:id
GET /api/notesPOST /api/notesPUT /api/notes/reorderPUT /api/notes/:idDELETE /api/notes/:idGET /api/notes/subjectsPOST /api/notes/subjectsPUT /api/notes/subjects/:nameDELETE /api/notes/subjects/:nameGET /api/tasksPOST /api/tasksPUT /api/tasks/:id/toggleDELETE /api/tasks/:id
GET /api/eventsPOST /api/eventsPUT /api/events/:id/registerDELETE /api/events/:idGET /api/events/eventbritePOST /api/events/eventbrite/refresh
GET /api/documentsPOST /api/documentsGET /api/documents/:id/downloadDELETE /api/documents/:idPOST /api/ai/chatPOST /api/ai/summarizePOST /api/ai/suggestionsPOST /api/ai/extract-textGET /api/ai/messagesPOST /api/ai/messagesDELETE /api/ai/messages
GET /api/chat/conversationsPOST /api/chat/conversations/privatePOST /api/chat/conversations/groupPUT /api/chat/conversations/:id/pinDELETE /api/chat/conversations/:idPOST /api/chat/conversations/:id/membersDELETE /api/chat/conversations/:id/members/:userIdGET /api/chat/conversations/:id/messagesPOST /api/chat/conversations/:id/messagesPOST /api/chat/conversations/:id/filesGET /api/chat/conversations/:id/filesGET /api/chat/users/searchGET /api/chat/join-requestsPOST /api/chat/conversations/:id/join-requestPUT /api/chat/join-requests/:id
GET /api/groupsPOST /api/groupsPUT /api/groups/:idPOST /api/groups/:id/joinDELETE /api/groups/:id/leaveGET /api/groups/:id/membersPOST /api/groups/:id/membersDELETE /api/groups/:id/members/:userIdGET /api/groups/:id/threadsPOST /api/groups/:id/threadsPUT /api/groups/threads/:threadId/votePUT /api/groups/threads/:threadId/pinGET /api/groups/threads/:threadId/repliesPOST /api/groups/threads/:threadId/repliesGET /api/groups/:id/resourcesPOST /api/groups/:id/resourcesPUT /api/groups/resources/:resourceId/download
GET /api/notificationsGET /api/notifications/unread-countPUT /api/notifications/read-allPUT /api/notifications/:id/readDELETE /api/notificationsGET /api/newsPOST /api/news/refreshGET /api/news/trendingGET /api/opportunitiesPOST /api/opportunitiesGET /api/opportunities/filtersGET /api/opportunities/applicationsPOST /api/opportunities/:id/applyDELETE /api/opportunities/:id
Prisma is the source of truth for the schema in backend/prisma/schema.prisma.
- PostgreSQL is the active database provider
- Relations are modeled through Prisma instead of Mongoose collections
- Migrations live under
backend/prisma/migrations/ - The backend connects to PostgreSQL through Prisma on startup
Main entities
- Users and auth
- Posts, comments, likes, bookmarks, and reposts
- Notes, note blocks, and subjects
- Tasks and event registrations
- Conversations, members, messages, and join requests
- Notifications and AI chat messages
- Documents, opportunities, applications, and groups
Common issues
- If the backend cannot connect, verify
DATABASE_URLand that Docker is running. - If Prisma schema changes are not visible, rerun
npx prisma generateandnpx prisma migrate dev. - If the frontend cannot reach the backend, check the backend port and any local proxy or firewall rules.
- If uploads fail, confirm the
backend/uploads/directory exists and the file size is within the configured limit. - If Socket.IO chat is not connecting, verify the JWT token and backend server startup.
Potential production follow-ups:
- π Add deployment-specific environment files and secrets handling
- π‘οΈ Harden authentication and session management
- βοΈ Add file storage backed by cloud object storage
- π§ͺ Expand validation and error handling
- β Add CI checks for Prisma migrations and frontend linting
- π Deploy the frontend and backend with managed PostgreSQL