Skip to content

Commit a001fc7

Browse files
committed
README
1 parent bf9c7f7 commit a001fc7

1 file changed

Lines changed: 10 additions & 158 deletions

File tree

replit.md

Lines changed: 10 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,16 @@
1-
# GPS Signal Visualizer
1+
# DIMO Build Developer Kit
22

33
## Overview
44

5-
This is a GPS Signal Visualizer application that provides real-time GPS accuracy mapping with interactive controls. The application allows users to visualize GPS signals with adjustable coordinates and HDOP (Horizontal Dilution of Precision) values, displaying accuracy circles on an interactive map using Leaflet. Users can input GPS coordinates manually or select from predefined test scenarios representing different signal conditions (vehicle offline, urban garage, open road, etc.).
5+
This is a Replit template for running an app that integrates [Login with DIMO](https://www.npmjs.com/package/@dimo-network/login-with-dimo) and [DIMO Data SDK](https://www.npmjs.com/package/@dimo-network/data-sdk).
66

7-
## User Preferences
7+
## Quick Start
88

9-
Preferred communication style: Simple, everyday language.
10-
11-
## System Architecture
12-
13-
### Frontend Architecture
14-
- **React with TypeScript**: Single-page application built with React 18 and TypeScript for type safety
15-
- **Vite**: Modern build tool for fast development and optimized production builds
16-
- **Wouter**: Lightweight client-side routing library for navigation
17-
- **TanStack Query**: Server state management for API calls and caching
18-
- **Tailwind CSS**: Utility-first CSS framework for styling
19-
- **Shadcn/ui**: Pre-built component library based on Radix UI primitives
20-
- **Leaflet**: Interactive mapping library for GPS visualization
21-
22-
### Backend Architecture
23-
- **Express.js**: Node.js web framework serving REST API endpoints
24-
- **TypeScript**: Type-safe server-side development
25-
- **In-memory storage**: Simple storage implementation using Maps for development/testing
26-
- **Drizzle ORM**: Database ORM configured for PostgreSQL (schema defined but using memory storage currently)
27-
28-
### Component Structure
29-
- **GPS Controls**: Input forms for latitude, longitude, and HDOP values with test scenario buttons
30-
- **GPS Map**: Interactive Leaflet map displaying GPS coordinates with accuracy circles
31-
- **GPS Status**: Status indicator showing signal quality based on HDOP values (No GPS, Poor GPS, Good GPS)
32-
33-
### API Endpoints
34-
- `POST /api/gps`: Save new GPS data
35-
- `GET /api/gps/latest`: Retrieve the most recent GPS reading
36-
- `GET /api/gps`: Retrieve all GPS data
37-
- `GET /api/gps/test-scenarios`: Get predefined test scenarios
38-
39-
### Data Models
40-
- **GPS Data**: Contains latitude, longitude, HDOP value, and timestamp
41-
- **User**: Basic user structure with username and password (prepared for future authentication)
42-
43-
### Development Features
44-
- **Hot Module Replacement**: Fast development with Vite HMR
45-
- **Runtime Error Overlay**: Development error handling
46-
- **TypeScript Path Mapping**: Organized imports with @ aliases
47-
48-
## External Dependencies
49-
50-
### Core Technologies
51-
- **Node.js**: JavaScript runtime environment
52-
- **PostgreSQL**: Database system (configured via Drizzle but not actively used)
53-
- **Neon Database**: Serverless PostgreSQL provider (connection configured)
54-
- **DIMO SDK**: Vehicle data integration with ES module compatibility wrapper
55-
56-
### Frontend Libraries
57-
- **Radix UI**: Headless component primitives for accessible UI components
58-
- **Leaflet**: Open-source mapping library for interactive maps
59-
- **React Hook Form**: Form handling with validation
60-
- **date-fns**: Date manipulation utilities
61-
- **Zod**: Schema validation for type-safe data parsing
62-
63-
### Development Tools
64-
- **ESBuild**: Fast JavaScript bundler for production builds
65-
- **PostCSS**: CSS processing with Tailwind and Autoprefixer
66-
- **Drizzle Kit**: Database migration and schema management tools
67-
68-
### Maps and Tiles
69-
- **OpenStreetMap**: Tile provider for map visualization
70-
- **Leaflet CDN**: External CSS and marker icons
71-
72-
### Session Management
73-
- **connect-pg-simple**: PostgreSQL session store (configured for future use)
9+
1. Remix this Replite Template
10+
2. Update secrets with your own DIMO Developer License credentials, if you don't have these credentials, sign up on the [DIMO Developer Console](https://console.dimo.org):
11+
- Client ID: `DIMO_CLIENT_ID` & `VITE_DIMO_CLIENT_ID`
12+
- Redirect URI: `DIMO_REDIRECT_URI` & `VITE_DIMO_REDIRECT_URI`
13+
- API Key: `DIMO_API_KEY`
7414

7515
## Deployment Configuration
7616

@@ -95,93 +35,5 @@ Preferred communication style: Simple, everyday language.
9535
- Port configuration via `PORT` environment variable (defaults to 5000)
9636
- Static files must be properly copied to `server/public` before starting production server
9737

98-
### Recent Changes (August 2025)
99-
- Fixed deployment configuration issues preventing production builds from serving static files correctly
100-
- Created production build script that properly handles file structure requirements
101-
- Verified host binding and port configuration for deployment compatibility
102-
- **ES Module Compatibility Fix (August 8, 2025)**: Applied comprehensive fixes for DIMO SDK deployment issues
103-
- Created DIMO SDK wrapper (`server/dimo-wrapper.ts`) to handle problematic directory imports
104-
- Updated esbuild configuration with proper external dependencies and bundling strategy
105-
- Implemented graceful fallback for DIMO SDK import failures with proper error messaging
106-
- Verified production build and server startup without ES module crashes
107-
- **DIMO Token Exchange Integration (August 8, 2025)**: Implemented complete DIMO authentication and vehicle telemetry flow
108-
- Added DIMO Identity API integration to query vehicles shared with app's Client ID using GraphQL
109-
- Implemented Developer JWT and Vehicle JWT token exchange using getDeveloperJwt and getVehicleJwt functions
110-
- Created real-time vehicle location endpoint using DIMO Telemetry API with signalsLatest GraphQL query
111-
- Built frontend UserVehicles component showing shared vehicles with permissions and location fetch buttons
112-
- Integrated vehicle location data directly into GPS visualization system for seamless map updates
113-
- Added proper error handling for missing vehicles, invalid tokens, and API failures
114-
- Configured DIMO_API_KEY environment variable for secure authentication with DIMO services
115-
- **API Endpoint Correction (August 8, 2025)**: Fixed vehicle fetching API to use proper GraphQL query format
116-
- Corrected API endpoint from /api/dimo/shared-vehicles to /api/dimo/vehicles with Authorization Bearer token
117-
- Updated getUserVehicles function to use Identity API GraphQL query with filterBy: { privileged, owner }
118-
- Fixed service layer to properly query vehicles owned by user and privileged to DIMO Client ID
119-
- Successfully verified API returns user's 2 vehicles: Toyota Camry 2025 (tokenId 180895), Lexus NX 2021 (tokenId 117315)
120-
- **JWT Caching & Expiration Management (August 8, 2025)**: Implemented comprehensive JWT lifecycle management
121-
- Added Developer JWT caching with 14-day expiration (cached for 13 days with 1-hour safety margin)
122-
- Added Vehicle JWT caching with 10-minute expiration (cached for 9 minutes with 1-minute safety margin)
123-
- Implemented automatic JWT cleanup every 5 minutes to remove expired tokens
124-
- Added try-catch blocks for JWT failures with automatic cache invalidation on errors
125-
- Optimized API performance by reusing valid cached JWTs instead of fetching new ones unnecessarily
126-
- **Wallet Address Caching & Persistent Auth (August 8, 2025)**: Implemented authentication state persistence
127-
- Created `useCachedDimoAuth` hook to manage wallet address caching in localStorage
128-
- Authentication persists across browser sessions and page reloads using cached wallet address
129-
- Automatic cache invalidation when user explicitly logs out via LogoutWithDimo component
130-
- Visual indicators show when authentication is from cache vs. live DIMO SDK state
131-
- Seamless integration with existing vehicle query system - cached auth enables vehicle display
132-
- Cache keys: `dimo_cached_wallet_address` and `dimo_cached_email` stored in localStorage
133-
- **Real DIMO Data-SDK Integration (August 12, 2025)**: Removed mock wrapper and implemented authentic DIMO SDK
134-
- Replaced mock `dimo-wrapper.ts` with real `@dimo-network/data-sdk` implementation
135-
- Updated authentication flow to use proper `getDeveloperJwt()` and `tokenexchange.exchange()` methods
136-
- Implemented GraphQL queries for vehicle identity and telemetry data using actual DIMO API structure
137-
- Fixed vehicle location endpoint to use real JWT authentication with proper privileges [1, 3, 4]
138-
- All API calls now use authentic DIMO Production environment with valid API keys
139-
- Enhanced error handling and logging for real API interactions
140-
- **DIMO SDK Update to v1.3.2 (August 13, 2025)**: Updated to latest DIMO data-sdk version
141-
- Upgraded from previous version to @dimo-network/data-sdk@1.3.2 with latest features
142-
- Migrated to preferred `getVehicleJwt()` function for simplified Vehicle JWT exchange
143-
- Maintained compatibility with existing authentication flow and API structure
144-
- Enhanced with latest SDK improvements including streamlined token exchange and better error handling
145-
- **Token-Based Authentication & Caching System (August 13, 2025)**: Implemented comprehensive token caching
146-
- Fixed wallet address caching in localStorage using `dimo_cached_wallet_address` and `dimo_cached_token` keys
147-
- Updated `handleShareSuccess` to extract and cache `walletAddress` and `token` directly from authData
148-
- Modified API endpoints to use cached token as Bearer authorization header instead of wallet address
149-
- Updated `/api/dimo/vehicles` to accept token in Authorization header and walletAddress as URL parameter
150-
- Simplified `/api/dimo/vehicles/:id/location` to only require cached token (removed wallet parameter)
151-
- Enhanced storage event system for immediate UI updates after successful authentication
152-
- Fixed TypeScript errors and improved error handling for missing cached tokens
153-
- **UI/UX Improvements & Spotify Integration (August 14, 2025)**: Enhanced interface and added music service integration
154-
- Made DIMO logo more responsive and visible (increased from h-6/h-8 to h-8/h-10)
155-
- Reduced "Login with DIMO" button size with smaller text (text-xs) and compact padding (px-2 py-1)
156-
- Installed Spotify TypeScript SDK (@spotify/web-api-ts-sdk) for music integration capabilities
157-
- Created comprehensive Spotify service (`server/spotify-service.ts`) with client credentials authentication
158-
- Implemented Spotify API test functionality searching for "The Beatles" to verify connection
159-
- Added `/api/spotify/test` endpoint for API validation and testing
160-
- Successfully tested Spotify API with full artist search results including popularity, images, and metadata
161-
- Removed GPS Status, GPS Controls, and Test Scenarios components for cleaner interface
162-
- Streamlined application to focus on vehicle location tracking and vehicle management
163-
- **DriveTunes Rebranding & Layout Optimization (August 14, 2025)**: Complete rebrand with improved responsive design
164-
- Replaced DIMO branding with DriveTunes logo (DriveTunes_Logo.png) and removed old DIMO assets
165-
- Increased logo size by 20% with responsive scaling (h-10/h-12/h-16) and expanded header height to h-20
166-
- Removed subtitle and updated app title to "DriveTunes" with "Spotify playlists based on your drive" concept
167-
- Restructured desktop layout: 50% vehicle panel (left), 50% map (right) using lg:grid-cols-2 instead of lg:grid-cols-4
168-
- Added Current/Last Week buttons under each vehicle: "Current" shows current location, "Last Week" placeholder
169-
- Implemented clickable map pins functionality - users can click anywhere on map to drop custom red markers
170-
- Enhanced vehicle cards with grid layout for action buttons (Current/Last Week) with compact styling (text-xs)
171-
- **Enhanced Map Pin System & Vehicle History Integration (August 14, 2025)**: Improved user interaction and data visualization
172-
- Implemented single-pin map system: only one user-dropped pin exists at a time, previous pins are automatically removed
173-
- Added automatic map refocusing when new pins are dropped for better user experience
174-
- Created GPS signal toggle: GPS dots and accuracy circles are hidden when manual pins are active
175-
- Connected "Current" button to clear user pins and restore GPS vehicle tracking seamlessly
176-
- Integrated "Last Week" button with `fetchCurrentVehicleHistory` function and `getVehicleWeeklyHistory` server endpoint
177-
- Added proper loading states and error handling for both current location and historical data fetching
178-
- Enhanced user feedback with toast notifications showing data fetch results and historical data counts
179-
- **Spotify PKCE Authentication Integration (August 14, 2025)**: Implemented secure user-based Spotify authentication
180-
- Created SpotifyPlaylistGenerator component positioned under My Shared Vehicles section on left panel
181-
- Migrated from client credentials to Spotify PKCE (Proof Key for Code Exchange) authorization flow for enhanced security
182-
- Implemented complete OAuth 2.0 PKCE flow with code verifier/challenge generation using Web Crypto API
183-
- Added backend PKCE endpoints: `/api/spotify/config`, `/api/spotify/callback`, `/api/spotify/exchange`, `/api/spotify/profile`
184-
- Built user-specific Spotify client management with token caching and automatic refresh capabilities
185-
- Enhanced frontend with localStorage-based session persistence and automatic callback handling
186-
- Added proper error handling throughout authentication flow with user-friendly toast notifications
187-
- Updated UI to show connected state with user profile information and placeholder for future playlist generation
38+
## Source
39+
This template is based on the using DIMO's Developer SDKs. For more information, visit https://docs.dimo.org/developer-platform/developer-guide/dimo-developer-sdks

0 commit comments

Comments
 (0)