SimTrainer is an interactive practice lab for Resident Assistants (RAs) and Teaching Assistants (TAs). Trainees chat with an AI‑driven student persona, receive real‑time scores for empathy/curiosity/structure/satisfaction, and save conversations for reflection. Everything runs locally with Next.js, Prisma, and Ollama so recruiters and collaborators can inspect the full stack.
- Real RA/TA scenarios – 20+ prebuilt tracks plus support for custom prompts.
- Local LLM feedback – the
/api/evaluateroute uses Ollama to score the entire conversation and determine whether the student feels satisfied. - Conversation history – authenticated users can save, reopen, and reset runs with full transcripts and rubric metrics.
- Customizable UI – reusable
ChatPanel, history dashboard, and builder pages to tweak personas without redeploying.
| Layer | Tech |
|---|---|
| Frontend | Next.js App Router, Tailwind CSS, TypeScript |
| Backend | Next.js API routes (/api/chat, /api/evaluate, /api/history) |
| Database | SQLite via Prisma ORM |
| Authentication | NextAuth.js (credentials provider) |
| AI Integration | Local Ollama models (default llama3) for conversation + evaluation |
- Node.js 18+ (recommend
nvm use 18). - npm (ships with Node) or
pnpm/yarn/bunif you prefer. - Ollama:
- Download from ollama.com/download.
- Install and start the Ollama service.
- Pull the conversational model:
ollama pull llama3(or your chosen model).
- SQLite (bundled with Prisma; no separate install needed).
# 1. Clone the repo
git clone https://github.com/your-org/simtrainer.git
cd simtrainer
# 2. Install dependencies
npm install
# 3. Copy environment template and set secrets
cp .env.example .env.local
# Fill in NEXTAUTH_SECRET, DATABASE_URL, SMTP creds (optional), etc.
# 4. Generate Prisma client & migrate
npx prisma migrate dev
# 5. Ensure Ollama is running
ollama serve # (Mac/Linux) or launch the Ollama desktop app on Windows
# 6. Start the dev server
npm run devVisit http://localhost:3000 to explore scenarios. The default RA/TA chat loads a scripted student opener; use the right sidebar to switch tracks or custom prompts.
-
The app points to
http://127.0.0.1:11434by default. Override via.env.local:OLLAMA_URL=http://localhost:11434 OLLAMA_MODEL=llama3.1:8b # any installed model -
/api/chatstreams student responses, while/api/evaluatesends the entire transcript to Ollama to receive JSON feedback with empathy/curiosity/structure/satisfaction/resolved/summary.
simtrainer/
├─ app/
│ ├─ api/ # REST endpoints (chat, evaluate, auth, history)
│ ├─ auth/, history/… # Pages rendered via App Router
│ └─ scenarios/ # Prebuilt RA/TA prompts
├─ components/ # ChatPanel, HistoryList, Scenario builders
├─ data/tracks.ts # Scenario metadata
├─ prisma/
│ └─ schema.prisma # Conversation + user models
├─ lib/ # Prisma client, auth helpers, session storage
└─ README.md
npm run build
npm run startSet NODE_ENV=production, ensure DATABASE_URL points to a persistent SQLite/ Postgres instance, and keep Ollama running on the same network location as defined in your env vars. Deployments to platforms like Vercel require a reachable Ollama endpoint (self-hosted VM or container).
- Navigate to
/builderto author a new prompt. - Provide a title, short description, and persona notes.
- Save the generated slug in your database or run it ad hoc.
Alternatively, add entries directly to data/tracks.ts and redeploy.
- Start a sample conversation in
/raor/ta. - Click End scenario & save to trigger
/api/evaluate. - Watch the numeric scores and “Scenario complete” banner appear when the student is satisfied.
| Issue | Fix |
|---|---|
fetch ECONNREFUSED 127.0.0.1:11434 |
Ensure Ollama is running and reachable; verify OLLAMA_URL. |
| Feedback JSON parsing error | Check Ollama logs; confirm the model supports JSON-style responses. |
| Prisma migration fails | Delete prisma/dev.db (if safe) and rerun npx prisma migrate dev. |
| “Unauthorized” on history pages | Create an account via /auth/register, then log in. |
- Fork the repository.
- Create a feature branch:
git checkout -b feat/new-scenario. - Commit changes with clear messages.
- Open a PR describing the scenario/feature and attach screenshots or Looms of the new interaction.
MIT © SimTrainer Team. Feel free to adapt for your own RA/TA coaching needs—just share improvements!