d516e93323
- Proactive Grok integration (xAI API + local CLI fallback) - Real road routing via OSRM (no more bird's-eye lines) - Heavy structured logging for fast iteration - Strong sanitization + geocoding + ErrorBoundary (no black screens) - Playwright E2E tests (API diagnostic + full UI flow) - scripts/dev.sh for one-command startup - Clean .env.example + documentation This is a stable checkpoint before further prompt/UI refinement.
109 lines
2.6 KiB
Markdown
109 lines
2.6 KiB
Markdown
# Tesla Roadtrip — Grok-Powered Planner (UK & Europe First)
|
||
|
||
Beautiful split-pane Tesla trip planner.
|
||
|
||
**Left side**: Natural language chat with Grok Drive (powered by the real xAI Grok API)
|
||
**Right side**: Interactive Leaflet map + live itinerary that updates as you talk
|
||
|
||
## First Release Focus
|
||
|
||
- United Kingdom
|
||
- Europe (France, Germany, Benelux, Switzerland, Spain)
|
||
|
||
## Key Features
|
||
|
||
- Real Grok intelligence via the xAI API
|
||
- Excellent Supercharger coverage awareness across the UK & Europe
|
||
- Metric units (km, Wh/km)
|
||
- Proactive route planning — just say where you want to go
|
||
- Safe, restricted tool use
|
||
|
||
## Tech Stack
|
||
|
||
- Vite + React + Tailwind + Leaflet (client)
|
||
- Express + Prisma + pino (server)
|
||
- Real xAI Grok API (with local `grok` CLI as optional path)
|
||
- Heavy structured logging for fast debugging
|
||
|
||
## Local Development
|
||
|
||
### 1. Install dependencies
|
||
|
||
```bash
|
||
npm install
|
||
cd client && npm install && cd ..
|
||
```
|
||
|
||
### 2. Set up environment variables
|
||
|
||
```bash
|
||
cp .env.example .env
|
||
```
|
||
|
||
Then edit `.env` and add your xAI API key:
|
||
|
||
```env
|
||
XAI_API_KEY=xai-YourKeyHere
|
||
```
|
||
|
||
You can get a key from: https://console.x.ai
|
||
|
||
### 3. Start the development environment
|
||
|
||
You have two options:
|
||
|
||
**Option A (Recommended)** – Better developer experience:
|
||
|
||
```bash
|
||
./scripts/dev.sh
|
||
```
|
||
|
||
**Option B** – Using npm:
|
||
|
||
```bash
|
||
npm run dev
|
||
```
|
||
|
||
Both commands will start:
|
||
- **Backend**: http://localhost:3000 (with detailed logging)
|
||
- **Frontend**: http://localhost:5173
|
||
|
||
### 4. Open the app
|
||
|
||
Visit: **http://localhost:5173**
|
||
|
||
---
|
||
|
||
## Useful Commands
|
||
|
||
| Command | Description |
|
||
|------------------------|------------------------------------------|
|
||
| `npm run dev` | Start both frontend and backend |
|
||
| `./scripts/dev.sh` | Recommended way to start (better output) |
|
||
| `npm run dev:server` | Start only the backend |
|
||
| `npm run dev:client` | Start only the frontend |
|
||
|
||
---
|
||
|
||
## Security & Philosophy
|
||
|
||
This project follows a strict security policy:
|
||
- No packages with known active critical or high vulnerabilities
|
||
- `react-markdown` / remark ecosystem avoided (LLM output sanitization via DOMPurify)
|
||
- All AI tool use is heavily restricted
|
||
- Maximum logging so we can debug the "chat → route → stops" flow easily
|
||
|
||
## Deployment Target
|
||
|
||
Will be deployed via Dokku on Hetzner with Gitea CI.
|
||
|
||
First launch target: United Kingdom & Europe.
|
||
|
||
---
|
||
|
||
## Need Help?
|
||
|
||
- Make sure your `XAI_API_KEY` is set (otherwise you'll get very basic responses)
|
||
- Check the backend terminal — it has extremely detailed logs
|
||
- The app is designed so you can iterate quickly by watching the logs
|