How shubhashish-chakraborty/lastglance works
Purpose and Runtime
LastGlance is an Expo/React Native mobile study-revision client. It organizes exam notes by subject and connects to a separate backend for authentication, note/subject data, media storage, and service wake-up. The app runs through Expo during development and uses EAS for Android builds.
Key manifests: package.json, app.json, eas.json.
Application Entry and Navigation
Expo Router provides file-based routing. The root layout establishes global navigation, while the index route selects the initial experience. Route groups separate unauthenticated and authenticated application areas.
Paths: src/app/_layout.tsx, src/app/index.tsx, src/app/(auth)/_layout.tsx.
Authentication Boundary
Authentication screens live in a dedicated route group. Auth state is centralized in a store, exposed through a hook, and backed by secure device token storage. This boundary determines whether users access login/register flows or protected study content.
Paths: src/app/(auth)/login.tsx, src/app/(auth)/register.tsx, src/store/authStore.ts, src/hooks/useAuth.ts.
Authenticated Study Experience
The protected route group contains the main revision UI: home, profile, about, and parameterized subject views. Subject IDs in the route map UI state to backend subject/note resources; the subject screen is the primary detail boundary for subject-specific material.
Paths: src/app/(app)/_layout.tsx, src/app/(app)/home.tsx, src/app/(app)/subject/[id].tsx.
API and Service Layer
Network access is isolated from screens in services. api.ts is the shared HTTP-client boundary, while auth and wake-up services represent explicit backend interactions. The API base URL is externally configurable in source for local device-to-server connectivity.
Paths: src/constants/api.ts, src/services/api.ts, src/services/authService.ts, src/services/wakeupService.ts.
Backend and External Dependencies
The mobile app depends on the separate LastGlance backend repository, expected to provide JWT-based APIs, a PostgreSQL-compatible database, and AWS S3-backed media uploads. The app invokes a backend /wakeup endpoint to mitigate Render free-tier cold starts. Tokens are stored with expo-secure-store; images, screenshots, and other study media are represented remotely rather than by a local backend in this repository.
Relevant integration paths: src/services/wakeupService.ts, src/services/authService.ts, src/constants/api.ts.
Primary Control Flow
1. Expo loads src/app/_layout.tsx and resolves src/app/index.tsx.
2. Auth state/token retrieval directs navigation into (auth) or (app).
3. Authenticated screens call domain services through the shared API layer.
4. The API layer targets the configured backend URL; backend responses drive subject and note views.
5. Media-related content is served via backend-managed AWS S3 integration, while auth tokens remain in device secure storage.
Main entry points: api.ts Shared API client · index.tsx Initial route · (auth)/_layout.tsx Auth route group · (app)/_layout.tsx Protected route group
Components 19
Expo Mobile App
- Expo / EAS runtime · Runs development client and produces Android builds.
package.json - Auth state · Centralizes session state and token retrieval.
src/store/authStore.ts - Auth hook
src/hooks/useAuth.ts - Secure token storage · expo-secure-store persists authentication tokens.
Router UI
- Root layout
src/app/_layout.tsx - Initial route · Selects authenticated or unauthenticated experience.
src/app/index.tsx - Auth route group
src/app/(auth)/_layout.tsx - Login
src/app/(auth)/login.tsx - Register
src/app/(auth)/register.tsx - Protected route group
src/app/(app)/_layout.tsx - Home
src/app/(app)/home.tsx - Subject detail · Maps subject IDs to subject and note material.
src/app/(app)/subject/[id].tsx
Client Services
- API base URL · Configures device-to-server connectivity.
src/constants/api.ts - Shared API client
src/services/api.ts - Auth service
src/services/authService.ts - Wake-up service · Calls /wakeup to mitigate backend cold starts.
src/services/wakeupService.ts
External Backend
Separate LastGlance backend repository.
- LastGlance backend API · Provides authentication, subjects, notes, and media endpoints.
- PostgreSQL-compatible DB
- AWS S3 media storage · Stores remotely managed study media.
Connections 21
- Expo / EAS runtime → Root layout: loads
- Root layout → Initial route: resolves
- Initial route → Auth hook: checks session
- Auth hook → Auth state: reads
- Auth state → Secure token storage: retrieves token
- Initial route → Auth route group: unauthenticated
- Initial route → Protected route group: authenticated
- Auth route group → Login: contains
- Auth route group → Register: contains
- Protected route group → Home: contains
- Protected route group → Subject detail: contains
- Login → Auth service: signs in
- Register → Auth service: registers
- Auth service → Shared API client: uses
- Home → Shared API client: loads study data
- Subject detail → Shared API client: loads subject and notes
- Wake-up service → Shared API client: uses
- Shared API client → API base URL: reads URL
- Shared API client → LastGlance backend API: HTTP requests
- LastGlance backend API → PostgreSQL-compatible DB: persists data
- LastGlance backend API → AWS S3 media storage: serves media