aewing c08513636a Scale up caching: 1000 jobs + 5-job batches + 3-min refresh
- Increased from 300 to 1000 jobs for file pre-caching
- Increased batch size from 3 to 5 jobs per cycle
- Reduced batch delay from 3s to 2s for faster throughput
- Reduced refresh cycle from 5 minutes to 3 minutes
- Now caches all 2242 jobs at startup
- 538+ jobs with files continuously hot

Performance impact:
- Faster file availability across all users
- More comprehensive pre-cached coverage
- Quicker refresh cycles for latest data
2026-01-01 18:54:57 +00:00
2026-01-01 16:46:29 +00:00

Job-Info-Prod

Production-ready job information management system for field workers.

Features

  • Dual-Token Authentication: PocketBase + Microsoft Graph tokens
  • Always-Warm Cache: Background refresh loop keeps tokens fresh
  • Offline-First: Works without internet using cached data
  • Zero Re-Auth: Users never need to login again after initial auth

Tech Stack

  • Runtime: Bun
  • Backend: Hono
  • Auth: PocketBase + Microsoft OAuth
  • Cache: Redis/Valkey via ioredis
  • Frontend: TypeScript + Tailwind CSS

Quick Start

# Install dependencies
bun install

# Copy environment file
cp .env.example .env

# Edit .env with your configuration
nano .env

# Start development server
bun run dev

Environment Variables

See .env.example for all required variables:

  • PORT - Server port (default: 3000)
  • POCKETBASE_URL - PocketBase instance URL
  • MS_CLIENT_ID - Microsoft OAuth client ID
  • MS_CLIENT_SECRET - Microsoft OAuth client secret
  • MS_TENANT_ID - Microsoft tenant ID
  • REDIS_HOST - Redis/Valkey host
  • REDIS_PORT - Redis/Valkey port

Architecture

┌─────────────────┐     ┌──────────────────┐
│   Frontend      │────▶│   Hono Backend   │
│  (TypeScript)   │◀────│                  │
└─────────────────┘     └────────┬─────────┘
                                 │
        ┌────────────────────────┼────────────────────────┐
        ▼                        ▼                        ▼
┌───────────────┐      ┌─────────────────┐      ┌─────────────────┐
│   PocketBase  │      │  Redis/Valkey   │      │ Microsoft Graph │
│   (Auth+Data) │      │  (Token Cache)  │      │   (SharePoint)  │
└───────────────┘      └─────────────────┘      └─────────────────┘

Token Refresh Flow

  1. User completes OAuth flow → tokens stored in localStorage + cache
  2. Backend starts 30-min refresh loop per user
  3. Frontend checks backend for fresh tokens every 25 min
  4. If backend unreachable, frontend uses localStorage cache
  5. Stale tokens returned as fallback (field workers can't wait)

Scripts

  • bun run dev - Start development server with watch
  • bun run start - Start production server
  • bun run build:css - Build Tailwind CSS
  • bun run typecheck - Run TypeScript type checking
  • bun run test - Run tests

Folder Structure

Job-Info-Prod/
├── backend/
│   └── src/
│       ├── config/       # Environment and constants
│       ├── middleware/   # Auth, logging, error handling
│       ├── routes/       # API route handlers
│       ├── services/     # Business logic
│       └── index.ts      # Server entry point
├── frontend/
│   ├── public/           # Static HTML files
│   └── src/
│       ├── auth/         # Auth client
│       ├── components/   # UI components
│       ├── services/     # API clients
│       ├── styles/       # Tailwind CSS
│       └── app.ts        # Main app entry
└── shared/
    ├── constants/        # Shared constants
    └── types/            # TypeScript types

License

MIT

S
Description
No description provided
Readme 6.2 MiB
Languages
HTML 72.9%
TypeScript 19.4%
JavaScript 7.6%
CSS 0.1%