c0d32d7658
- Changed title to Mode1Svelte throughout frontend - Added mode indicator in bottom left with pulsing green dot - All tests passing and dashboard working
Mode1Svelte - Auth Module Test Suite
Self-contained test environment for the auth-module. This version is identical to Mode1 currently, serving as a foundation for future Svelte integration.
Structure
Mode1Svelte/
├── auth-module/ # Local copy of auth-module (not linked to root)
├── backend/ # Backend server with auth endpoints
│ └── server.ts # Hono app with Graph token and PB validation APIs
├── frontend/ # Frontend test interface
│ └── index.html # Interactive test dashboard
├── logs/ # Application logs
├── package.json # Dependencies (auth module + Hono + PocketBase)
└── bun.lock # Locked dependencies
Features
✓ Frontend Auth (PocketBaseAuth)
- OAuth2 login initialization
- Auth state retrieval
- Token refresh
- Logout
✓ Backend Auth (GraphTokenManager)
- Microsoft Graph token acquisition
- Token caching (with 60s expiration buffer)
- Cache validity checking
- Cache refresh
✓ PocketBase Validation (PocketBaseValidator)
- User token validation
- User record retrieval
- Token comparison (Graph vs PocketBase)
Running Mode1Svelte
Via Orchestrator (recommended)
# Switch to Mode1Svelte
curl -X POST http://localhost:3006/switch/Mode1Svelte
# Check status
curl http://localhost:3006/status
Direct
cd Mode1Svelte
bun install
PORT=3005 bun run backend/server.ts
Then visit: http://localhost:3005
Future: Svelte Integration
This project is set up as an independent Mode to eventually convert to SvelteKit while maintaining the same API endpoints and auth-module integration.
Structure
Mode1/
├── auth-module/ # Local copy of auth-module (not linked to root)
├── backend/ # Backend server with auth endpoints
│ └── server.ts # Hono app with Graph token and PB validation APIs
├── frontend/ # Frontend test interface
│ └── index.html # Interactive test dashboard
├── logs/ # Application logs
├── package.json # Dependencies (auth module + Hono + PocketBase)
└── bun.lock # Locked dependencies
Features Tested
✓ Frontend Auth (PocketBaseAuth)
- OAuth2 login initialization
- Auth state retrieval
- Token refresh
- Logout
✓ Backend Auth (GraphTokenManager)
- Microsoft Graph token acquisition
- Token caching (with 60s expiration buffer)
- Cache validity checking
- Cache refresh
✓ PocketBase Validation (PocketBaseValidator)
- User token validation
- User record retrieval
Running Mode1
Via Orchestrator (recommended)
# Switch to Mode1
curl -X POST http://localhost:3006/switch/Mode1
# Check status
curl http://localhost:3006/status
Direct
# Install dependencies (already done)
bun install
# Start server
bun run backend/server.ts
# Access dashboard
open http://localhost:3005
API Endpoints
Configuration
GET /api/auth/config- Get frontend configuration
Graph Token Management
GET /api/auth/graph/token- Get current Graph token (with expiration)POST /api/auth/refresh-graph- Force refresh Graph token
PocketBase Validation
POST /api/auth/validate-pb-token- Validate a PocketBase token
Health
GET /health- Health check
Environment Variables
Uses /home/admin/secrets/.env via auth-module:
CLIENT_ID- Microsoft application IDTENANT_ID- Azure tenant IDCLIENT_SECRET- Microsoft client secretPB_URL- PocketBase frontend URLPB_DB- PocketBase backend URL
Dependencies
All dependencies are installed locally in node_modules/:
hono- Web frameworkpocketbase- PocketBase client@azure/msal-node- Microsoft authenticationdotenv- Environment variable loading
Notes
- This Mode1 is completely self-contained with its own auth-module copy
- No dependencies on root auth-module
- Safe to modify and test independently
- All secrets come from
/home/admin/secrets/.env