How adi765/scheme-setu-frontend works
1. Overall shape
- This repo is a multi-page frontend application with a small Flask backend.
- The browser does most of the work: rendering pages, handling auth state, searching, swiping, saving wishlist items, and showing scheme details.
- The backend is narrowly scoped to one job: scheme matching.
2. UI surfaces / pages
- The app is split across dedicated HTML pages: index, login, dashboard, profile, find, search, swipe, and wishlist.
- index.html is the public landing page.
- login.html and the other protected pages use the same local auth gate, so access control is handled in the browser rather than on the server.
3. Presentation layer
- Styling is a mix of Tailwind CSS via CDN and custom styles in css/styles.css.
- styles.css carries the project-specific visuals that affect architecture: auth overlay behavior, modal styling, swipe-card animation, and other reusable component styles.
- There is no frontend build pipeline in the repo.
4. Client-side application modules
- The JavaScript is split by feature into small modules under js/:
- auth.js for login/signup and auth overlay
- api.js for backend/local data access
- form.js for profile validation and submission
- search.js for keyword search and filtering
- swipe.js for swipe-card interactions
- wishlist.js for saved-scheme views
- modal.js for scheme detail display
- utils.js for shared helpers
- This is a browser-side modular architecture, not a framework-based SPA.
5. Authentication boundary
- Authentication is localStorage-based, not server-managed.
- auth.js controls sign-in state and shows an auth overlay on protected pages when needed.
- This means the frontend decides whether a user can interact with protected experiences like dashboard, profile matching, wishlist, and swipe.
6. Scheme discovery and matching flow
- The main value path is: user fills profile data on profile.html or find.html → the frontend validates input in form.js → the app calls the matching API through api.js.
- The response becomes the matched-scheme set used by downstream views like swipe, results, and detail modal.
- find.html is intentionally ephemeral: it supports matching for another person without persisting that profile to the user account state.
7. Backend service boundary
- app.py is a Flask API that exposes scheme matching, described in the README as POST /api/match-schemes.
- requirements.txt shows the backend runtime dependencies: Flask and Flask-CORS.
- DATA_CONTRACT.md documents the request/response shape, which is the contract between frontend and backend.
8. Local data and fallback behavior
- The repository includes data/schemes_schemesetu_v3.json, the scheme dataset used for search/matching content.
- js/dummyData.js provides mock API responses.
- api.js can switch between real API calls and dummy/local fallback, so the app can still function when the backend is unavailable.
- This makes the architecture local-first and resilient to API failure.
9. Search and browse subsystem
- search.html uses search.js for debounced keyword lookup, result highlighting, and tag-based filtering.
- This part of the app is mostly client-side and likely reads from local dataset/API output rather than requiring server round-trips for every keystroke.
- It is a distinct browsing path from the eligibility matching flow.
10. Swipe and wishlist subsystem
- swipe.html presents matched schemes as swipeable cards using swipe.js and custom animation styles.
- Users can save or skip schemes; saved items feed into wishlist.html.
- wishlist.js renders and manages the shortlist, with shared persistence/helpers likely coming from utils.js.
11. Shared detail modal
- modal.js is a reusable overlay for scheme details such as eligibility, benefits, documents, and apply links.
- It acts as a cross-cutting UI component used from search, swipe, and wishlist contexts.
12. State storage model
- Persistent browser state appears to be handled primarily in localStorage for auth and saved user-facing state.
- Scheme content itself lives in JSON/local data, while generated match results come from the Flask API or dummy data.
- The architecture therefore separates:
- static content: HTML/CSS/JS and scheme JSON
- client state: auth/wishlist/session in localStorage
- computed results: matched schemes from API
13. Key architectural takeaway
- This is not a monolithic server-rendered app; it is a static, modular frontend with lightweight service integration.
- The critical diagram boundaries are:
- browser UI pages
- client-side feature modules
- local browser state
- local scheme dataset / dummy API data
- Flask matching API
- The main data flow is user input → frontend validation → matching API or fallback data → search/swipe/modal/wishlist presentation.
Main entry points: wishlist.js Wishlist logic · auth.js Auth · search.js Search logic · swipe.js Swipe logic
Components 20
Browser pages
Standalone HTML entry points for public, protected, and discovery flows.
- Landing · Public home page.
index.html - Login · Authentication entry page.
login.html - Dashboard · Protected overview page.
dashboard.html - Profile · Saved profile input for matching.
profile.html - Find · Ephemeral matching flow for another person.
find.html - Search · Scheme browsing and filtering page.
search.html - Swipe · Matched-scheme swipe interaction page.
swipe.html - Wishlist · Saved schemes shortlist page.
wishlist.html
Client modules
Browser-side JavaScript features and shared UI logic.
- Auth · Local sign-in state and auth overlay.
js/auth.js - API · Backend calls and local fallback routing.
js/api.js - Form · Profile validation and submission logic.
js/form.js - Search logic · Keyword search, highlighting, and filtering.
js/search.js - Swipe logic · Card swipe interactions and match handling.
js/swipe.js - Wishlist logic · Saved-scheme rendering and management.
js/wishlist.js - Detail modal · Reusable scheme detail overlay.
js/modal.js - Shared utils · Common browser helpers used across features.
js/utils.js
Data and state
Local browser state, bundled scheme data, and fallback response data.
- Dummy data · Mock API responses used when backend access is unavailable.
js/dummyData.js - Scheme data · Local scheme catalog used for search and matching content.
data/schemes_schemesetu_v3.json - Local storage · Client-persisted auth and user-facing state.
Backend service
Flask API boundary for scheme matching.
- Flask app · Scheme matching API boundary.
app.py
Connections 26
- Landing → Login: entry to auth · Public users move from landing into authentication.
- Login → Auth: auth UI · Login page is driven by local auth state and overlay logic.
- Dashboard → Auth: protects access · Protected pages use browser-side auth gating.
- Profile → Auth: protects access · Profile page is gated by local authentication.
- Find → Auth: protects access · Find flow is guarded in the browser.
- Search → Search logic: search UI · Search page delegates filtering and highlighting to the search module.
- Swipe → Swipe logic: swipe UI · Swipe page uses the swipe interaction module.
- Wishlist → Wishlist logic: wishlist UI · Wishlist page renders saved items through the wishlist module.
- Profile → Form: submit profile · Profile data is validated and prepared for matching.
- Find → Form: submit profile · Ephemeral find flow also uses the shared form pipeline.
- Form → API: match request · Validated profile data is sent to the matching API layer.
- API → Flask app: POST match · Backend receives the matching request.
- API → Dummy data: fallback data · Client can switch to mock responses when the backend is unavailable.
- Search logic → Scheme data: browse catalog · Search/filtering works over the local scheme dataset or derived data.
- Swipe logic → Detail modal: open details · Swipe cards can reveal scheme details in the shared modal.
- Search logic → Detail modal: open details · Search results reuse the shared detail overlay.
- Wishlist logic → Detail modal: view details · Wishlist items open in the same detail modal.
- Swipe logic → Wishlist logic: save item · Swiped-saved schemes flow into the shortlist.
- Auth → Local storage: persist auth · Authentication state is stored in the browser.
- Wishlist logic → Local storage: persist saved · Saved schemes are kept in local browser state.
- Form → Shared utils: shared helpers · Form handling uses common utility functions.
- Search logic → Shared utils: shared helpers · Search feature reuses browser helpers.
- Swipe logic → Shared utils: shared helpers · Swipe interactions reuse common utilities.
- Wishlist logic → Shared utils: shared helpers · Wishlist rendering reuses common utilities.
- Flask app → Scheme data: match against · Backend matching logic consumes the scheme dataset.
- Flask app → Local storage: none · No direct server-side state persistence; client state remains local.