How calebe20/estudopro works
1. Project shape
EstudoPro is a study-management platform centered on exam prep workflows: adaptive question practice, flashcards, review history, performance dashboards, timers, goals, errors, and syllabus/cycle management. The repo is not a single-purpose app; it combines a large web application, Firebase-backed data services, background processing, and an Android shell.
2. Primary runtime and app shell
The main product UI lives in src/app using the Next.js App Router pattern. Route groups under src/app/(main) map directly to major product areas such as adaptive, flashcards, review, timer, dashboard, performance, errors, goals, syllabus, settings, and speedster. Shared layout concerns sit in src/components/layout, with auth protection handled by src/components/features/auth.
3. Feature-oriented UI structure
Most functionality is organized as feature modules under src/components/features/*. Each feature typically contains its own UI components, logic layer, service layer, and types. This gives a strong boundary between domains like flashcards, adaptive study, timer, review, performance, gamification, settings, and mobile. The route pages are mostly thin composition layers over these feature modules.
4. Central state and persistence boundary
Application-wide state is coordinated through the store utilities in src/utils/store, with React contexts in src/contexts and store hooks/actions spread across src/utils/store/*. This layer handles persistence, import/export, backup/restore, cycle/subject/session state, and synchronization concerns. The store is the main boundary between user interactions and durable study data.
5. Adaptive study engine
The adaptive subsystem is the most architecturally dense part of the repo. It spans:
- UI: src/components/features/adaptive
- Hooks/controllers: src/hooks/adaptive
- Domain logic: src/utils/adaptive
- Services/workers: src/services/adaptive*
Its data flow is: material import and question-bank management → theme/subtheme structure → mastery scoring and scheduling → question selection/supply planning → session execution and progress tracking. This subsystem also includes question movement, import plans/results, coverage targets, support text, AI validation, and diagnostic export.
6. AI-assisted generation and validation
AI is used mainly for adaptive question generation and flashcard/question text workflows. The repo references Gemini in the README via GEMINI_API_KEY, and the backend includes generation queues/workers plus services like aiService, cardGeneratorService, and adaptive question generation helpers. There are explicit validation and prompt-building utilities, indicating a controlled AI pipeline rather than direct UI-only prompting.
7. Flashcards and review workflows
Flashcards are a separate study subsystem with its own service, logic, browser, creator/import modals, review session UI, and AI analysis tooling. Review uses its own service and logic layers and is backed by calendar/history views. Together they represent a second study loop distinct from adaptive questions, but they share persistence and study history data.
8. Timer, sessions, and habit tracking
The timer subsystem includes Pomodoro logic, global timer behavior, weekly quests, history tracking, and multiple visualization components. It is tightly connected to study sessions and persistence, but architecturally separate from the adaptive engine. The timer also has mobile-specific views and an Android floating timer service, showing it is intended as a cross-platform productivity feature.
9. Analytics and reporting surfaces
Dashboard, performance, accuracy, errors, medals, and goals are mostly read/aggregate surfaces. They consume stored study data and present trends, completion, rankings, consistency, error history, and progress indicators. These areas are split into presentation logic and calculation utilities in src/utils/dashboard, src/utils/performance, src/utils/accuracy, src/utils/errors, and src/utils/masteryProgress.
10. Backend and server-side execution
There are two server-side entry points:
- Next.js API routes in src/app/api for operations like backtesting and oracle analysis.
- Firebase Cloud Functions in functions/, including adaptiveQuestionWorker.js.
These backend pieces support asynchronous or heavier operations, while the main app remains the primary interaction layer. The presence of worker-like code suggests background generation or processing rather than only synchronous request/response behavior.
11. Data platform and Firebase integration
The repository is strongly Firebase-oriented. It contains Firestore rules and indexes, Storage rules, Firebase hosting config, and a Dataconnect schema plus generated client packages under src/dataconnect-generated. There is also src/lib/firebase/config.ts and a Google Sheets integration layer, so the app’s data model is not purely local—it is backed by Firebase services and external sheet-based inputs.
12. Mobile/native boundary
The android/ directory is a Capacitor-based Android wrapper around the web app. Native code includes a floating timer service, overlay plugin, and the main activity, which suggests selected study features are elevated into native capabilities. The mobile UI also has dedicated components under src/components/mobile.
13. Static assets, media, and model data
public/ contains audio, images, medal assets, and ML-like JSON datasets. These assets feed UI polish, ambient sound features, and data-driven visualizations. The public/ml-data directory indicates some dashboards or gameplay-like features rely on precomputed model/config data rather than live remote inference.
14. Quality, testing, and governance
The repo is heavily test-driven, with many targeted Vitest scripts covering adaptive logic, flashcards, dashboard behavior, persistence, timers, performance, and API routes. There are also Python and Node audit scripts plus documentation artifacts under docs/ that appear to define product contracts and refactoring plans. The README explicitly points to docs/CONSTITUICAO_ESTUDO_ADAPTATIVO.md as the architectural source of truth for the adaptive domain.
Main entry points: store Store core · features Study modules · adaptive Adaptive hooks · services Adaptive services
Components 21
Web app
Next.js routes and page shells for the main product areas.
- Main routes · Route groups under src/app/(main) for study and analytics pages.
src/app/(main)
Feature modules
Domain-oriented UI and feature logic reused by routes and mobile surfaces.
- Layout auth · Shared header/sidebar layout and route protection for the app shell.
src/components/layout - Study modules · Feature-oriented modules for flashcards, review, timer, goals, performance, settings, and gamification.
src/components/features - Flashcards · Flashcard browser, creator, review session, AI analysis, and import tooling.
src/components/features/flashcards - Review · Review page, card forms, and calendar/history views backed by study records.
src/components/features/review - Timer · Pomodoro timer, global timer logic, weekly quests, and timer history visualizations.
src/components/features/timer - Performance · Performance dashboards, contest charts, ranking lists, and subject/topic summaries.
src/components/features/performance - Data mgmt · Settings, backup/restore, imports, question management, and study history administration.
src/components/features/settings/data-management
Core state
Shared store, contexts, hooks, and persistence boundaries.
- Store core · Global store, persistence, import/export, backup/restore, session, cycle, and subject/topic actions.
src/utils/store - React contexts · Context providers for confirmation and timer state.
src/contexts - Analytics utils · Dashboard, performance, accuracy, errors, and mastery progress calculations.
src/utils
Adaptive engine
The densest study subsystem: selection, mastery, import, AI, and session flow.
- Adaptive UI · Adaptive study page, session panels, bank browser, import/move dialogs, and support text tools.
src/components/features/adaptive - Adaptive hooks · Hook layer coordinating bank actions, imports, maintenance, sessions, and supply worker access.
src/hooks/adaptive - Adaptive domain · Rules for mastery, scheduling, supply plans, selection, validation, imports, and diagnostic export.
src/utils/adaptive - Adaptive services · Async services for question generation, imports, AI validation, canonical components, and lifecycle operations.
src/services
Data platform
Firebase, Dataconnect, API routes, and background workers.
- API routes · Server routes for backtest and oracle analysis operations.
src/app/api - Cloud functions · Background worker entry points for adaptive processing.
functions - Firebase data · Firebase config, rules, indexes, Dataconnect schema, generated clients, and external sheet integration.
src/lib/firebase/config.ts - Assets · Images, medals, sounds, and precomputed ML-like JSON data used by study and UI features.
public
Mobile shell
Android wrapper and mobile-specific app behavior.
- Android shell · Android wrapper with overlay plugin, floating timer service, and native activity.
android - Mobile UI · Mobile-specific question, timer, radio, settings, and session components.
src/components/mobile
Connections 23
- Main routes → Layout auth: renders with · Pages share the main layout and auth boundary.
- Main routes → Study modules: composes · Route pages mostly delegate to feature modules.
- Layout auth → Store core: reads state · Layout and auth surfaces depend on persisted session/user state.
- Study modules → Store core: uses store · Feature modules read and write study data through the shared store.
- Study modules → React contexts: consumes · Some feature surfaces rely on shared React contexts.
- Adaptive UI → Adaptive hooks: drives · Adaptive UI is mostly a composition layer over adaptive hooks.
- Adaptive hooks → Adaptive domain: orchestrates · Hooks coordinate domain rules and state transitions.
- Adaptive hooks → Adaptive services: invokes · Hooks trigger imports, AI work, and background generation services.
- Adaptive domain → Store core: persists via · Mastery, scheduling, and bank state ultimately flow into the store.
- Adaptive services → Firebase data: syncs with · Services rely on Firebase-backed persistence and data exchange.
- Adaptive services → Cloud functions: offloads · Heavy adaptive generation can run in cloud function workers.
- Flashcards → Store core: shares data · Flashcards use the same durable study data boundary.
- Review → Store core: reads history · Review views are backed by persisted study records and history.
- Timer → Store core: records sessions · Timer and quest features write activity and session history.
- Performance → Analytics utils: calculates from · Analytics surfaces are driven by shared calculation utilities.
- Performance → Store core: aggregates data · Performance views consume stored study outcomes and rankings.
- Data mgmt → Store core: administers · Backup, restore, import, and cleanup operations target the store.
- Analytics utils → Store core: derives from · Calculation utilities consume persisted study and timer data.
- API routes → Firebase data: serves · API routes support server-side analysis on top of Firebase data.
- Android shell → Mobile UI: hosts · The Android wrapper exposes mobile-specific app screens.
- Mobile UI → Timer: extends · Mobile timer surfaces align with the web timer subsystem.
- Mobile UI → Store core: syncs state · Mobile interactions share the same study store boundary.
- Assets → Study modules: feeds · Media assets and ML datasets support feature rendering and study flows.