How jonashcroft/nowify works
Project type and purpose
• Nowify is a Jamstack‐style, client‐only Single Page Application (SPA) built with Vue.js.
• It’s meant to run as a static site (hosted on Netlify or similar), fetch your currently playing Spotify track via the Spotify Web API, and display it on a display device (e.g., Raspberry Pi).
File structure
• Top‐level files:
• package.json, babel.config.js, .eslintrc.js, .prettierrc → build tool configuration
• .env.sample → names of env vars (SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET)
• public/index.html → host page template
• assets/ → static images for README preview
• src/
• main.js → Vue app bootstrap
• App.vue → root component
• components/ → UI pieces: Authorise.vue, NowPlaying.vue
• utils/ → helper functions and prop definitions (e.g., token handling, API calls)
• styles/ → Sass organization (global variables, base styles, component styles)
Key details from the README
• Deploys via Netlify (CI/CD): on push to GitHub, Netlify builds & deploys.
• Requires two Spotify API credentials as environment variables at build time.
• On load, the client SPA handles OAuth flow with Spotify, requests “currently playing” endpoint, and renders cover art + vibrant background.
Main components & interactions (
a. Developer Workflow & CI/CD
• GitHub repo
• Netlify Build & Deploy (CI)
• Environment Variables injected at build time
• Output: static assets (HTML, JS, CSS) → CDN distribution
b. Client Side
• Browser or Raspberry Pi WebView loads index.html + bundled JS/CSS
• Vue.js SPA (App.vue → NowPlaying.vue / Authorise.vue)
• OAuth flow: SPA → Spotify Authorization Endpoint → user login → redirect back with code/token
• Token management in utils (access & refresh tokens) stored in browser (localStorage/cookies)
• Fetch “currently playing” REST call to Spotify Web API
c. External Service
• Spotify Web API (Authorization & Playback endpoints)
Architectural patterns & principles
• Jamstack: pre-built static assets + client-side rendering
• Component-based UI (Vue.js)
• Externalized configuration (env vars)
• Unidirectional data flow: utils → components → view
Technologies & frameworks
• Vue.js (SPA framework)
• Sass/SCSS (styles)
• Netlify (CI/CD + static hosting)
• Spotify Web API (OAuth 2.0 + REST endpoints)
• Babel, ESLint, Prettier (tooling)