How ron-avital29/run_app works
Project type and purpose
• This is a full-stack, cross-platform mobile application built with Expo/React Native (using the Expo Router file-based routing conventions).
• It provides runners with AI-generated routes, Google Maps integration, user authentication, route saving/scheduling, and history tracking.
• The backend is comprised of serverless API routes (written in TypeScript) that handle data persistence and orchestrate external services.
File structure
• Top-level directories:
• app/ – Expo Router screens and API routes
◦ (root) – main user-flow screens (tabs, choose‐run, run route)
◦ (auth) – sign-in, sign-up, welcome screens
◦ (api) – +api.ts(x) files defining serverless endpoints (add_route, get_route, user, etc.)
◦ +html.tsx, +not-found.tsx, _layout.tsx – global wrappers
• components/ – reusable UI components (Map, RunCard, FormGoogleText, etc.)
• lib/ – business logic utilities (auth helpers, fetch wrapper, circle & line algorithms)
• store/ – global state management (Redux or Zustand)
• constants/, types/ – shared constants and TypeScript types
• config files – babel, metro, tailwind, tsconfig, PostCSS
• Testing: __tests__ covers API, screens, components, lib, store
• Env injection for API keys (.env with Clerk, DB, Google, AI, mapping/weather keys)
README for insights
• Tech stack: Expo/React Native, TypeScript, Clerk (auth), Neon (PostgreSQL), Jest, AI-chatbot services, Google Maps, Geoapify, OpenWeather, OpenRouter.
• Features reiterate separation: frontend UI, AI orchestration, data persistence, map rendering.
1. Mobile Client (Expo/React Native)
– Screens: authentication, home, chat, runs, profile, route planning
– UI components library
– State store (store/index.ts)
– Client-side algorithms (circle & line) and fetch wrapper
2. API Layer (serverless functions under app/(api))
– Route management endpoints (add, delete, edit, list)
– User endpoint (auth callback, profile fetch)
– “update_recent”, “toggle_save” functions
3. Database (Neon/PostgreSQL)
– Tables: users, routes, saved_routes, scheduled_routes, recent_routes
4. Authentication Service (Clerk)
– Token issuance, user identity management
5. External Services
– AI Chatbot APIs (6 different endpoints)
– Google Maps API (for client map rendering & geocoding)
– Geoapify / OpenWeather / OpenRouter (weather, routing adjustments)
• Mobile Client → API Layer (HTTPS/JSON) to perform CRUD on routes, fetch user data
• API Layer → Database (SQL queries via Neon client)
• API Layer → Clerk (validate tokens, fetch user profiles)
• API Layer ↔ External AI APIs (HTTP) to generate optimized routes
• Mobile Client → Google Maps SDK (JS/native bridge) to render maps and directions
• Mobile Client ↔ External weather/geocoding services for on-device fetches or via API
c. Architectural patterns & design principles:
• File-system routing (Expo Router) for both UI and API
• Serverless functions for scalability and zero-server-management
• Separation of concerns: UI, business logic (lib), state (store), data access (API)
• Reusable components and theme management (MapThemes, tailwind/nativewind)
d. Key technologies and libraries:
• Expo/React Native & Expo Router
• TypeScript, Jest (testing)
• Clerk (auth), Neon (DB)
• Google Maps SDK, Geoapify, OpenWeather, OpenRouter
• NativeWind (TailwindCSS), Metro bundler, Babel
Don’t overthink—be exhaustive in component separation
• Out each directory’s responsibility as a sub-component
• Six AI services, map themes, and utility libraries are visible