Skip to content

jedarden/sun-sim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒž Sun Simulator

Interactive web application for visualizing sun position, sunrise/sunset times, and solar paths for any location and date/time.

License Status Cost


โœจ Features

๐Ÿงญ Compass Rose Overlay - Visual compass with cardinal directions and sunrise/sunset bearings

โ˜€๏ธ Real-time Sun Position - Calculate azimuth and altitude angles with visual bearing indicator

๐ŸŒ… Sunrise/Sunset Lines - Orange/red lines showing exact bearing and time

๐Ÿ—บ๏ธ Interactive Map - Pan and zoom to select any location worldwide

๐Ÿ“… Date Navigation - Arrow keys and buttons to scroll through the year

โฐ Color-Coded Timeline - Visual day/night representation with smooth animations

๐ŸŒ Global Coverage - Works at all latitudes including polar regions

๐Ÿ“ฑ Mobile Responsive - Touch-friendly interface with drag controls

๐Ÿ’ฐ Zero Cost - Free satellite imagery, no API keys required

๐ŸŽฏ High Accuracy - ยฑ0.01ยฐ position, ยฑ1 minute timing


๐Ÿš€ Quick Start

Option 1: Docker from GitHub Container Registry (Easiest)

# Pull and run the pre-built image
docker pull ghcr.io/jedarden/sun-sim:latest
docker run -d -p 3000:3000 --name sun-sim ghcr.io/jedarden/sun-sim:latest

# Or use a specific version
docker pull ghcr.io/jedarden/sun-sim:0.1
docker run -d -p 3000:3000 --name sun-sim ghcr.io/jedarden/sun-sim:0.1

Access at: http://localhost:3000

Option 2: Docker Build Locally

# Build and run with Docker Compose
docker-compose up -d

# Or build and run manually
docker build -t sun-simulator .
docker run -p 3000:3000 sun-simulator

Access at: http://localhost:3000

Option 3: Python Server (No Dependencies)

# Run the built-in Python server
python3 serve.py

# Or specify a custom port
python3 serve.py 8080

Access at: http://localhost:3000 (or your custom port)

Option 4: Any HTTP Server

The application is a static webpage, so you can use any web server:

# Node.js http-server
npx http-server -p 3000

# PHP built-in server
php -S localhost:3000

# Python
python -m http.server 3000

๐ŸŽฎ Usage

1. ๐Ÿ“ Select Location

  • Pan and zoom the map to center the crosshair on your desired location
  • Coordinates update automatically in the side panel

2. ๐Ÿ“… Choose Date

  • Use the date picker to select any date
  • Navigate with keyboard shortcuts:
    • โ†‘ Next day
    • โ†“ Previous day
    • โ† Previous month
    • โ†’ Next month
    • Shift + โ† Previous week
    • Shift + โ†’ Next week
    • T Jump to today

3. โฐ Set Time

  • Drag the color-coded timeline to change time of day
  • Watch the sun marker move around the compass rose

4. ๐Ÿ“Š View Sun Data

  • Azimuth - Compass direction (0-360ยฐ)
  • Altitude - Angle above horizon
  • Sunrise/Sunset - Exact times and bearings
  • Solar Noon - Sun's highest point
  • Day Length - Hours of daylight

๐Ÿ› ๏ธ Technology Stack

Component Technology Purpose
๐Ÿ“ Solar Calculations SunCalc.js ยฑ0.01ยฐ accuracy
๐Ÿ—บ๏ธ Interactive Maps Leaflet.js Pan/zoom controls
๐Ÿ›ฐ๏ธ Satellite Imagery ESRI World Imagery Free high-res tiles
๐Ÿ“… Date Picker Flatpickr Date selection
๐Ÿ’ป Frontend Vanilla JavaScript No framework dependencies

๐Ÿ”„ Versioning

This project uses automatic semantic versioning with GitHub Actions:

Version Management

  • VERSION file - Contains the current semantic version (e.g., 0.1.0)
  • Automatic patch increment - When code changes (index.html, serve.py, Dockerfile, docs/), the patch version auto-increments
  • Manual version updates - To bump minor or major versions, update the VERSION file manually

How It Works

Scenario 1: Code Changes

# You modify index.html
# Workflow detects code change
# Auto-increments: 0.1.0 โ†’ 0.1.1
# Creates tag: v0.1.1
# Builds and publishes Docker image

Scenario 2: Manual Version Update

# You update VERSION file: 0.1.5 โ†’ 0.2.0
# Workflow detects VERSION file change
# Uses your version: 0.2.0
# Creates tag: v0.2.0
# Builds and publishes Docker image

Scenario 3: Non-Code Changes

# You update README.md only
# Workflow detects no code or version changes
# Skips build (no new Docker image)

Versioning Rules

  • Patch (0.0.X) - Bug fixes, small changes (auto-incremented)
  • Minor (0.X.0) - New features, backwards-compatible (manual)
  • Major (X.0.0) - Breaking changes (manual)

๐ŸŒ Deployment

Cloudflare Pages

npx wrangler pages publish . --project-name=sun-simulator

Vercel

npx vercel --prod

Netlify

npx netlify deploy --prod --dir=.

GitHub Pages

git subtree push --prefix . origin gh-pages

All deployment options are 100% free with no backend required.


๐Ÿ“š Documentation


๐Ÿ“Š Performance Metrics

Metric Result
๐ŸŽฏ Position Accuracy ยฑ0.0067ยฐ
โฑ๏ธ Timing Accuracy ยฑ39 seconds
๐Ÿš€ Load Time < 2.1 seconds
๐Ÿ“ฆ Bundle Size 87KB (gzipped)
๐ŸŽฌ Frame Rate 58-60 FPS

๐ŸŒ Browser Support

โœ… Chrome/Edge 90+ โœ… Firefox 88+ โœ… Safari 14+ โœ… Mobile browsers (iOS Safari, Chrome Mobile)


๐Ÿ“„ License

MIT License - Free to use, modify, and distribute.


๐Ÿ™ Credits

  • SunCalc - Vladimir Agafonkin (mourner/suncalc)
  • Leaflet - Interactive mapping library
  • ESRI - Satellite imagery provider
  • OpenStreetMap - Map data contributors

๐Ÿ’ฌ Support

For issues or questions:


Status: โœ… Production Ready | Version: 0.1.0 | Cost: $0

Made with โ˜€๏ธ and โ˜•

About

Interactive sun position simulator with compass rose visualization

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •