Skip to content
dsanchezcrPublic

Latest commit

ย 

History

1,220 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

David's Personal Website

This repository contains the source code for my personal website and blog, dsanchezcr.com. The site is built using Docusaurus, a modern static website generator with a .NET 8 API backend.

Build and Deploy CodeQL

โœจ About This Repository

This website serves as a platform to share my thoughts on technology, software development, and other interests through blog posts. It also includes information about my projects, professional background, volunteering experience, and a gaming section showcasing my gaming profiles and curated game lists across Xbox, PlayStation, Nintendo Switch, Meta Quest, Phone/Mobile, and Board Games.

๐Ÿ—๏ธ Architecture

The site uses Azure Static Web Apps with a managed API architecture:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                  Azure Static Web Apps                      โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚   Docusaurus Site   โ”‚    โ”‚    .NET 8 Managed API       โ”‚ โ”‚
โ”‚  โ”‚   (React/MDX)       โ”‚    โ”‚    (Azure Functions)        โ”‚ โ”‚
โ”‚  โ”‚                     โ”‚    โ”‚                             โ”‚ โ”‚
โ”‚  โ”‚  โ€ข Blog posts       โ”‚    โ”‚  โ€ข /api/contact             โ”‚ โ”‚
โ”‚  โ”‚  โ€ข Static pages     โ”‚    โ”‚  โ€ข /api/verify              โ”‚ โ”‚
โ”‚  โ”‚  โ€ข i18n (en/es/pt)  โ”‚    โ”‚  โ€ข /api/weather             โ”‚ โ”‚
โ”‚  โ”‚  โ€ข Volunteering     โ”‚    โ”‚                             โ”‚ โ”‚
โ”‚  โ”‚  โ€ข Gaming           โ”‚    โ”‚  โ€ข /api/nlweb/ask           โ”‚ โ”‚
โ”‚  โ”‚    (multi-platform) โ”‚    โ”‚                             โ”‚ โ”‚
โ”‚  โ”‚                     โ”‚    โ”‚  โ€ข /api/health              โ”‚ โ”‚
โ”‚  โ”‚                     โ”‚    โ”‚  โ€ข /api/reindex             โ”‚ โ”‚
โ”‚  โ”‚                     โ”‚    โ”‚  โ€ข /api/gaming/xbox         โ”‚ โ”‚
โ”‚  โ”‚                     โ”‚    โ”‚  โ€ข /api/gaming/playstation  โ”‚ โ”‚
โ”‚  โ”‚                     โ”‚    โ”‚  โ€ข /api/gaming/refresh      โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Both frontend and backend are deployed together from a single repository, with the API served from the same domain under /api.

๐Ÿš€ Tech Stack

Frontend

  • Docusaurus v3: Static site generator
  • React: UI components
  • MDX: Content authoring
  • Internationalization: English, Spanish, Portuguese

Backend (Managed API)

Infrastructure

๐Ÿ Getting Started

Prerequisites

Installation

git clone https://github.com/dsanchezcr/website.git
cd website
npm install
dotnet restore api/api.csproj

Running Locally

Option 1: SWA CLI (Recommended) - Full emulation with API integration

npm install -g @azure/static-web-apps-cli
swa start

Access at http://localhost:4280 (API available at /api/*)

Option 2: Frontend Only

npm start

Access at http://localhost:3000

Option 3: API Only

cd api
dotnet build
func start --csharp

Access at http://localhost:7071

๐Ÿ› ๏ธ Building

# Build frontend
npm run build

# Build API
cd api && dotnet build --configuration Release

Build artifacts:

  • Frontend: build/
  • API: api/bin/Release/net8.0/

๐ŸŒ Internationalization (i18n)

Language Path Prefix Translation Directory
English / (default) -
Spanish /es/ i18n/es/
Portuguese /pt/ i18n/pt/

๐Ÿ“ก API Endpoints

Endpoint Method Description
/api/contact POST Submit contact form (initiates email verification)
/api/verify GET Complete email verification
/api/weather GET Weather data for predefined locations
/api/nlweb/ask POST AI chat assistant with RAG
/api/health GET Health check for all services
/api/reindex POST Update search index (called by GitHub Actions)
/api/gaming/xbox GET Xbox Live profile, gamerscore, and recent games
/api/gaming/playstation GET PSN profile, trophies, and recent games
/api/gaming/refresh POST Admin: trigger gaming data refresh
/api/content-admin/tmdb?tmdbId=550&mediaType=movie GET Admin-only: localized movie/TV metadata; server-side TMDB token

โ˜๏ธ Deployment

Automatic (GitHub Actions)

Push to main or create a PR to trigger automatic deployment via azure-static-web-app.yml.

Manual (Bicep)

Deploy infrastructure using the Bicep templates in infra/:

az deployment group create \
  --resource-group <resource-group> \
  --template-file infra/main.bicep \
  --parameters infra/main.parameters.json \
  --parameters \
    azureCommunicationServicesConnectionString="<secret>" \
    recaptchaSecretKey="<secret>" \
    azureOpenAIEndpoint="<endpoint>" \
    azureOpenAIKey="<secret>"

See infra/README.md for complete deployment instructions.

TMDB Media Auto-fill Configuration

Set TMDB_READ_ACCESS_TOKEN in the managed API's Azure Static Web Apps application settings. Locally, put TMDB_READ_ACCESS_TOKEN=<your-token> in ignored api/.env, or use api/local.settings.json โ†’ Values. Existing environment settings take precedence; production never loads .env. Never use VITE_* or client-side keys.

In /admin, add/edit a Movie or Series, enter its numeric TMDB ID, and click Fetch Data. Review the localized titles/plots/genres, year, director or creators, TMDB rating and poster URL, then Save. Lookup makes no database writes and downloads no images. It refreshes English metadata and fills missing es/pt translations while preserving existing translations, reviews, personal ratings, categories, ordering and unknown fields.

The authenticated proxy uses HTTPS, bounded requests and safe errors. See the TMDB setup guide for configuration, quotas, troubleshooting and the API contract.

TMDB account syncing and its scheduled workflow remain retired. Existing imported records and attribution remain compatible, with no migration. After rollout, remove OMDB_API_KEY and obsolete account-sync credentials as described in the setup guide. Keep the TMDB read access token; no GitHub secret or scheduled job is needed.

๐Ÿ“ Project Structure

โ”œโ”€โ”€ api/                    # .NET 8 Azure Functions API
โ”‚   โ”œโ”€โ”€ SendEmail.cs        # Contact form endpoint
โ”‚   โ”œโ”€โ”€ VerifyEmail.cs      # Email verification
โ”‚   โ”œโ”€โ”€ GetWeather.cs       # Weather data
โ”‚   โ”œโ”€โ”€ ChatWithOpenAI.cs   # AI chat with RAG
โ”‚   โ”œโ”€โ”€ HealthCheck.cs      # Health monitoring
โ”‚   โ”œโ”€โ”€ ReindexContent.cs   # Search index updates
โ”‚   โ”œโ”€โ”€ GetTmdbMetadata.cs # Admin-only localized movie/TV metadata lookup
โ”‚   โ”œโ”€โ”€ GetXboxProfile.cs   # Xbox Live profile data
โ”‚   โ”œโ”€โ”€ GetPlayStationProfile.cs # PSN profile & trophies
โ”‚   โ”œโ”€โ”€ RefreshGamingProfiles.cs # Admin refresh endpoint
โ”‚   โ””โ”€โ”€ Services/           # TokenStorage, Search, GamingCache
โ”œโ”€โ”€ blog/                   # Blog posts (MDX)
โ”œโ”€โ”€ gaming/                 # Gaming docs section
โ”‚   โ”œโ”€โ”€ xbox/               # Xbox & PC games
โ”‚   โ”œโ”€โ”€ playstation/        # PlayStation games
โ”‚   โ”œโ”€โ”€ nintendo-switch/    # Nintendo Switch games
โ”‚   โ”œโ”€โ”€ meta-quest/         # Meta Quest games
โ”‚   โ”œโ”€โ”€ phone-mobile/       # Phone & mobile games
โ”‚   โ”œโ”€โ”€ board-games/        # Board games
โ”‚   โ””โ”€โ”€ chess/              # Chess profile
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ components/         # React components
โ”‚   โ”‚   โ””โ”€โ”€ Gaming/         # Gaming widgets and renderers
โ”‚   โ”œโ”€โ”€ data/
โ”‚   โ”‚   โ””โ”€โ”€ gaming/         # Per-platform gaming JSON data files
โ”‚   โ”œโ”€โ”€ pages/              # Static pages
โ”‚   โ””โ”€โ”€ config/             # Environment configuration
โ”œโ”€โ”€ i18n/                   # Translations (es/, pt/)
โ”œโ”€โ”€ infra/                  # Bicep templates
โ”œโ”€โ”€ static/                 # Static assets + SWA config
โ””โ”€โ”€ .github/workflows/      # CI/CD pipelines

๐ŸŽฎ Gaming Section

The website includes a gaming section at /gaming with live profile integrations and data-driven catalogs.

Platform Features Data Source
Xbox & PC Live profile (gamertag, gamerscore), recently played games OpenXBL API
PlayStation Trophy summary, recently played games, PSN profile PSN Internal API
Nintendo Switch Curated entries rendered from platform JSON User-curated content
Meta Quest Curated VR/MR entries rendered from platform JSON User-curated content
Phone/Mobile Curated mobile entries rendered from platform JSON User-curated content
Board Games Curated tabletop entries rendered from platform JSON User-curated content
Chess Live profile widget Chess.com profile data

Key features:

  • Live profile data fetched from gaming APIs
  • Dual-layer caching (in-memory + Azure Table Storage) for resilience
  • Automatic fallback to cached data when APIs are unavailable
  • Clickable game cards linking to Xbox/PlayStation store pages
  • Per-platform JSON data files in src/data/gaming/*.json
  • GamingEntriesRenderer + GameCard/GameCardGroup components for consistent rendering
  • Gaming docs in English, Spanish, and Portuguese all use the same JSON-driven platform data model
  • Full i18n support (English, Spanish, Portuguese)

Required environment variables for gaming APIs:

XBOX_API_KEY                # API key from https://xbl.io
XBOX_GAMERTAG_XUID          # Numeric Xbox User ID (XUID)
PSN_NPSSO_TOKEN             # NPSSO token from https://ca.account.sony.com/api/v1/ssocookie
GAMING_REFRESH_KEY          # Optional automation key; admin UI uses its signed-in role

Rotating the PSN NPSSO token (expires every ~60 days):

The PlayStation NPSSO token expires roughly every 60 days. When it does, the live PSN fetch fails and /api/gaming/playstation falls back to the last cached copy, returning "isCached": true. The daily Refresh Gaming Profiles workflow fails when it detects stale cache, which is the signal to rotate:

  1. Sign in at playstation.com in a browser.
  2. Visit https://ca.account.sony.com/api/v1/ssocookie and copy the npsso value.
  3. Update the PSN_NPSSO_TOKEN application setting on the Static Web App.
  4. Open Admin > Gaming > Refresh PlayStation (or Xbox/both). The signed-in admin role authorizes the request. Automation can also call POST /api/gaming/refresh with X-Gaming-Refresh-Key: <GAMING_REFRESH_KEY>. Refresh fetches immediately; failures are reported per provider and keep the last working cached profile.
  5. Confirm the admin reports the connection as refreshed, or re-run the Refresh Gaming Profiles workflow and confirm the public response reports "isCached": false.
  6. Curated game cards now sort newest-added first automatically. Use the optional Manual rank to pin entries, or clear it to restore automatic ordering. Top Games retains ascending Order. See admin ordering details.

/api/health also reports the cache age per platform and degrades when data is older than 3 days.

๐Ÿค Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

๐Ÿ“ License

This project is private and the code is proprietary. However, the blog content, unless otherwise stated, is open for sharing and referencing with appropriate attribution.


Thank you for visiting my repository!

Sponsor this project

Used by

Contributors

Languages