glimpse2-runbook-webhooks2
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
main.tsx
https://lightweight--01988e9dbeb77378ab87710114810b44.web.val.run
A Val Town application for managing and viewing demos with authentication.
- Authentication: Google OAuth via LastLogin
- Dashboard: User-friendly interface showing system status
- Health Monitoring: Real-time system health checks
- Modular Architecture: Clean separation of concerns
This application uses LastLogin for user authentication and implements webhook authentication for external integrations:
- Login: Users sign in with their Google account
- Protected Routes: Most routes require user authentication
- Logout: Users can logout via
/auth/logout
(handled automatically by LastLogin) - Session Management: Automatic session validation and renewal
- Webhook Routes:
/tasks/*
routes use API key authentication - X-API-KEY Header: Required for all webhook endpoints
- Secret Validation: Uses
NOTION_WEBHOOK_SECRET
environment variable - Security: Implements constant-time comparison to prevent timing attacks
The following routes are accessible without authentication:
/api/health
- System health status
User Authentication Required:
/
- Main dashboard (shows user info and system status)/api/*
- API endpoints (except health)/views/*
- View routes
Webhook Authentication Required:
/tasks/test
- Webhook authentication test endpoint/tasks/notion-webhook
- Main Notion webhook endpoint/tasks/debug-webhook
- Webhook configuration debug endpoint (GET only, bypasses auth)
├── backend/
│ ├── controllers/ # Business logic controllers
│ ├── routes/ # Route definitions
│ │ ├── api/ # API endpoints
│ │ ├── tasks/ # Task-related routes
│ │ ├── views/ # User-facing views
│ │ └── authCheck.ts # User authentication middleware
│ │ └── webhookAuthCheck.ts # Webhook authentication middleware
│ └── services/ # External service integrations
├── frontend/ # Frontend assets
├── shared/ # Shared utilities
└── main.tsx # Application entry point
The application is built with:
- Hono: Web framework for routing and middleware
- LastLogin: Authentication service
- TypeScript: Type-safe development
- Val Town: Hosting platform
Configure these environment variables for full functionality:
GLANCE_DEMOS_DB_ID
- Notion database ID for demosGLANCE_CONTENT_DB_ID
- Notion database ID for contentGLANCE_INTERACTIONS_DB_ID
- Notion database ID for interactionsNOTION_API_KEY
- Notion API key for database access
NOTION_WEBHOOK_SECRET
- Secret key for webhook authentication (required for/tasks/*
endpoints)