Secret Santa gift exchange web application built with React + Vite, Azure Functions, and Azure Cosmos DB.
- π Multilingual: Full support for 9 languages - English, Spanish, Portuguese, Italian, French, Japanese, Chinese, German, and Dutch
- π² Random Assignments: Fair circular shuffle algorithm
- π Protected Games: Optional participant tokens for privacy
- π§ Email Notifications: Optional Azure Communication Services integration with 13+ notification types
- π Reassignment Requests: Participants can request new assignments
- π€ Organizer Panel: Full game management for organizers
- ποΈ Game Deletion: Organizers can permanently delete games
- π Date Validation: Games can only be created for today or future dates
- π§Ή Auto-Cleanup: Games automatically deleted 3 days after the event
- π Privacy Policy: Clear data handling and retention information
- π± Responsive Design: Works on all devices
- π Application Insights: Built-in monitoring and error tracking
| Environment | Resource Group | Static Web App | Cosmos DB | Lifecycle |
|---|---|---|---|---|
| PR Preview | secretsanta-pr-{number} |
Free | Serverless | Created on PR open, deleted on close |
| QA | secretsanta-qa |
Free | Free Tier | Persistent (isolated from prod) |
| Production | secretsanta |
Standard | Serverless | Persistent (unlimited scaling) |
Each environment has its own Static Web App and own Cosmos DB (QA is completely isolated). All environments are automatically configured with:
- Cosmos DB connection
- Application Insights
- Azure Communication Services (QA/prod)
Before you begin, ensure you have the following installed on your system (macOS, Windows, or Linux):
-
Node.js 20+ - Download
- Verify:
node --version(should be v20 or higher)
- Verify:
-
Docker & Docker Compose - Download
- Verify:
docker --versionanddocker-compose --version - Windows Users: Docker Desktop for Windows recommended
- Linux Users: Install Docker Engine and Docker Compose separately
- macOS Users: Docker Desktop for Mac recommended
- Verify:
-
Git - Download
- Verify:
git --version
- Verify:
-
VS Code - Download
- Install extension: Azure Functions (ms-azuretools.vscode-azurefunctions)
- Azure CLI - Download
- Only needed if deploying to Azure
- Verify:
az --version
node --version # Should be v20+
docker --version # Docker version
docker-compose --version # Docker Compose version
git --version # Git versionAll prerequisites work the same way on Windows, macOS, and Linux.
GitHub Codespaces - No installation required, develop entirely in the browser:
- Click:
- Wait ~60 seconds for container to build
- Press F5 in VS Code (browser-based)
- Click notification to open frontend in browser
β Zero setup! Everything pre-configured and running.
Run everything on your machine:
# Clone repository
git clone https://github.com/dsanchezcr/secretsanta.git
cd secretsanta
# Start full-stack (Docker + API + Frontend)
npm install
cd api && npm install
cd ..
# Then press F5 in VS Code to debug, OR:
docker-compose up -d # Start Docker containers
npm run dev # Frontend dev server
cd api && npm start # API in separate terminalOpen: http://localhost:5173
π Full Local Development Guide
-
Fork this repository
-
Configure GitHub OIDC Authentication:
# Create service principal az ad sp create-for-rbac --name "secretsanta-github" \ --role contributor \ --scopes /subscriptions/{subscription-id} --json-auth
-
Add GitHub Secret (Settings β Secrets):
AZURE_CREDENTIALS- Paste the entire JSON output from the command above
-
Create Production Resource Group:
az group create --name secretsanta --location centralus
-
Open a PR - Full infrastructure is created automatically!
See docs/github-deployment.md for detailed setup instructions.
The fastest way to get running is with VS Code's integrated debugger:
# 1. Clone repository
git clone https://github.com/dsanchezcr/secretsanta.git
cd secretsanta
# 2. Start Docker containers (all platforms)
docker-compose up -d
# 3. Open in VS Code
code .In VS Code:
- Press
F5(or Ctrl+Shift+D then click play button) - Select "π Full Stack (Frontend + API + Emulators)"
- App automatically opens at
http://localhost:5173
Or use GitHub Codespaces (no local setup needed):
- Fork this repository
- Click "Code" β "Codespaces" β "Create codespace on main"
- Wait for container to start
- Press
F5to start debugging - App opens at the Codespace URL
See docs/getting-started.md for detailed setup instructions.
βββ src/ # React frontend
β βββ components/ # UI components (views, forms, dialogs)
β βββ lib/ # Utilities, types, translations
β βββ hooks/ # Custom React hooks
βββ api/ # Azure Functions backend
β βββ src/
β βββ functions/ # HTTP endpoints + timer triggers
β βββ shared/ # Cosmos DB, email, telemetry
βββ e2e/ # Playwright E2E tests
βββ infra/ # Bicep infrastructure templates
βββ .github/workflows/ # CI/CD pipeline
- HomeView: Landing page with game code entry
- CreateGameView: Game creation form with date validation
- GameCreatedView: Success page with organizer token
- ParticipantSelectionView: Participant login for protected games
- AssignmentView: Shows who you're buying for
- OrganizerPanelView: Full game management (includes delete)
- PrivacyView: Data handling and retention policy
- GameNotFoundView: Error page for deleted/invalid games
| Variable | Description | Auto-Set |
|---|---|---|
COSMOS_ENDPOINT |
Cosmos DB endpoint URL | β |
COSMOS_KEY |
Cosmos DB primary key | β |
COSMOS_DATABASE_NAME |
Database name | β |
COSMOS_CONTAINER_NAME |
Container name | β |
APPLICATIONINSIGHTS_CONNECTION_STRING |
App Insights connection | β |
APPINSIGHTS_INSTRUMENTATIONKEY |
App Insights key | β |
APP_BASE_URL |
Application URL | β |
ACS_CONNECTION_STRING |
Email service connection | β * |
ACS_SENDER_ADDRESS |
Email sender address | β * |
ENVIRONMENT |
Environment name (pr/qa/prod) | β |
BUILD_VERSION |
Build version identifier | β |
BUILD_DATE |
Deployment timestamp | β |
*Only in QA/production with email enabled
| Secret | Description |
|---|---|
AZURE_CREDENTIALS |
Complete JSON from az ad sp create-for-rbac command (includes appId, tenant, subscriptionId, password) |
Resource group names and deployment URLs are now dynamically generated and output from the infrastructure deployment steps.
# API unit tests
cd api && npm test
# E2E tests
npm run test:e2e
# E2E with UI
npm run test:e2e:ui| Stage | Trigger | Description |
|---|---|---|
| Build & Test | All PRs and main | Lint, build, unit tests |
| PR Infrastructure | PR opened | Create resource group + dedicated SWA |
| Preview | PRs | Deploy to PR Static Web App |
| Close PR | PR closed | Delete resource group |
| QA Infrastructure | Main merge | Deploy QA Static Web App |
| QA | Main merge | Deploy to QA |
| E2E (QA) | After QA deploy | Run E2E against QA |
| Production Infrastructure | After QA E2E | Deploy production SWA |
| Production | After E2E | Manual approval required |
Each environment includes Application Insights for:
- Error tracking and diagnostics
- Performance monitoring
- Custom event logging
GET /api/health- Full diagnostics (version, uptime, dependencies)GET /api/health/live- Liveness probeGET /api/health/ready- Readiness probe (checks database)
- Auto-Deletion: Games are automatically deleted 3 days after their event date
- Manual Deletion: Organizers can delete games at any time from the Organizer Panel
- Privacy: See the in-app Privacy page for full data handling details
- No External Sharing: Data is never shared with third parties
MIT - See LICENSE
See CONTRIBUTING.md for guidelines.