How g3saranath/smart-assignment-tracker works
Purpose and entry points
Smart Assignment Tracker is a local, single-student assignment workflow: upload a document, normalize it, use Gemini to extract and solve questions, persist progress, and optionally email reminders. The backend REST server starts from server/src/index.ts; the React/Vite client starts at client/src/main.tsx and is composed primarily in client/src/App.tsx. Root scripts in package.json run both services.
Client interaction layer
The browser UI owns assignment upload, question completion toggles, on-demand solve actions, reminder settings, and rendering of progress and sources. API calls are isolated in client/src/api.ts, keeping client/src/App.tsx focused on state and presentation. Markdown/answer display and PDF export are separate presentation capabilities in client/src/Markdown.tsx and client/src/exportPdf.ts.
HTTP orchestration boundary
server/src/index.ts is the integration boundary between browser requests and domain services. It accepts multipart/document-oriented operations, invokes ingestion and AI workflows, reads/writes persisted records, calculates progress, and exposes notification actions. The client should not directly access Gemini, SMTP, filesystem document conversion, or SQLite.
Document ingestion and normalized context
server/src/ingest.ts converts uploaded PDF, DOCX, TXT, and Markdown inputs into Markdown/text. This creates the canonical document context consumed by the agent rather than making downstream stages format-aware. Document assets/retention concerns are separated in server/src/assets.ts; typed cross-stage models are defined in server/src/types.ts.
Gemini agent pipeline
server/src/agent.ts has two material AI stages:
1. Structured question extraction from normalized assignment content.
2. On-demand solution generation for an individual question using the assignment context plus Gemini Google Search grounding.
The server holds the Gemini API key and model configuration; the browser receives extracted questions, answer text, and source links—not provider credentials or raw provider coupling. Grounding metadata is transformed into displayable sources at this boundary. server/src/questionContext.ts prepares/selects the relevant document and question context passed to the solver.
Persistence and progress model
SQLite persistence is centralized in server/src/store.ts, backed by server/data.sqlite at runtime. It stores assignments, normalized content/metadata, question state, answers, and notification state across restarts. server/src/progress.ts derives completion counts, remaining work, due-date timing, and status from stored assignment/question records; UI progress indicators and reminder summaries should use these shared calculations.
Notifications and runtime infrastructure
server/src/notify.ts implements SMTP email delivery and an in-process scheduler. While the Node server is running, it periodically evaluates pending assignments and enforces a minimum reminder interval before sending progress summaries. SMTP credentials and Gemini settings come from environment configuration (.env.example); external dependencies are Google Gemini/Google Search grounding and a configured SMTP provider. The runtime is Node 18+ with Express, React 18/Vite, and better-sqlite3.
Main entry points: index.ts REST server · store.ts SQLite store · agent.ts Gemini agent · notify.ts Reminder scheduler
Components 19
Browser client
- Vite entry
client/src/main.tsx - Assignment UI · Owns upload, progress, solve, and reminder interactions.
client/src/App.tsx - API client
client/src/api.ts - Answer renderer
client/src/Markdown.tsx - PDF export
client/src/exportPdf.ts
Node server
- REST server · Coordinates browser requests with domain workflows.
server/src/index.ts - Document ingestion · Converts PDF, DOCX, TXT, and Markdown into canonical text.
server/src/ingest.ts - Document assets
server/src/assets.ts - Gemini agent · Extracts structured questions and generates grounded solutions.
server/src/agent.ts - Question context
server/src/questionContext.ts - SQLite store · Persists assignments, content, questions, answers, and notification state.
server/src/store.ts - Progress model · Calculates completion, remaining work, due timing, and status.
server/src/progress.ts - Reminder scheduler · Periodically sends rate-limited pending-assignment summaries.
server/src/notify.ts - Shared models
server/src/types.ts - Assignment database
Runtime dependencies
- Gemini + Search grounding
- SMTP provider
- Environment settings · Supplies Gemini and SMTP credentials.
.env.example
Other components
- Root scripts · Runs the client and server together.
package.json
Connections 27
- Root scripts → Vite entry: starts
- Root scripts → REST server: starts
- Vite entry → Assignment UI: mounts
- Assignment UI → API client: uses
- Assignment UI → Answer renderer: renders answers
- Assignment UI → PDF export: exports
- API client → REST server: REST requests
- REST server → Document ingestion: uploads
- Document ingestion → Document assets: retains documents
- Document ingestion → Gemini agent: normalized context
- REST server → Gemini agent: extracts and solves
- Question context → Gemini agent: solver context
- SQLite store → Question context: assignment records
- Gemini agent → Gemini + Search grounding: generation and grounding
- REST server → SQLite store: reads and writes
- SQLite store → Assignment database: persists
- SQLite store → Progress model: assignment state
- Progress model → REST server: status summaries
- Reminder scheduler → SQLite store: evaluates pending work
- Reminder scheduler → Progress model: builds summaries
- REST server → Reminder scheduler: notification actions
- Reminder scheduler → SMTP provider: sends email
- Environment settings → Gemini agent: Gemini settings
- Environment settings → Reminder scheduler: SMTP settings
- Shared models → Document ingestion: contracts
- Shared models → Gemini agent: contracts
- Shared models → SQLite store: contracts