How anshitsharma05/routenest works
RouteNest is split into two clear runtime boundaries: a React/Vite single-page app in routenest/ and an Express API server in server/. The frontend owns navigation, page rendering, and auth-gated UX; the backend owns data access, AI calls, file upload handling, and authorization enforcement.
The frontend entry point is src/main.jsx, which mounts App.jsx and the global styles in src/index.css / src/App.css. The app shell includes a shared Navbar.jsx and a page-level route structure for LandingPage, Dashboard, ItineraryGen, NewDiary, Recommendations, Community, and SharedItinerary. Those pages represent the main user journeys rather than a single generic CRUD interface.
Client-to-server communication is concentrated behind src/apiConfig.js, which likely centralizes the API base URL used by page components. The repo uses Axios on the client side, so data flow is request/response oriented rather than state-synced or websocket-driven.
Authentication is split intentionally. On the frontend, Clerk gates the user experience with signed-in/signed-out states before users reach protected pages. On the backend, @clerk/express validates bearer tokens again, so the API does not trust the browser for authorization. This is the main security boundary in the system.
The backend is organized by domain routes in server/routes/: itineraries.js, memories.js, communities.js, recommendations.js, upload.js, and public.js. That suggests a resource-based REST design where each route module handles one bounded capability rather than a monolithic controller.
Supabase is the persistence layer, and server/lib/supabase.js is the shared integration point. The SQL files supabase_schema.sql and supabase_community_schema.sql define the database shape, including personal travel memories, generated itineraries, communities, posts, comments, and votes. Supabase also serves as the file store for uploaded images, so media and relational data live in separate subsystems but are linked by stored URLs.
The travel memory flow is: a signed-in user creates a diary entry in the frontend, the API validates the Clerk identity, then the server writes metadata to Supabase and uploads photos through the storage layer. The upload.js route and test-upload2.js indicate image handling is a first-class path, and Multer is used in-memory so uploads do not touch local disk.
The itinerary and recommendation flow is AI-driven. The backend is the only layer that can talk to Google Gemini via @google/genai, which keeps the API key off the client and lets the server return cleaned Markdown content for display in the React UI. The recommendations and itineraries routes are the likely handoff points for this intelligence layer.
The community subsystem is the most relational part of the app. communities, community_posts, community_comments, and community_post_votes form the core data model, supporting anonymous posting, threaded discussion, and one-vote-per-user behavior. The README’s pseudonym scheme implies the server derives stable anonymous display names from Clerk identities before storing or rendering community activity.
Public sharing is modeled as a separate read-only boundary. The public.js route and the SharedItinerary page imply that a private itinerary can be exposed through a public URL without granting full account access, so the architecture distinguishes internal ownership from externally shareable content.
Deployment and build tooling are straightforward but important: the frontend uses Vite with a Vercel config, while the backend is a standalone Node process with Express. ESLint is present in the frontend, and the test scripts in server/ show some operational checks around Supabase and upload integration.
In diagram form, the main thing to capture is this flow: browser SPA pages → Axios → Express route modules → Clerk auth check → Gemini and/or Supabase → JSON or stored media returned to the UI. The repo is architected around that separation of concerns, with each feature mapped cleanly to a route, a database shape, and a corresponding page in the client.
Main entry points: App.jsx App Shell · supabase.js Supabase Client · index.js Server Entry · apiConfig.js API Config
Components 23
Frontend SPA
React/Vite client that renders pages, gates UX, and calls the API.
- Entry · Mounts the SPA and global styles.
routenest/src/main.jsx - App Shell · Top-level client shell and routing container.
routenest/src/App.jsx - Navbar · Shared navigation across the SPA.
routenest/src/components/Navbar.jsx - API Config · Central Axios/API base configuration.
routenest/src/apiConfig.js - Landing · Public entry and sign-in oriented landing page.
routenest/src/pages/LandingPage.jsx - Dashboard · Authenticated home and overview screen.
routenest/src/pages/Dashboard.jsx - Itinerary · UI for generating or viewing itineraries.
routenest/src/pages/ItineraryGen.jsx - Diary · Creates personal travel memories with uploads.
routenest/src/pages/NewDiary.jsx - Recommendations · Displays AI-assisted travel recommendations.
routenest/src/pages/Recommendations.jsx - Community · Community feed and discussion interface.
routenest/src/pages/Community.jsx - Shared Itinerary · Public read-only itinerary sharing view.
routenest/src/pages/SharedItinerary.jsx
API Server
Express service that enforces auth, handles routes, uploads, and AI/persistence access.
- Server Entry · Bootstraps the API process and route mounting.
server/index.js - Itineraries · Handles itinerary generation and retrieval.
server/routes/itineraries.js - Memories · Handles diary entries and memory metadata.
server/routes/memories.js - Communities · Handles community posts, comments, and votes.
server/routes/communities.js - Reco API · Serves AI-backed recommendation responses.
server/routes/recommendations.js - Upload · Handles in-memory image upload flows.
server/routes/upload.js - Public · Serves read-only public itinerary access.
server/routes/public.js - Gemini · Server-side generative model integration.
Data Layer
Supabase-backed persistence, schemas, and storage integration.
- Supabase Client · Shared Supabase integration used by routes.
server/lib/supabase.js - Core Schema · Supabase schema for itineraries and memories.
server/supabase_schema.sql - Community Schema · Supabase schema for communities and social data.
server/supabase_community_schema.sql
Auth Boundary
Clerk-based identity checks on both client and server.
- Clerk Auth · Browser and API identity boundary.
Connections 37
- Entry → App Shell: mounts · SPA entry mounts the application shell.
- App Shell → Navbar: uses · Shell renders shared navigation.
- App Shell → Landing: routes · Public landing page is part of the client route structure.
- App Shell → Dashboard: routes · Authenticated dashboard is part of the client route structure.
- App Shell → Itinerary: routes · Itinerary generation/view page is part of the client route structure.
- App Shell → Diary: routes · Diary creation page is part of the client route structure.
- App Shell → Recommendations: routes · Recommendations page is part of the client route structure.
- App Shell → Community: routes · Community page is part of the client route structure.
- App Shell → Shared Itinerary: routes · Shared itinerary page is part of the client route structure.
- Landing → Clerk Auth: sign-in · Landing page participates in auth-gated UX.
- Dashboard → Clerk Auth: gates · Protected client experience depends on Clerk state.
- Itinerary → API Config: calls · Uses centralized API client settings.
- Diary → API Config: calls · Uses centralized API client settings.
- Recommendations → API Config: calls · Uses centralized API client settings.
- Community → API Config: calls · Uses centralized API client settings.
- Shared Itinerary → API Config: calls · Uses centralized API client settings.
- Server Entry → Itineraries: mounts · Main server registers itinerary routes.
- Server Entry → Memories: mounts · Main server registers memory routes.
- Server Entry → Communities: mounts · Main server registers community routes.
- Server Entry → Reco API: mounts · Main server registers recommendation routes.
- Server Entry → Upload: mounts · Main server registers upload routes.
- Server Entry → Public: mounts · Main server registers public routes.
- Itineraries → Clerk Auth: verifies · API validates bearer identity before returning data.
- Memories → Clerk Auth: verifies · API validates bearer identity before returning data.
- Communities → Clerk Auth: verifies · API validates bearer identity before returning data.
- Reco API → Clerk Auth: verifies · API validates bearer identity before returning data.
- Upload → Clerk Auth: verifies · API validates bearer identity before returning data.
- Public → Clerk Auth: checks · Public access is separated from private ownership.
- Itineraries → Gemini: generates · Itinerary content is AI-assisted on the server.
- Reco API → Gemini: generates · Recommendation content is AI-assisted on the server.
- Itineraries → Supabase Client: reads/writes · Persists itinerary data through Supabase.
- Memories → Supabase Client: reads/writes · Persists diary metadata and related records.
- Communities → Supabase Client: reads/writes · Persists community posts, comments, and votes.
- Upload → Supabase Client: stores · Stores upload metadata and storage references.
- Public → Supabase Client: reads · Loads public itinerary content for sharing.
- Supabase Client → Core Schema: implements · Adapter targets the core Supabase schema.
- Supabase Client → Community Schema: implements · Adapter targets the community schema.