How naveenxyz/rides works
Project Type and Purpose
• BangaRide is a full-stack web application: a React/TypeScript single-page frontend served via Vite (and optionally Nginx/Docker) and a NestJS/TypeORM backend exposing a REST API, persisting data to PostgreSQL.
• It provides spot discovery, trip planning, user authentication (Google OAuth + JWT), commenting, rating, and trip-completion tracking for motorcycle enthusiasts in Bangalore.
File Structure
• Top level:
• Frontend: index.html, src/, public config files (tailwind.config.js, postcss.config.js, vite.config.ts).
• Backend (“server” folder): NestJS modules under server/src (auth, users, spots, trips, comments), TypeORM entities, main.ts, server package/config files.
• Deployment/config: Dockerfile, docker-compose.yml, nginx.conf, .env templates.
• Architectural hints: monolithic NestJS backend organized by feature modules (Auth, Users, Spots, Trips, Comments), React context for global auth state, React Router for pages.
Main Components
a. Client Browser & UI Layer
• React SPA (App.tsx, pages/, components/, Tailwind for styling).
• Communicates via HTTP/HTTPS to backend API.
b. Reverse Proxy / Static Server (optional)
• Nginx (nginx.conf) or Vite dev server serves static assets and proxies API calls to NestJS.
c. API Layer (NestJS Backend)
• Auth Module: Google OAuth (Passport.js strategies), JWT issuance/validation, guard + custom decorators.
• Feature Modules: Users, Spots, Trips, Comments. Each has Controller → Service → Entity (via TypeORM).
d. Data Layer
• PostgreSQL database managed via TypeORM entities (user, spot, trip, comment).
e. External Service
• Google OAuth endpoints for user authentication.
Relationships and Interactions
• User → Browser/UI: interacts with pages (login, browse spots/trips, comment, rate).
• UI → Nginx/Vite Server: fetches static assets; API calls routed to backend (e.g., GET /api/spots).
• Backend → DB: TypeORM executes SQL queries against PostgreSQL.
• Backend ↔ Google OAuth: Passport.js strategy calls Google for login → callback → JWT issuance.
• UI ↔ Backend: includes JWT in Authorization headers for protected endpoints.
Architectural Patterns and Design Principles
• Separation of Concerns: frontend UI vs. backend API vs. database.
• Modular monolith in backend: feature modules in NestJS (Auth, Users, Spots, Trips, Comments).
• Layered architecture in backend: Controllers (HTTP endpoints) → Services (business logic) → Repositories/entities (data access).
• Token-based stateless authentication: JWT tokens signed/verified per request.
• Externalized configuration: .env files for both frontend and backend.
Key Technologies and Frameworks
• Frontend: React, React Router, TypeScript, Vite, Tailwind CSS, Lucide React, Context API for auth, Axios or fetch in api.ts.
• Backend: NestJS, TypeORM, PostgreSQL, Passport.js (Google OAuth strategy), JWT.
• DevOps/Deployment: Docker, docker-compose, Nginx.
Final Checklist
• Notes on environment/config (.env for secrets, variables).