How sridhar-y-g/geopredict works
1. Overall shape
This repository is split into a React frontend and a Python backend. The architecture is a classic client–server setup: the browser UI handles user interaction and visualization, while the backend owns authentication, data access, and integration with external data sources relevant to landslide early warning.
2. Frontend boundary
The frontend/ app is built with Vite + React and styled with Tailwind/PostCSS. It is the presentation layer only: it renders pages, manages navigation, and calls backend APIs. Key app entry points are src/main.jsx and src/App.jsx.
3. User-facing screens
The main UI surface is organized into pages for Landing, Home, Login, Register, Dashboard, Profile, and Admin. This suggests two major user flows: public access/marketing and authenticated operational access.
4. Client-side state and access control
AuthContext.jsx centralizes authentication state on the frontend, and ProtectedRoute.jsx gates restricted pages. This means the frontend enforces route-level access before the user reaches dashboards, profile data, or admin functions.
5. Backend service boundary
The backend is organized as a Python service with distinct modules: main.py as the entry point, auth.py for identity flows, profile.py for user-specific data, admin.py for elevated operations, and security.py for credential/token handling. This reads like a REST API layered by concern rather than a monolith with one large handler.
6. Data and persistence
database.py and models.py define the persistence layer and domain schema. The backend is the only component that should talk directly to the database, which keeps the frontend isolated from storage details and preserves a clean API boundary.
7. Authentication and authorization flow
Login/register requests originate in the frontend, pass to the backend auth module, are validated through security utilities, and then persist or read user records via the database layer. The presence of both ProtectedRoute on the client and backend security code implies defense in depth for authenticated and role-based access.
8. External data integration
The repo includes NASA_INTEGRATION_MANUAL.md and backend/test_weather.py, which strongly indicates that the backend integrates with external environmental/weather/NASA data sources. In the landslide-warning context, these inputs are part of the risk-signal pipeline rather than the UI itself.
9. Operational and deployment support
backend/start_backend.ps1 suggests Windows-based local startup or deployment support for the API service. On the frontend side, the presence of package.json, ESLint, and Tailwind config indicates a standard JavaScript build workflow for development and production bundling.
10. Documentation vs runtime
Landslide_Market_and_Competitor_Analysis.md and the NASA manual are supporting documents, not runtime components. They provide domain and integration context, while the executable architecture is centered on the React UI, Python API, database layer, and external data feeds.
11. What to show in an architecture diagram
A good diagram would show:
- Browser users entering the React app
- The app using auth context / protected routes
- Requests flowing to the Python backend API
- Backend modules split into auth / profile / admin / security
- Backend reading/writing the database
- Backend calling external weather/NASA services
- Dashboard/admin screens consuming the resulting data for landslide risk monitoring
12. Important nuance
The repository, as shown, emphasizes the application platform and data integration layer more than the predictive model itself. If you are diagramming the full solution, treat the landslide intelligence/prediction capability as either an external service or a not-yet-exposed backend subsystem unless additional model code exists elsewhere.
Main entry points: App.jsx Shell · main.py API entry · auth.py Auth API · database.py Database
Components 19
Frontend
React UI and client-side route protection
- App boot · Starts the browser app and mounts the UI
frontend/src/main.jsx - Shell · Top-level routing and page composition
frontend/src/App.jsx - Auth state · Holds login state and session context
frontend/src/context/AuthContext.jsx - Guard · Blocks access to restricted pages
frontend/src/components/ProtectedRoute.jsx - Landing · Public entry and marketing surface
frontend/src/pages/Landing.jsx - Home · General application landing area
frontend/src/pages/Home.jsx - Login · User sign-in screen
frontend/src/pages/Login.jsx - Register · User account creation screen
frontend/src/pages/Register.jsx - Dashboard · Authenticated monitoring and data view
frontend/src/pages/Dashboard.jsx - Profile · Authenticated personal data view
frontend/src/pages/Profile.jsx - Admin · Privileged administrative interface
frontend/src/pages/Admin.jsx
Backend
Python API, persistence, and integrations
- API entry · Backend service startup and routing entrypoint
backend/main.py - Auth API · Login and registration flows
backend/auth.py - Profile API · User profile data access
backend/profile.py - Admin API · Privileged backend operations
backend/admin.py - Security · Token and credential handling
backend/security.py - Database · Storage access and database connection layer
backend/database.py - Models · Domain entities and persistence models
backend/models.py - Weather/NASA · External environmental data feeds used for risk context
backend/test_weather.py
Connections 25
- App boot → Shell: bootstraps · Entry point mounts the app shell
- Shell → Auth state: provides · App wraps routes with auth state
- Shell → Guard: uses · Protected screens are gated before render
- Shell → Landing: routes · Public route to landing page
- Shell → Home: routes · Public route to home page
- Shell → Login: routes · Authentication route
- Shell → Register: routes · Account creation route
- Shell → Dashboard: routes · Protected operational view
- Shell → Profile: routes · Protected user view
- Shell → Admin: routes · Protected admin view
- Login → Auth API: calls · Submits sign-in requests
- Register → Auth API: calls · Submits registration requests
- Dashboard → API entry: calls · Fetches operational data from backend
- Profile → Profile API: calls · Loads user profile data
- Admin → Admin API: calls · Performs elevated actions
- API entry → Auth API: dispatches · Routes auth-related requests
- API entry → Profile API: dispatches · Routes profile requests
- API entry → Admin API: dispatches · Routes admin requests
- Auth API → Security: verifies · Credentials and tokens are validated
- Auth API → Database: reads/writes · Stores and retrieves user records
- Profile API → Database: reads · Loads persisted profile data
- Admin API → Database: reads/writes · Admin workflows touch storage
- Database → Models: maps to · Persistence layer uses domain schema
- API entry → Weather/NASA: integrates · Ingests external weather/NASA context
- Dashboard → Weather/NASA: consumes · Displays risk-relevant data sourced from backend