OpenMAIC-React
A full conversion of OpenMAIC from Next.js to React (Vite).
OpenMAIC is the open-source AI interactive classroom β upload a PDF to instantly generate an immersive, multi-agent learning experience.
What Changed (Next.js β React)
| Feature | Next.js (Original) | React + Vite (This Repo) |
|---|---|---|
| Framework | Next.js 16 | React 19 + Vite 6 |
| Routing | App Router (app/ directory) |
React Router DOM v7 |
| Pages | app/page.tsx, app/classroom/[id]/page.tsx |
src/pages/ with lazy loading |
| Layout | app/layout.tsx |
src/App.tsx with <BrowserRouter> |
| API Routes | app/api/*/route.ts |
src/api-routes/ (for separate Express backend) |
'use client' |
Required for client components | Removed (all components are client-side) |
| Navigation | useRouter from next/navigation |
useNavigate from react-router-dom |
| Route Params | useParams from next/navigation |
useParams from react-router-dom |
| Fonts | next/font/local |
@fontsource-variable/inter CSS import |
| Themes | Custom ThemeProvider (no next-themes) |
Same custom ThemeProvider |
| CSS | Tailwind CSS v4 + PostCSS | Tailwind CSS v4 + PostCSS (identical) |
| Env Variables | process.env.* |
import.meta.env.VITE_* |
| Middleware | Next.js middleware | Kept in src/api-routes/ for backend |
| Build | next build |
vite build |
Routes
| Path | Component | Description |
|---|---|---|
/ |
HomePage |
Landing page with classroom list and generation form |
/classroom/:id |
ClassroomPage |
Interactive classroom view |
/generation-preview |
GenerationPreviewPage |
Live generation preview with step visualization |
/eval/whiteboard |
WhiteboardEvalPage |
Whiteboard evaluation tool |
Project Structure
src/
βββ main.tsx # Entry point
βββ App.tsx # Root component with Router + Providers
βββ globals.css # Global styles (Tailwind v4)
βββ pages/ # Page components (lazy loaded)
β βββ HomePage.tsx
β βββ ClassroomPage.tsx
β βββ generation-preview/
β βββ eval/
βββ components/ # Shared UI components (200+ files)
β βββ ui/ # shadcn/ui components
β βββ ai-elements/ # AI interaction components
β βββ agent/ # Agent management
β βββ chat/ # Chat interface
β βββ canvas/ # Canvas drawing
β βββ whiteboard/ # Whiteboard
β βββ ...
βββ lib/ # Utilities, hooks, stores, types
β βββ hooks/ # React hooks (theme, i18n, etc.)
β βββ store/ # Zustand stores
β βββ i18n/ # Internationalization (5 languages)
β βββ types/ # TypeScript types
β βββ ai/ # AI/LLM utilities
β βββ audio/ # TTS/ASR
β βββ ...
βββ api-routes/ # Server-side API routes (for Express backend)
packages/
βββ mathml2omml/ # MathML to OMML converter
βββ pptxgenjs/ # PowerPoint generation
Getting Started
Prerequisites
- Node.js >= 20.9.0
- npm or pnpm
Install & Run
# Install dependencies
npm install --legacy-peer-deps
# Build workspace packages
cd packages/mathml2omml && npm install && npm run build && cd ../..
cd packages/pptxgenjs && npm install && npm run build && cd ../..
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
Environment Variables
Copy .env.example and configure with your API keys. In Vite, client-side env vars must be prefixed with VITE_:
cp .env.example .env
API Backend
The API routes from the original Next.js project are preserved in src/api-routes/ for reference. To use them, set up a separate Express/Fastify backend and configure the Vite dev server proxy in vite.config.ts:
server: {
proxy: {
'/api': {
target: 'http://localhost:3001',
changeOrigin: true,
},
},
},
Tech Stack
- React 19 + Vite 6 β Fast builds, HMR
- React Router DOM v7 β Client-side routing
- Tailwind CSS v4 β Utility-first CSS
- Zustand β State management
- shadcn/ui β Radix-based component library
- AI SDK β Multi-provider LLM integration
- i18next β Internationalization (zh-CN, en-US, ja-JP, ru-RU, ar-SA)
- Motion (Framer Motion) β Animations
- ProseMirror β Rich text editing
- Dexie β IndexedDB wrapper
- ECharts β Data visualization
Credits
Based on OpenMAIC by THU-MAIC.
License
AGPL-3.0 (same as original)