Juan's Favorites is a personal web application built with Astro that showcases a curated collection of my favorite books, movies, TV shows, games, artists, and podcasts. The application fetches real-time data from multiple APIs, providing detailed information such as titles, release dates, ratings, and more.
Read the Spanish README for more information.
- Main site: fav.jpdiaz.dev
- Fallback: juan-favorites.pages.dev
- Books โ Fiction, non-fiction, and everything in between
- Movies โ Cinema that left an impression
- TV Shows โ Series worth your time
- Games โ Interactive experiences that captivate
- Artists โ Musicians and creators who inspire
- Podcasts โ Conversations and stories worth hearing
- Astro โ Modern framework for building fast websites.
- Tailwind CSS โ Utility-first CSS framework for responsive design.
- TMDB API โ Source of movie and TV show data.
- Listen Notes API โ Podcast data and metadata.
- IGDB API โ Video game information via Twitch Developer portal.
- MusicBrainz API โ Artist and music data.
- Cloudflare Pages โ Deployment platform for static sites.
juan-favorites/
โโโ public/ # Static assets
โโโ scripts/ # Generate data files
โโโ src/
โ โโโ components/ # Reusable components
โ โโโ config/ # Configuration files
โ โโโ data/ # Data files
โ โโโ layouts/ # Layout templates
โ โโโ pages/ # Site pages
โ โโโ scripts/ # JavaScript files
โ โโโ styles/ # Global styles
โโโ .env.example # Example environment variables
โโโ astro.config.mjs # Astro configuration
โโโ package.json # Dependencies and scripts
โโโ tailwind.config.cjs # Tailwind CSS configuration
- Clone the repository:
git clone https://github.com/JuanPabloDiaz/juan-favorites.git
cd juan-favorites
- Install dependencies:
npm install
- Set up environment variables:
cp .env.example .env
Edit the .env
file and replace the placeholder values with your actual API keys.
- Fetch initial data:
npm run fetch-data
- Start the development server:
npm run dev
- View the application:
Open your browser and navigate to
http://localhost:4321
to see the application in action.
- Go to The Movie Database (TMDB)
- Create an account and request an API key
- Add it to your
.env
file:TMDB_API_KEY=YOUR_TMDB_API_KEY
๐ต MusicBrainz API (Artists)
MusicBrainz API doesn't require an API key, but you should set a proper User-Agent string:
MUSICBRAINZ_USER_AGENT=YourAppName/1.0.0 ([email protected])
๐๏ธ Listen Notes API Key (Podcasts)
- Go to Listen Notes API
- Sign up and get your API key
- Add it to your
.env
file:LISTEN_NOTES_API_KEY=YOUR_LISTEN_NOTES_API_KEY
API Considerations:
- API Limits: Free tier typically allows ~10,000 requests per month
- Script Delay: The fetch script includes a 1-second delay between API calls to respect rate limits
- Search Accuracy: Depends on podcast names in
myFavPodcasts.json
matching Listen Notes database
๐ฎ IGDB API Credentials (Games)
This project uses the Internet Game Database (IGDB) API via the Twitch Developer portal.
Steps to get your IGDB Credentials:
- Go to the Twitch Developer Portal: Navigate to https://dev.twitch.tv/
- Log In/Sign Up: Log in with your existing Twitch account, or create one if you don't have it
- Register Your Application:
- Once logged in, go to your Dashboard or the "Applications" section
- Click on "Register Your Application" (or "+ Register Application")
- Name: Give your application a unique name (e.g., "MyFavoritesSite_Games")
- OAuth Redirect URLs: Set this to
http://localhost:3000
or any placeholder URL - Category: Choose "API" or "Application Integration"
- Click "Create"
- Get Your Client ID: Your Client ID will be visible on the application management page
- Generate a Client Secret: Click "New Secret" to generate your Client Secret
- Important: Copy it immediately and store it securely. Twitch only shows it once
- Set Up Environment Variables:
IGDB_CLIENT_ID=your_twitch_client_id_here IGDB_CLIENT_SECRET=your_twitch_client_secret_here
These credentials will be used to automatically obtain an OAuth access token from Twitch for IGDB API requests.
๐ Books API Setup
Add your books API configuration details here when implemented
BOOKS_API_KEY=YOUR_BOOKS_API_KEY
npm run dev
โ Start the development servernpm run build
โ Build the project for productionnpm run preview
โ Preview the production build locallynpm run fetch-movies
โ Fetches movie data from TMDB APInpm run fetch-music
โ Fetches music data from MusicBrainz APInpm run fetch-podcasts
โ Fetches podcast details using Listen Notes APInpm run fetch-games
โ Fetches game data from IGDB APInpm run fetch-books
โ Fetches book data (when implemented)npm run fetch-data
โ Runs all data fetching scriptsnpm run format
โ Run Prettier to format the code
๐๏ธ Managing Favorite Podcasts
Your favorite podcasts are managed through the src/data/myFavPodcasts.json
file. To add, remove, or change the podcasts displayed on the site, edit this file.
The format is a simple JSON array of objects:
[
{ "name": "Podcast Name 1" },
{ "name": "Another Podcast Title" }
]
Important Steps After Editing:
-
Run the Fetch Script: After modifying
myFavPodcasts.json
, you must run:npm run fetch-podcasts
-
Check Console Output: The script will log its progress. If a podcast name cannot be found, a warning will be logged.
-
Troubleshooting: If a podcast isn't appearing:
- Check the console output from the fetch script
- Verify the spelling of the podcast name
- Try variations of the name if the API can't find an exact match
๐ต Managing Favorite Artists
Add details about managing artists when the feature is fully implemented
Favorite artists are managed through src/data/myFavArtists.json
:
[
{ "name": "Artist Name 1" },
{ "name": "Another Artist" }
]
Run npm run fetch-music
after making changes.
๐ฎ Managing Favorite Games
Add details about managing games when the feature is fully implemented
Games are managed through the IGDB integration. Run npm run fetch-games
to update game data.
๐ Managing Favorite Books
Add details about managing books when the feature is fully implemented
Books will be managed through src/data/myFavBooks.json
:
[
{ "title": "Book Title", "author": "Author Name" }
]
Run npm run fetch-books
after making changes.
๐๏ธ Podcasts Integration
New Files Created:
scripts/fetch-podcasts.js
: Node.js script to fetch podcast data from Listen Notes APIsrc/data/myFavPodcasts.json
: User-managed list of favorite podcast namessrc/data/podcastDetails.json
: Stores detailed podcast information (gitignored, generated locally)src/components/PodcastCard.astro
: Component to display a single podcast cardsrc/pages/podcasts/index.astro
: Main page for listing all favorite podcastssrc/pages/fragments/PodcastList/index.astro
: Fragment that fetches and renders podcast cardssrc/pages/podcasts/[id].astro
: Dynamic page for displaying podcast detailssrc/pages/fragments/PodcastDetails/[id].astro
: Fragment for specific podcast details
Existing Files Modified:
.env.example
: AddedLISTEN_NOTES_API_KEY
placeholderpackage.json
: Addedfetch-podcasts
script and updatedfetch-data
scriptastro.config.mjs
: AddedLISTEN_NOTES_API_KEY
tovite.define
src/components/Nav.astro
: Added "Podcasts" link to navigation
Note on Data Loading: Components use Astro.glob()
for importing podcastDetails.json
data to resolve build issues with Node.js built-in modules in the Astro/Vite environment.
๐ต Artists Integration
Add details about artists integration files and structure when implemented
๐ฎ Games Integration
Add details about games integration files and structure when implemented
๐ Books Integration
Add details about books integration files and structure when implemented
This project is licensed under the MIT License. See the LICENSE file for details.
Built with โค๏ธ by Juan Pablo Diaz