https://github.com/barkprotocol/tesla-dashboard-ui-ux
A real-time Tesla vehicle dashboard integrated with the Solana blockchain, featuring $BARK token utilities, NFT customization, wallet integration, and XP-based rewards for driving, staking, and more.
https://github.com/barkprotocol/tesla-dashboard-ui-ux
Last synced: 5 months ago
JSON representation
A real-time Tesla vehicle dashboard integrated with the Solana blockchain, featuring $BARK token utilities, NFT customization, wallet integration, and XP-based rewards for driving, staking, and more.
- Host: GitHub
- URL: https://github.com/barkprotocol/tesla-dashboard-ui-ux
- Owner: barkprotocol
- License: mit
- Created: 2025-07-31T04:41:04.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-01T05:10:52.000Z (11 months ago)
- Last Synced: 2025-09-11T13:45:25.573Z (10 months ago)
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# π Tesla IoT Dashboard + BARK Protocol
A real-time Tesla dashboard with Solana blockchain integration β combining $AI6 and $BARK token utilities, NFT skin rewards, wallet tracking, staking, APRS/WX packet transmission, SMS alerts, supply chain validation with Pyth, and payments with Solana Pay.

---
## π Key Features
### π Tesla Vehicle Dashboard
- Real-time vehicle state: driving, charging, parked
- GPS trail rendering and interactive trip replay
- Tire pressure, battery %, media playback, climate info
- Cached vehicle state + offline fallback
- API logs and dynamic polling intervals
### π Solana Blockchain Integration
- $BARK SPL Token tracking (BTC, SOL, USDC included)
- Solana wallet connect (Phantom, Backpack, Solflare)
- XP system + Anchor staking contract
- NFT minting via **Metaplex**
- NFT skin selection + Leaderboard
- On-chain triggers using **Solana Actions** and **Dialect Blinks**
- **Solana Pay** QR payment support for NFT skins and dashboard features
### π° APRS-IS Support
- Configurable call sign, WX mode, passcode
- EU APRS-IS packet transmission (position + temperature)
- 30s while driving, 10min idle minimum update interval
### π² Infobip SMS Notifications
- Real-time driver alerts (optional)
- Restrict to βDriving onlyβ or βAlwaysβ
- Message sender ID and API key configurable
- All SMS stored to `data/sms.log`
### π¦ Pyth Oracle Integration
- Real-time Solana-based oracle pricing for:
- $AI6 / $BARK / SOL / USDC tokens
- Vehicle-linked supply chain assets (energy, battery usage)
- Cross-check pricing with on-chain Pyth feeds
- Plug-in ready for AI-driven logistics forecasting
---
## π Architecture
### π§© Frontend: Next.js + Tailwind + TypeScript
| Route | Description |
| ---------- | --------------------------------------------- |
| `/` | Tesla dashboard: vehicle state, XP, portfolio |
| `/config` | APRS, polling, SMS setup, caching |
| `/sms` | SMS message logs |
| `/history` | CSV trip logs + interactive replay map |
| `/vehicle` | Full raw vehicle snapshot |
Components include:
- `WalletConnect`
- `VehicleStatusCard`
- `TripMap`
- `TokenPortfolio`
- `MediaPlayer`
- `Leaderboard`
- `NFTSkinSelector`
### βοΈ Backend: Node.js (Express) + SSE + Solana SDKs
| Endpoint | Description |
| --------------------- | ----------------------------------------- |
| `/api/state` | Current vehicle state (live or cached) |
| `/api/occupant` | Wake vehicle on occupant detection |
| `/api/config` | Save/load APRS, SMS, polling, settings |
| `/stream/:vehicle_id` | Live SSE stream of vehicle data |
| `/apiliste` | List of latest Tesla API variables/values |
Services:
- Tesla Poller: dynamic intervals, offline caching
- Infobip SMS Service
- APRS Packet Sender
- CSV Trip Logger
- Token Metadata Fetcher
- Pyth Oracle Reader
- NFT + Solana Actions + Metaplex Handler
- Anchor staking pool client
---
## π Solana Integration Stack
| Component | Role |
| ------------------------- | ----------------------------------------------------- |
| `@solana/web3.js` | Blockchain interaction (transactions, token balances) |
| `@project-serum/anchor` | XP staking via Anchor contracts |
| `@metaplex-foundation/js` | NFT minting and metadata via Metaplex |
| `@solana/spl-token` | SPL Token management for $BARK, etc. |
| `@solana/pay` | Solana Pay QR code generator and validator |
| `@pythnetwork/client` | Real-time oracle feeds for supply chain validation |
| `@dialectlabs/sdk` | On-chain event + alert triggers via Blinks |
---
## π¦ Project Structure (Monorepo)
```
/apps
βββ frontend
β βββ components/
β βββ hooks/ β π§ Custom React hooks (useVehicleState, useWalletBalance, etc.)
β βββ types/ β π TypeScript shared types (Vehicle, Trip, NFTMetadata, etc.)
β βββ lib/
β β βββ supabase.ts β π¦ Supabase client for trip/session logs
β β βββ solana.ts β π Solana connection, wallet utils
β βββ api/ β π Optional API routes for frontend
β βββ migrations/ β π DB schema changes, if using Supabase CLI
βββ backend
β βββ routes/
β β βββ trip.ts β π POST/GET trip log data
β β βββ mint.ts β πͺ Trigger NFT mint from trip stats
β βββ lib/
β β βββ supabase.ts β π Supabase server SDK
β β βββ types.ts β π Shared backend types
β βββ services/
β βββ db/
β β βββ schema.sql β π§© Supabase SQL migrations
β βββ cron/
β βββ pythPoller.ts β β° Poll Pyth oracle prices periodically
/packages
βββ sdk
β βββ nft/
β βββ staking/
β βββ actions/
βββ utils
βββ energy.ts β β‘ Normalize Tesla energy usage to on-chain logic
βββ token.ts β π° Format SPL token balances
βββ analytics.ts β π Drive stats β NFT metadata or DAO proposal input
````
---
## π¦ Supabase (Postgres) Example
```sql
create table trips (
id uuid primary key default uuid_generate_v4(),
wallet text not null,
distance_km float,
duration_minutes int,
co2_saved_kg float,
metadata jsonb,
created_at timestamp default now()
);
create table payments (
id uuid primary key default uuid_generate_v4(),
wallet text not null,
amount float,
tx_signature text,
created_at timestamp default now()
);
````
---
## βοΈ Environment Variables
### `.env` (Frontend)
```env
NEXT_PUBLIC_SOLANA_NETWORK=devnet
NEXT_PUBLIC_RPC_URL=https://api.devnet.solana.com
NEXT_PUBLIC_MINT_API_URL=https://api.actions.barkprotocol.net/mint
NEXT_PUBLIC_WALLET_ADDRESS=YOUR_WALLET
```
### `.env` (Backend)
```env
PORT=8013
TESLA_API_KEY=mock-or-real-key
SOLANA_NETWORK=devnet
TOKEN_PROGRAM_ID=Tokenkeg...
NFT_PROGRAM_ID=gEb7n...
INFOBIP_API_KEY=your-infobip-key
PYTH_PROGRAM_ID=your-pyth-program
```
---
## π Backend Integrations
### API Endpoints
| Method | Endpoint | Description |
| ------ | ------------- | ----------------------------------------------------------- |
| GET | `/api/trips` | Fetch user driving history |
| POST | `/api/mint` | Mint NFTs with drive-linked metadata |
| GET | `/api/prices` | Read real-time \$BARK / \$AI6 / SOL prices from Pyth oracle |
---
### React Hooks
* `useTripHistory()` β Fetch and manage user trip logs.
* `useMintNFT()` β Mint NFTs with metadata based on driving stats.
* `usePythPrices()` β Subscribe to real-time token price updates.
---
## π§ͺ Local Development
> **Prerequisites:** Node.js >=16, npm/yarn, Supabase CLI (optional)
### Backend
```bash
cd apps/backend
npm install
npm run dev
```
Runs backend API on [http://localhost:8013](http://localhost:8013)
### Frontend
```bash
cd apps/frontend
npm install
npm run dev
```
Runs frontend app on [http://localhost:3000](http://localhost:3000)
---
## π§βπ» Development Setup Prompt
Run this command in your terminal to set up everything quickly:
```bash
# Clone repo, install deps and start all services concurrently
git clone https://github.com/your-org/tesla-bark.git
cd tesla-bark
# Install all packages in monorepo
npm install
# Start frontend and backend concurrently (using `concurrently` or `turbo`)
npm run dev
```
You can customize your `.env` files as needed:
* `.env.local` for frontend config
* `.env` for backend config
---
## π License
MIT License β see [LICENSE.md](LICENSE.md)
---
## π€ Contributing
Contributions welcome! PRs, issues, and feedback help improve this bridge between Tesla IoT, Solana blockchain, and real-world sustainability.
---
## π« Contact
BARK Protocol Team β [contact@barkprotocol.net](mailto:contact@barkprotocol.net)