Edwin Eames 7ac2c7c59e feat: add admin panel, stats API, and url support across frontend
- Add adminApi with full CRUD for users, companies, listings, oil-prices
- Add statsApi for fetching latest market price aggregates
- Add AdminTable component and /admin page for site management
- Add StatsPrice, UpdateUserRequest, UpdateOilPriceRequest types
- Add url field support in listing create/edit forms
- Update state SVG data for all 6 New England states
- Update county page to display richer listing info (phone, url, bio%)
- Misc layout and style updates across vendor and public routes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 11:34:31 -05:00
2025-06-08 13:21:49 -04:00
2026-02-09 09:28:55 -05:00
2025-12-29 23:14:58 -05:00
2024-06-20 10:43:30 -04:00
2024-06-20 10:43:30 -04:00
2024-06-20 10:43:30 -04:00
2024-04-11 11:57:46 -04:00
2025-12-26 20:01:28 -05:00
2024-04-11 11:57:46 -04:00
2025-06-08 13:21:49 -04:00
2025-06-08 13:21:49 -04:00
2025-12-26 20:01:28 -05:00

NewEnglandBio Frontend

SvelteKit web application for heating oil and biofuel price comparison across New England's 6 states (MA, CT, RI, VT, NH, ME).

Tech Stack

  • Framework: SvelteKit with TypeScript
  • Styling: Tailwind CSS + DaisyUI
  • Icons: lucide-svelte
  • Build: Vite, adapter-node
  • Maps: Pure SVG (no map library) — path data in src/lib/states/*.ts

Project Structure

src/
├── lib/
│   ├── api/
│   │   ├── client.ts        # Fetch wrapper with auth, error handling
│   │   ├── types.ts         # API response types
│   │   └── index.ts
│   ├── types/
│   │   └── types.ts         # App-wide TypeScript interfaces
│   ├── states/              # SVG county path data per state
│   │   ├── connecticut.ts
│   │   ├── maine.ts
│   │   ├── massachusetts.ts
│   │   ├── newhampshire.ts
│   │   ├── rhodeisland.ts
│   │   └── vermont.ts
│   └── states.ts            # State/county stores and data
└── routes/
    ├── +error.svelte
    └── (app)/
        ├── +layout.svelte           # Navbar, footer, dark mode
        ├── +page.svelte             # Home — interactive NE state map
        ├── login/+page.svelte
        ├── register/+page.svelte
        ├── [stateSlug]/
        │   ├── +page.svelte         # County map for a state
        │   └── [countySlug]/
        │       └── +page.svelte     # Listings & oil prices for a county
        └── vendor/
            ├── +layout.svelte
            ├── +page.svelte          # Vendor dashboard
            ├── profile/+page.svelte  # Edit company profile
            └── listing/
                ├── +page.svelte      # Create listing
                └── [id]/+page.svelte # Edit listing

Routes

Path Access Description
/ Public Interactive New England map
/login Public Login form
/register Public Registration form
/:stateSlug Public County map for a state (e.g. /MA)
/:stateSlug/:countySlug Public Listings and oil prices for a county
/vendor Auth Vendor dashboard
/vendor/profile Auth Edit company profile
/vendor/listing Auth Create new listing
/vendor/listing/:id Auth Edit a listing

Setup

npm install

Environment

Create .env:

PUBLIC_API_URL=http://localhost:9552

Development

npm run dev

Dev server starts on port 5169 with --host for network access. Vite proxies /api requests to the Rust API during development.

Production Build

npm run build
node build

Runs on port 3000 using adapter-node.

Docker

Development:

docker build -f Dockerfile -t frontend-dev .

Production (multi-stage):

docker build -f Dockerfile.prod -t frontend-prod .
docker run -p 3000:3000 frontend-prod

API Client

The API client (src/lib/api/client.ts) provides typed methods for all backend interactions:

  • Auth: login(), register(), logout(), isAuthenticated(), getStoredUser()
  • Company: getCompany(), createCompany(), updateCompany(), deleteCompany()
  • Listings: getListings(), getListingById(), createListing(), updateListing(), deleteListing()
  • Public: getListingsByCounty(), getOilPricesByCounty(), getCountiesByState(), getCategories()

Auth uses JWT stored as an httpOnly cookie. User info cached in localStorage.

Styling

Tailwind + DaisyUI with two themes (light/dark). Custom utility classes:

  • .btn-blue-oil — primary CTA buttons
  • .bg-orange-oil — accent backgrounds
  • .btn-state — map state buttons

Scripts

Command Description
npm run dev Dev server (port 5169)
npm run build Production build
npm run preview Preview production build
npm run check Svelte type checking
npm run check:watch Type checking (watch mode)

Known Issues

  • Maine SVG map paths are inaccurate (CRIT-001)
  • API URL http://localhost:9552 is hardcoded in some components
Description
No description provided
Readme 8.9 MiB
Languages
Svelte 63.2%
TypeScript 34.2%
CSS 1.5%
JavaScript 1%