Skip to content

govargas/bada

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

251 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ–οΈ BADA – Find Safe Beaches in Sweden

React Express MongoDB TypeScript TailwindCSS Three.js MapLibre i18next TanStack Query Deployed

BADA helps beachgoers and families in Sweden find safe, EU-classified bathing waters with real-time quality updates.
It replaces outdated or clunky websites with a clean, mobile-friendly experience where you can browse nearby beaches on a map, check water quality, and save your favourites.

Try it out here (deployed on Netlify)


✨ Features

  • πŸ—Ί Map of all EU-classified beaches in Sweden (MapLibre + OpenStreetMap)
  • πŸ“ Find the nearest beach using your device's location
  • πŸ”¬ View water quality, classification, and recent test results (data from HaV)
  • πŸ” Real-time beach search with autocomplete dropdown
  • ❀️ Create an account and save favourite beaches to your profile
  • πŸ”€ Drag-and-drop sorting for favorites
  • 🌊 3D animated backgrounds (WebGL water simulation in dark mode, sand texture in light mode)
  • 🎨 Glassmorphism UI with backdrop blur effects
  • 🌀️ Weather & sun times panel on each beach β€” air temp, feels like, UV index, water temperature, and a visual sun arc with golden hour, sunrise/sunset, and twilight phases
  • πŸŒ— Dark mode and responsive design (mobile β†’ desktop)
  • 🌐 Multi-language support (Swedish / English)
  • πŸ“š API Documentation (Swagger UI at /api/docs)

πŸš€ Tech Stack

Frontend

  • React 18 + Vite + TypeScript
  • React Router v7
  • Zustand (global state)
  • TanStack Query (server state & caching)
  • Tailwind CSS v4 (with CSS-based theme system)
  • i18next (translations)
  • MapLibre GL (maps)
  • Three.js ecosystem (@react-three/fiber, @react-three/drei) for 3D backgrounds
  • @dnd-kit (drag-and-drop)
  • react-hook-form + Zod (form validation)
  • react-hot-toast (notifications)

Custom React Hooks

  • useGeolocation – Device location access
  • useOutsideClose – Close popovers on outside click/Escape key
  • useToggleDarkMode – Writes the .dark class (used in Header)
  • useDarkModeObserver – Reads/observes .dark class via MutationObserver (used in AmbientBackground)
  • usePrefersReducedMotion – Respect user's motion preferences
  • useBeaches – Beach data fetching
  • useWeather – Weather data with 30-min stale time
  • useSunTimes – Sun times keyed by date with 12-hr stale time

Backend

  • Node.js + Express 5
  • MongoDB + Mongoose
  • JWT Authentication
  • Zod (validation)
  • In-memory caching for HaV API responses
  • Swagger UI (API documentation)

External APIs


β™Ώ Accessibility

BADA is built with accessibility in mind:

  • Skip navigation link – Jump directly to main content
  • ARIA labels – Proper labeling of interactive elements
  • ARIA live regions – Screen reader announcements for dynamic content
  • ARIA busy states – Loading indicators for assistive technology
  • Keyboard navigation – Search is an ARIA combobox (arrow keys / Enter / Escape); menus and dialogs are keyboard-operable with focus management
  • Escape key handling – Close menus and return focus to trigger
  • Focus visible rings – Clear focus indicators
  • Reduced motion support – Respects prefers-reduced-motion (both CSS and JS)
  • Semantic HTML – Proper document structure with roles
  • Dynamic lang attribute – HTML lang updates with language selection
  • Accessible notifications – Toast messages with proper ARIA live regions

πŸ“Έ Screenshots

(Coming soon)


πŸ›  Installation & Setup

Clone the repo and install dependencies:

git clone https://github.com/govargas/bada.git
cd bada

Backend

cd backend
cp .env.example .env.local # then fill in your values
npm install
npm run dev

Backend runs on http://localhost:3000

API Documentation available at http://localhost:3000/api/docs

Frontend

cd frontend
cp .env.example .env.local # then fill in your values
npm install
npm run dev

Frontend runs on http://localhost:5173


πŸ”‘ Environment Variables

  • See .env.example in both backend/ and frontend/.
  • Fill in with your own values (MongoDB Atlas, JWT secret, MapTiler key).

πŸ‘€ Test User Credentials

  • Use these to try the app without registering:

Email: smoke@test.com

Password: Test1234

This account already has some favourite beaches saved.


🌍 Deployment


βœ… Requirements Checklist

Technical Requirements (Grade G)

  • βœ… React frontend
  • βœ… Node.js + Express backend
  • βœ… MongoDB database
  • βœ… Authentication (JWT)
  • βœ… React Router navigation
  • βœ… Global state management (Zustand)
  • βœ… β‰₯2 external libraries (TanStack Query, MapLibre, Three.js, react-hook-form, i18next, react-hot-toast, @dnd-kit)
  • βœ… Custom React hooks (useGeolocation, useOutsideClose, useToggleDarkMode, useDarkModeObserver, usePrefersReducedMotion, useBeaches, useWeather, useSunTimes)
  • βœ… Responsive (320px β†’ 1600px+)
  • βœ… Accessibility features (comprehensive a11y implementation)
  • βœ… Clean Code practices

Visual Requirements

  • βœ… Clear structure using box model with consistent margins/paddings
  • βœ… Consistent typography across views and breakpoints
  • βœ… Cohesive color scheme with CSS design tokens
  • βœ… Mobile-first responsive design
  • βœ… Dark mode support with 3D backgrounds
  • βœ… Multi-language support (Swedish/English)
  • βœ… Glassmorphism UI design system

Grade VG Enhancements

  • βœ… Error Boundaries
  • βœ… Toast notifications with a11y
  • βœ… Reduced motion support
  • βœ… Comprehensive documentation
  • βœ… Meta tags for SEO (Open Graph, Twitter Cards)
  • βœ… API Documentation (Swagger UI)
  • βœ… Performance optimizations (lazy-loaded 3D backgrounds)

⚠️ Known Limitations

These are conscious trade-offs for an MVP, documented rather than hidden:

  • Backend cache is per-instance. The HaV proxy cache is an in-memory Map. On Vercel serverless it does not survive cold starts or span instances, so it mainly de-dupes bursts within a warm instance. The beach list sidesteps this entirely via a static CDN snapshot (frontend/public/beaches.json, refreshed daily by a GitHub Action); only per-beach detail still hits the proxy.
  • Data is seasonal. HaV samples bathing waters roughly June–August. Outside the season latestSampleDate and classification reflect the previous year.
  • Golden hour is approximate. It is computed as sunrise + 1h / sunset βˆ’ 1h, and the sun arc degrades north of the Arctic Circle during the midnight sun (sunrise-sunset.org returns degenerate times there).
  • Third-party APIs called from the client. Open-Meteo and sunrise-sunset.org are called directly from the browser with no SLA β€” acceptable for an MVP, not for production traffic.
  • Auth token in localStorage. Simple and fine for a no-sensitive-data MVP, but XSS-exposed; an httpOnly cookie would be the production choice.
  • No SSR. SEO is limited to per-route <title>, a generated sitemap.xml, and site-wide Open Graph tags. Per-beach Open Graph previews would require prerendering.

🧭 Roadmap

Completed

  • βœ… 3D animated backgrounds (WebGL water/sand)
  • βœ… Enhanced glassmorphism UI
  • βœ… Header search with autocomplete
  • βœ… Comprehensive accessibility implementation
  • βœ… API documentation with Swagger
  • βœ… Performance optimization (deferred 3D loading)
  • βœ… Focus management and keyboard navigation
  • βœ… Weather & sun times panel (Open-Meteo + sunrise-sunset.org) with visual sun arc, golden hour zones, and water temperature

Planned

  • πŸ”„ Filter beaches by classification
  • πŸ”„ Add user beach photos
  • πŸ”„ Allow notes/tips per beach (e.g. "good for kids")
  • πŸ”„ PWA support with offline capability

πŸ’‘ Inspiration & Credits

  • Data from the Swedish Agency for Marine and Water Management (HaV)
  • Maps powered by OpenStreetMap + MapTiler
  • Built during the Technigo Fullstack JavaScript Bootcamp (2025)

πŸ‘¨β€πŸ’» Author

Created by Talo Vargas, 2025

About

Find Safe Beaches in Sweden - Final project for Technigo fullstack js web dev spring 2025

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 91.3%
  • CSS 5.7%
  • JavaScript 2.0%
  • Other 1.0%