Glance Demos Platform

A Val Town application for managing and viewing Notion-based demo content with webhook integration.

Architecture

This application follows a strict layered architecture:

  • Services (/backend/services/) - Pure API calls to external systems
  • Controllers (/backend/controllers/) - Business logic and orchestration
  • Routes (/backend/routes/) - HTTP request/response handling

API Endpoints

Authentication Required (Google OAuth)

  • GET / - Dashboard with system health and demo links
  • GET /api/health - System health status (public)
  • GET /views/glimpse/:id - Notion page data with related content as JSON (filtered for data consumption)
  • GET /glimpse/:id - Same as above, alternative endpoint

Webhooks (Notion Integration)

All webhook endpoints require X-API-KEY header with NOTION_WEBHOOK_SECRET value.

  • POST /tasks/test - Test webhook authentication
  • POST /tasks/url - Update Notion page with glimpse URL (requires X-API-KEY header)
  • POST /tasks/notion-webhook - General Notion webhook handler (requires X-API-KEY header)
  • GET /tasks/debug-webhook - Check webhook configuration (requires X-API-KEY header)

Environment Variables

Required environment variables (add to vars.env):

  • NOTION_API_KEY - Notion integration API key
  • NOTION_WEBHOOK_SECRET - Secret for webhook authentication
  • GLANCE_DEMOS_DB_ID - Notion database ID for demos
  • GLANCE_CONTENT_DB_ID - Notion database ID for content
  • GLANCE_INTERACTIONS_DB_ID - Notion database ID for interactions

Features

  • Google OAuth Authentication - Secure user authentication via LastLogin
  • Notion Integration - Read and update Notion pages and databases
  • Webhook Support - Automated URL updates from Notion
  • Health Monitoring - System status and database connectivity checks
  • Interactive Dashboard - Test endpoints and view demo links

Development

The application uses:

  • Hono - Web framework for API routes
  • LastLogin - Authentication service
  • Notion API - Database and page management
  • TypeScript - Type safety and development experience