diff --git a/README.md b/README.md index f012cd4..3f2f3ad 100644 --- a/README.md +++ b/README.md @@ -1,91 +1,125 @@ -# WEJAY +# Wejay -En demokratisk Spotify-jukebox där alla får bidra med låtar. Låtordningen bestäms av D'Hondt-metoden för rättvis fördelning. +A democratic Spotify jukebox where everyone gets to contribute songs. Track order is determined by the D'Hondt method for fair distribution. -## FUNKTIONER +## Features -- **Demokratisk kö** - Låtar fördelas rättvist mellan användare med D'Hondt-algoritmen -- **Spotify-integration** - Sök och lägg till låtar från Spotify -- **Realtidsuppdateringar** - Se vad andra lägger till i kön -- **Rumsbaserat** - Skapa rum och bjud in kollegor +- **Democratic Queue** - Songs are distributed fairly between users using the D'Hondt algorithm +- **Spotify Integration** - Search and add songs from Spotify's catalog +- **Real-time Updates** - See what others add to the queue instantly +- **Room-based** - Create rooms and invite colleagues or friends +- **Fair Play Algorithm** - Prevents any single user from dominating the playlist -## TEKNISK STACK +## Tech Stack -- **Frontend:** React, TypeScript, Vite, Tailwind CSS -- **UI:** Shadcn/ui komponenter med neumorfisk design -- **Font:** Futura PT (versaler för labels) -- **Backend:** Kräver Lovable Cloud eller Supabase +- **Frontend:** React 18, TypeScript, Vite, Tailwind CSS +- **UI Components:** Shadcn/ui with custom design system +- **Backend:** Express.js with Socket.IO for real-time features +- **Database:** Redis for session management and caching +- **Authentication:** OAuth 2.0 with Spotify +- **Deployment:** Docker + Kubernetes -## LOKAL UTVECKLING +## Local Development ```bash -# Klona projektet -git clone -cd wejay +# Clone the repository +git clone https://github.com/Iteam1337/wejay-2025.git +cd wejay-2025 -# Installera dependencies +# Install dependencies npm install -# Skapa .env fil +# Create environment file cp .env.example .env -# Lägg till dina Spotify credentials +# Add your Spotify credentials to .env -# Starta dev server +# Start development server npm run dev ``` -## MILJÖVARIABLER +## Environment Variables ```env -CLIENT_ID=din_spotify_client_id -CLIENT_SECRET=din_spotify_client_secret +# Spotify OAuth +VITE_SPOTIFY_CLIENT_ID=your_spotify_client_id +CLIENT_SECRET=your_spotify_client_secret + +# Optional: Redis configuration +REDIS_HOST=localhost +REDIS_PORT=6379 + +# Optional: Server configuration +PORT=8080 +NODE_ENV=development ``` -Skapa en app på [Spotify Developer Dashboard](https://developer.spotify.com/dashboard) för att få credentials. +Create an app on the [Spotify Developer Dashboard](https://developer.spotify.com/dashboard) to get your credentials. -## DOCKER +## Scripts ```bash -# Bygg image +npm run dev # Start development server +npm run build # Build for production +npm run build:dev # Build in development mode +npm run lint # Run ESLint +npm run preview # Preview production build +npm run start # Start production server +``` + +## Docker + +```bash +# Build the image docker build -t wejay . -# Kör container +# Run the container docker run -p 8080:8080 \ - -e CLIENT_ID=xxx \ + -e VITE_SPOTIFY_CLIENT_ID=xxx \ -e CLIENT_SECRET=xxx \ wejay ``` -## KUBERNETES +## Kubernetes -Se `/k8s` mappen för deployment-konfiguration: +See the `/k8s` directory for deployment configurations: - `deployment.yaml` - Kubernetes deployment - `service.yaml` - ClusterIP service -- `ingress.yaml` - Ingress med TLS via cert-manager -- `external-dns.yaml` - Automatisk DNS för wejay.org +- `ingress.yaml` - Ingress with TLS via cert-manager +- `redis.yaml` - Redis cluster configuration -## ARKITEKTUR +## Architecture ``` ┌─────────────────┐ ┌──────────────────┐ │ React App │────▶│ Spotify Web API │ +│ (Vite/TS) │ │ (OAuth 2.0) │ └─────────────────┘ └──────────────────┘ - │ - ▼ + │ + ▼ ┌─────────────────┐ ┌──────────────────┐ -│ Lovable Cloud / │────▶│ PostgreSQL │ -│ Supabase │ │ (Rooms, Users)│ +│ Express.js │────▶│ Redis │ +│ + Socket.IO │ │ (Sessions/Caching)│ └─────────────────┘ └──────────────────┘ ``` -## D'HONDT-METODEN +## The D'Hondt Method + +The algorithm ensures fair play in the queue: + +1. Each user gets "votes" based on their number of contributions +2. Songs are ranked by `votes / (already_played + 1)` +3. Result: No user can dominate the queue + +This ensures that even users who contribute fewer songs get fair representation in the playlist. -Algoritmen fördelar spelordningen rättvist: +## Contributing -1. Varje användare får "röster" baserat på antal bidrag -2. Låtar rankas efter `röster / (redan_spelade + 1)` -3. Resultatet: ingen användare dominerar kön +1. Fork the repository +2. Create a feature branch (`git checkout -b feature/amazing-feature`) +3. Commit your changes (`git commit -m 'Add amazing feature'`) +4. Push to the branch (`git push origin feature/amazing-feature`) +5. Open a Pull Request -## LICENS +## License -MIT +MIT License - see the [LICENSE](LICENSE) file for details. \ No newline at end of file diff --git a/index.html b/index.html index d0593fa..ac7d64e 100644 --- a/index.html +++ b/index.html @@ -1,13 +1,13 @@ - + - Wejay - Kollaborativ Musik - + Wejay - Democratic Spotify Jukebox + - - + + diff --git a/package.json b/package.json index 33ed8bd..26df772 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,8 @@ { - "name": "vite_react_shadcn_ts", + "name": "wejay", "private": true, - "version": "0.0.0", + "version": "1.0.0", + "description": "A democratic Spotify jukebox where everyone gets to contribute songs. Track order is determined by the D'Hondt method for fair distribution.", "type": "module", "scripts": { "dev": "vite", @@ -85,7 +86,7 @@ "eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-refresh": "^0.4.20", "globals": "^15.15.0", - "lovable-tagger": "^1.1.11", + "postcss": "^8.5.6", "tailwindcss": "^3.4.17", "typescript": "^5.8.3",