A full-stack web application built for hands-on debugging workshops that demonstrate realistic SSO authentication and search functionality failures using Sentry monitoring and distributed tracing.
The Sentry Academy Application is an educational platform that simulates a course management system with user authentication, course browsing, and search functionality. It's specifically designed to showcase common real-world debugging scenarios where frontend and backend teams have miscommunications about API contracts.
- SSO Authentication - Google, Microsoft, and Okta login integration
- Course Management - Browse courses with categories, levels, and detailed content
- Search Functionality - Search courses with filtering capabilities
- User Profiles - Student, instructor, and admin role management
- Progress Tracking - Lesson completion and enrollment tracking
- Monitoring & Observability - Comprehensive Sentry integration for error tracking
- JWT Authentication Debugging - SSO login failures due to missing login signatures
- Search Functionality Debugging - API parameter mismatches with distributed tracing
This is a pnpm monorepo with two main applications:
βββ apps/
β βββ frontend/ # React + Vite frontend application
β βββ server/ # Node.js + Express backend server
βββ scripts/ # Shared utility scripts
βββ workshop.md # Detailed workshop instructions
βββ pnpm-workspace.yaml # pnpm workspace configuration
βββ package.json # Root workspace package.json
- Framework: React 19.1.0 with TypeScript and Vite
- Styling: Tailwind CSS 4.1.8
- Routing: React Router DOM 7.6.2
- State Management: React contexts (AuthContext, UserStateContext)
- Monitoring: Sentry React SDK for error tracking and performance
- Key Features:
- Modern React with hooks and contexts
- Responsive design with Tailwind CSS
- SSO authentication flows
- Course browsing and search interface
- User profile and progress tracking
- Framework: Express 5.1.0 with TypeScript
- Database: PostgreSQL with Drizzle ORM 0.44.2
- Build: esbuild for production builds
- Development: tsx for hot reload
- Monitoring: Sentry Node SDK with profiling and distributed tracing
- Key Features:
- RESTful API with modular route structure
- JWT-based authentication with SSO providers
- Course and user management
- Search functionality with filtering
- Comprehensive error handling and monitoring
- users - User accounts with roles (student, instructor, admin)
- courses - Course catalog with categories, levels, and metadata
- lessons - Individual lessons within courses (video, text, quiz, assignment)
- enrollments - User-course relationships with progress tracking
- lessonProgress - Detailed progress tracking per lesson
- reviews - Course reviews and ratings
- categories - Course categorization
- certificates - Course completion certificates
- Node.js (v18 or higher)
- pnpm (v9 or higher)
- OpenAI API Key (for AI-powered features)
For workshop participants, follow these steps:
-
Clone and install dependencies:
git clone <repository-url> cd sentry-academy-workshop pnpm install
-
Database setup with Neon:
cd apps/server npx neondb -y # Creates a PostgreSQL database (Neon is awesome!) npx drizzle-kit push # Push schema to database pnpm db:seed # Seed with course data
-
Environment configuration:
Server (
apps/server/.env):PORT=3001 DATABASE_URL=<from-neon-setup> OPENAI_API_KEY=your-openai-api-key SENTRY_DSN=your-sentry-dsn
Frontend (
apps/frontend/.env):VITE_API_URL=http://localhost:3001 VITE_SENTRY_DSN=your-sentry-dsn
-
Update Sentry configuration:
- Update Sentry initialization in both apps with your project details
- See
apps/frontend/src/main.tsxandapps/server/src/index.ts
-
Start the application:
cd ../.. # Back to root directory pnpm dev
If you prefer to set up PostgreSQL manually:
- Install and configure PostgreSQL
- Create database:
CREATE DATABASE sentry_academy;
- Run migrations:
cd apps/server pnpm db:generate pnpm db:migrate pnpm db:seed
Once everything is running:
- Frontend:
http://localhost:5173- React application with course browsing and authentication - Backend:
http://localhost:3001- Express API server - Database Studio:
pnpm db:studio- Drizzle Studio for database management
You'll see the Sentry Academy homepage with:
- Course catalog browsing
- Search functionality
- SSO login options (Google, Microsoft, Okta)
- User profile and progress tracking
pnpm dev- Start both frontend and server in development modepnpm dev:frontend- Start only the frontend applicationpnpm dev:server- Start only the server applicationpnpm build- Build both applications for productionpnpm build:frontend- Build only the frontendpnpm build:server- Build only the serverpnpm lint- Run linting on all packages
pnpm dev- Start Vite development serverpnpm build- Build for productionpnpm lint- Run ESLintpnpm preview- Preview production build
pnpm dev- Start development server with hot reloadpnpm build- Build for production using esbuildpnpm start- Start production serverpnpm db:generate- Generate database migrationspnpm db:migrate- Run database migrationspnpm db:push- Push schema changes to databasepnpm db:studio- Open Drizzle Studio for database managementpnpm db:seed- Seed database with initial datapnpm db:create-readonly-user- Create read-only database user
Scenario: Frontend generates JWT tokens from SSO providers but doesn't always send them to the backend, causing authentication failures.
Key Learning Points:
- API contract mismatches between teams
- JWT token flow and validation
- Unhandled error debugging
- Sentry error capture and analysis
Steps:
- Try SSO login (Google, Microsoft, Okta)
- Observe backend crashes from
JSON.parse(atob(undefined)) - Debug using API testing
- Fix missing login signature issues
Scenario: Frontend and backend teams have different assumptions about search API parameters, leading to "no results found" errors.
Key Learning Points:
- Search API integration patterns
- Parameter name mismatches (
queryvsq) - Distributed tracing implementation
- Performance monitoring with spans
Steps:
- Experience search failures
- Implement custom tracing spans
- Analyze trace data to identify root cause
- Fix parameter mismatches
The server provides several REST API endpoints:
GET /api/courses- List all courses with paginationGET /api/search/courses?q=term- Search courses (note: usesqparameter)POST /api/auth/sso/:provider- SSO authentication (Google, Microsoft, Okta)GET /api/lessons- List lessons with course relationshipsGET /api/users- List users with role informationGET /api/enrollments- List user course enrollments with progress
Both applications are pre-configured with Sentry for:
- React error boundaries
- Performance monitoring
- User session tracking
- Custom event tracking
- Express.js error handling
- Database query performance
- API endpoint monitoring
- Profiling and performance metrics
- Custom spans for API calls
- Database operation tracing
- Search functionality tracing
- Authentication flow tracking
The application uses PostgreSQL with Drizzle ORM for type-safe database operations.
pnpm db:generate- Generate database migrationspnpm db:migrate- Run database migrationspnpm db:seed- Seed database with sample datapnpm db:studio- Open Drizzle Studio for database managementpnpm db:export- Export database data to JSON filespnpm db:import- Import database data from JSON files
- users - User accounts with roles (student, instructor, admin)
- courses - Course catalog with categories and metadata
- lessons - Individual lessons within courses
- enrollments - User-course relationships with progress tracking
-
Authentication Errors:
curl -X POST http://localhost:3001/api/auth/sso/google \ -H "Content-Type: application/json" \ -d '{"userData": {"email": "[email protected]", "name": "Test User"}}'
-
Search API Testing:
# This will fail (missing query parameter) curl -X GET "http://localhost:3001/api/search/courses" # This will succeed curl -X GET "http://localhost:3001/api/search/courses?q=javascript"
After completing this workshop, you'll understand:
- β Real-world API contract debugging
- β JWT authentication flows and common pitfalls
- β Search API implementation patterns
- β Error monitoring with Sentry
- β Distributed tracing for microservices
- β Frontend/backend communication debugging
- β Production debugging workflows
- Workshop Guide: See
workshop.mdfor detailed step-by-step instructions - Sentry Documentation: docs.sentry.io
- Drizzle ORM: orm.drizzle.team
- React 19 Features: react.dev
This is a workshop project designed for learning. Feel free to experiment with:
- Adding new authentication providers
- Implementing additional search filters
- Creating custom Sentry integrations
- Extending the tracing implementation
Happy Debugging! ππ