mind-trace.studio — Beautiful, expert-style cognitive traces for school analytical questions (math, physics, chemistry, proofs, definitions, calculations…).
Type or screenshot a problem → Gemini (via secure server proxy) produces:
Strictly dark, flat, zero-distraction UI. Keyboard, wheel, swipe, dot, and “New Analysis” navigation that never gets stuck.
https://mind-trace.studio (deploy your copy and point the domain)
cd frontend
npm install
# 1. Get a free Gemini key: https://aistudio.google.com/app/apikey
# 2.
cat > .env.local << EOF
GEMINI_API_KEY=your_key_here
EOF
npm run dev
App runs at http://localhost:3000 (Vite dev + Express API on same port).
cd frontend
npm run build
NODE_ENV=production npm start
# or: node dist/server.cjs
dist/ contains the client + the production server.cjs (Express that serves the SPA + /api/generate-trace).
Use any Node-friendly host:
frontendnpm ci && npm run buildnpm run startGEMINI_API_KEY=...mind-trace.studio in dashboard + configure DNS (CNAME usually)process.env.PORT).The key never leaves the server. Client only talks to your /api.
MindTrace/
├── frontend/ # ← the real app (React + server proxy + all the magic)
│ ├── src/App.tsx # UI, navigation, history, share, renderTextWithMath (formatting hero)
│ ├── server.ts # Express routes + Gemini call + heavy cleaning/sanitizing
│ ├── package.json
│ └── ...
├── src/main/java/... # Legacy Java data model (reference only — not used by the site)
├── pom.xml
├── Readme.md # You are here
└── .gitignore
The Java sources are kept for history / if you ever want to port the model. For the hosted site they are irrelevant.
com.google.genai.*, Gson, etc.)The src/main/java + pom.xml contain the original reference implementation (data model records + a GeminiTraceGenerator that talks to Gemini using the official Google GenAI Java SDK + structured output).
If after cloning you open a .java file and see red squiggly lines under the imports:
./mvnw dependency:copy-dependencies -DoutputDirectory=lib
./mvnw compile
(The mvnw script now auto-downloads the Maven distribution the very first time you run it — the full dist is gitignored so the repo stays small.)
Cmd/Ctrl+Shift+P, type “Java: Clean Java Language Server Workspace”, run it, then “Reload Window”.This creates lib/ (40+ jars — gitignored) containing google-genai-1.56.0.jar, gson-2.11.0.jar and every transitive dependency, plus target/classes. The committed .vscode/settings.json tells the Java language server to treat lib/**/*.jar + target/classes as the project classpath.
You only need to do the mvn step once per machine (or after a git clean -fdx).
The live hosted site (the React app at mind-trace.studio) does not use any of this Java code — the Gemini calls and all the formatting logic live in frontend/server.ts (Node) and frontend/src/App.tsx.
If you only ever want the web app you can delete the Java/Maven files (src/, pom.xml, mvnw*, .mvn/) with no effect on the product.
cleanString + sanitizeTranslation (cuts prose leaks like “Read Problem 1: …”, “Since …”, dedupes, extracts only math chunks, normalizes newlines & escapes)renderTextWithMath (line-aware, bare-latex fallback, bold/italic, handles \n, nulls, over-escaped \, mixed text+math)“Share” produces tiny ?state=... links (url-safe base64 of the trace only — problem statement lives inside the trace so no duplication, images intentionally omitted so links stay copy-paste friendly even for long problems).
frontend/GEMINI_API_KEY (server only)PORT (auto-set by hosts)See frontend/.env.example.
MIT. The goal is a production-grade, delightful tool for students who want to understand how experts actually think, not just see the final line.
Enjoy the traces!