No description
- Svelte 49.2%
- TypeScript 47.9%
- HTML 2%
- CSS 0.5%
- Dockerfile 0.2%
- Other 0.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| drizzle | ||
| placeholder | ||
| scripts | ||
| services/ocr-service | ||
| src | ||
| static | ||
| training-images | ||
| .env.example | ||
| .gitignore | ||
| ANALYTICS.md | ||
| CLAUDE.md | ||
| docker-compose.dev.yml | ||
| docker-compose.yml | ||
| Dockerfile | ||
| drizzle.config.ts | ||
| image.png | ||
| package-lock.json | ||
| package.json | ||
| plan.md | ||
| postcss.config.js | ||
| README.md | ||
| stations.csv | ||
| svelte.config.js | ||
| tailwind.config.ts | ||
| tsconfig.json | ||
| tsconfig.scripts.json | ||
| vite.config.js | ||
pumps.gg
Community-powered fuel price tracker for Guernsey. Track real-time fuel prices across the island with crowdsourced data and official price verification.
Stack
- Frontend: SvelteKit 5, TypeScript, Tailwind CSS
- Backend: SvelteKit API routes, TypeScript
- Database: PostgreSQL with Drizzle ORM
- Storage: File-based photo storage with sharp for image processing
- Auth: bcrypt password hashing, session-based authentication
- Deployment: Docker + Docker Compose
Quick Start
Prerequisites
- Node.js 20+
- Docker & Docker Compose
- PostgreSQL 16 (or use docker-compose)
Development
-
Clone and install:
cd pumpsgg npm install -
Setup environment:
cp .env.example .env -
Start services:
docker-compose -f docker-compose.dev.yml up -d -
Run migrations:
npm run db:push npm run db:seed -
Start dev server:
npm run dev
Access at http://localhost:5173
Production
-
Build:
npm run build -
Deploy with Docker:
docker-compose up -d
Server runs on port 3000.
Project Structure
src/
├── lib/
│ ├── components/ # Svelte components
│ └── server/ # Backend utilities
│ ├── db/ # Database layer (Drizzle)
│ ├── auth.ts # Authentication
│ ├── ratelimit.ts # Rate limiting
│ └── photos.ts # Image processing
├── routes/ # SvelteKit routes
│ ├── api/ # REST API endpoints
│ └── auth/ # Auth pages
└── app.css # Global styles
Key Features
- Community Crowdsourcing: Users submit real-time fuel prices
- Official Prices: Official users can mark submissions as verified
- Voting System: Community can verify or flag submissions
- Reputation Score: Track user accuracy and reliability
- Photo Verification: Optional OCR + EXIF verification
- Rate Limiting: Per-user submission limits to prevent spam
- Offline Support: Service worker for offline capability
API Endpoints
Auth
POST /api/auth/login- User loginPOST /api/auth/register- Create accountPOST /api/auth/logout- Sign outGET /api/auth/me- Current user info
Stations
GET /api/stations- List all stations with latest pricesPOST /api/stations- Create station (admin only)
Fuel Types
GET /api/fuel-types- List fuel typesPOST /api/fuel-types- Create fuel type (admin only)
Prices
GET /api/prices- List prices with filtersPOST /api/prices- Submit new price (auth required)POST /api/prices/[id]/vote- Vote on a submission
Environment Variables
DATABASE_URL=postgres://user:pass@host:5432/db
SESSION_SECRET=<32+ char random string>
PUBLIC_SITE_URL=https://pumps.gg
ADMIN_EMAIL=admin@pumps.gg
PHOTO_UPLOAD_MAX_SIZE=5242880
PHOTO_STORAGE_PATH=/app/uploads/pump-photos
NODE_ENV=development
Database Schema
Key tables:
users- User accounts with reputationstations- Fuel station locationsfuel_types- Available fuel categoriesprices- Crowdsourced price submissionsvotes- Community verification votesbadges- User achievement badges
Development Commands
npm run dev # Start dev server
npm run build # Production build
npm run preview # Preview build locally
npm run check # Type check
npm run db:generate # Generate migrations
npm run db:push # Apply migrations
npm run db:studio # Open Drizzle Studio
npm run db:seed # Seed database
Rate Limits
- Price submissions: 10/hour per user
- Votes: 50/hour per user
- Login attempts: 5/15min per IP
- Registration: 3/hour per IP
Security
- CSRF protection on all state-changing requests
- BCRYPT password hashing (12 rounds)
- Secure session cookies (HttpOnly, SameSite=Strict)
- Input validation at system boundaries
- XSS protection headers
- HSTS for production
License
© 2024 GSY Labs. All rights reserved.