How sawlachintan/whoismyneta works
Main Components
• Client (Browser): Represents the end-user’s browser where the SvelteKit-generated UI is rendered.
• SvelteKit Application Server: The core server-side engine that handles routing, SSR (Server-Side Rendering), and serves Svelte components from the src/routes and src/lib directories.
• UI Components: A set of Svelte components (e.g., CandidateCard, Constituency, Header, Map, etc.) found in src/lib/components. Show these as a grouped UI “module” within the SvelteKit app.
• Data Layer: Static data files (JSON and GeoJSON) in the src/lib/data directory that power visualizations and content. Also mention external datasets (from MyNeta, PRS India, and the Lok Sabha shapefile) as integration points.
• Edge Functions (Netlify): Indicate the netlify/edge-functions directory (for example, geolocation.ts) that manages serverless functions at the network edge, perhaps for localized content or authentication purposes.
• Configuration and Deployment: Include representations for configuration files (svelte.config.js, tailwind.config.js, vite.config.js, etc.) and deployment settings (netlify.toml and associated Netlify directories) that govern the build and hosting environment.
• Internationalization: Use components like the messages directory and inlang configuration files indicating support for multiple languages.
Relationships and Interactions
• Inside the application, routing logic (under src/routes) loads various Svelte components (in src/lib/components) which in turn may consume static data (from src/lib/data) to render charts, maps, candidate details, etc.
Architectural Patterns and Design Principles
• Client-Server (SvelteKit SSR): Emphasize the separation between the client (browser UI) and SvelteKit backend logic.
• Component-Based UI: Highlight the modularity provided by Svelte components under src/lib/components.
• Static vs. Dynamic Content: Show how some content is served dynamically (via SSR/edge functions) while other content (the dataset JSON files) is static.
• Internationalization: Note that translation and localization files are part of the system (messages/ and inlang configuration).
• Clear labels for each of the components (Client Browser, SvelteKit Application, UI Components Group, Data Layer, Edge Functions, Deployment/Configuration).