2.4 KiB
2.4 KiB
Session Changelog - January 1, 2026
Production Setup Session
What Was Done
-
Backend Setup
- Copied working
server.tsfrom Job-Info-Test - Added
redis-cache.tsfor Valkey/Redis caching - Fixed static file path to serve from
frontend/public - Fast job loading: returns first 40 jobs instantly, then full list on poll
- Copied working
-
Frontend Setup
- Copied working frontend from Job-Info-Test to
frontend/public/ - Simplified token validation at startup:
- Check PocketBase session valid
- Check Graph token in localStorage
- If either missing → redirect to signin
- Removed redundant token refresh loops
- Added localStorage storage for Graph token in signin.html
- Copied working frontend from Job-Info-Test to
-
Authentication Flow
- PocketBase OAuth with Microsoft provider
- Graph token stored in localStorage after signin
- Both tokens checked once at page load
- No repeated token validation during app usage
-
Systemd Service
- Created
/etc/systemd/system/job-info-prod.service - Runs on port 3005
- Auto-restarts on failure
- Created
-
Git Repository
- Initialized and pushed to: https://gitea.ccllc.pro/Cardoza_Construction/Job-Info-Prod.git
- Branch: main
Key Files
| File | Purpose |
|---|---|
backend/src/index.ts |
Main Hono server with all endpoints |
backend/src/redis-cache.ts |
Redis/Valkey cache helpers |
frontend/public/index.html |
Main app UI |
frontend/public/signin.html |
OAuth signin page (purple styling) |
frontend/public/auth.js |
PocketBase auth bootstrap |
Endpoints
GET /- Serve frontendGET /version- App versionGET /api/health- Health checkGET /api/jobs-all- All jobs (first 40 fast, then full)GET /api/jobs- Paginated jobsGET /api/job-files- SharePoint files via Graph APIGET /api/job-file-content- File content/downloadGET /api/job-file-pdf- PDF proxyPOST /log-change- Log changes
Configuration
- Port: 3005
- PocketBase: https://pocketbase.ccllc.pro
- Collection: pbc_1407612689
- Redis/Valkey: localhost:6379
Known Limitations
- Graph tokens expire after ~60 minutes (Microsoft limitation)
- No automatic Graph token refresh (would require direct OAuth flow)
- User must re-signin when Graph token expires
Next Steps
- Consider implementing direct Microsoft OAuth for refresh token support
- Add error boundaries for better UX on token expiry
- Performance monitoring