MOOC Utils

Utils like auto assignment solver extension and course notice announcment notification for MOOC courses

Architecture overview

MOOC Utils is three cooperating apps:

  • A browser extension for AI assignment help.
  • A FastAPI backend for users, subscriptions, courses, and notifications.
  • A Next.js site for landing and dashboard, talking to the backend for auth and data.

The extension does not go through the website to reach Gemini.

Project structure#

  • assignment-solver/: Vite + webextension-polyfill, Chrome and Firefox.
  • notice-reminders/: FastAPI + Tortoise ORM. CLI and API from main.py.
  • website/: Next.js 16, React 19, TypeScript, TanStack Query.

Core components#

  • Browser Extension (Assignment Solver)

    • UI: side panel controllers for settings, progress, solve.
    • Background: message router, extraction, screenshots, Gemini, apply answers.
    • Content script: page HTML and DOM writes.
    • Services: Gemini + local storage for the key.
    • Build: Vite, dynamic manifests.
  • FastAPI Backend (Notice Reminders)

    • Routers: users, search, courses, announcements, subscriptions, notifications.
    • Persistence: Tortoise + Aerich, SQLite by default.
    • Entry: uv run python main.py cli|api.
  • Next.js Website

    • Routes: /, /notice-reminders, /notice-reminders/login, /notice-reminders/dashboard, /assignment-solver, /privacy.
    • Auth: email OTP, httpOnly cookies, refresh, logout.
    • API: typed fetch client with credentials.

Architecture overview#

Presentation is the website. API is FastAPI. Data is SQLite via Tortoise. The extension is an edge client of Gemini, not of the Notice Reminders API.

Browser extension architecture#

UI waits for the background worker, then loads the stored key. Gemini requests use structured schemas in src/services/gemini/schema.js.

FastAPI backend pattern#

Factory creates the app, CORS, routers, Tortoise. Routers sit in app/api/routers/. There is no package/api tree.

Next.js web application structure#

Data flow between components#

Dependency analysis#

Performance#

  • Extension: delays between Gemini calls and DOM writes. Direct Gemini fetch avoids message-channel timeouts.
  • Backend: async scraping, cache TTL, SQLite for local.
  • Website: TanStack Query cache.

Troubleshooting#

  • Extension: invalid Gemini key, selectors, quota.
  • Backend: database_url, jwt_secret, router includes.
  • Website: cookies, CORS, NEXT_PUBLIC_API_URL.

Conclusion#

Extension, API, website. Shared auth cookies and REST between site and API. The extension stays on-device with Gemini.

Appendices#

  • Extension boundary: UI, background, content script, Gemini service.
  • Backend boundary: FastAPI, routers, SQLite.
  • Website boundary: App Router, providers, API client.
  • Website ↔ Backend: REST, CORS, cookies.
  • Extension ↔ Gemini: structured prompts and schemas.
  • Extension ↔ Website: marketing/download page only. No Gemini proxy.