A desktop coding agent with free access to frontier models.
TypeScript
Middleware
This folder contains reusable Hono middleware that route areas can compose as needed.
Files
index.ts: public export surface for all shared middlewareadmin.ts: requires an authenticated allowlisted admincurrent-user.ts: requires an authenticated useruser-organizations.ts: loads the orgs the current user belongs toorganization-context.ts: loads org + current member context for:orgSlugroutesmember-teams.ts: loads the teams the current org member belongs tovalidation.ts: shared Hono Zod validator wrappers for JSON, query, and params
Available context
c.get("user"): current authenticated userc.get("session"): current Better Auth sessionc.get("userOrganizations"): orgs for the current userc.get("activeOrganizationId")c.get("activeOrganizationSlug")c.get("organizationContext"): org record, current member, members, invites, rolesc.get("memberTeams"): teams for the current org member
Usage pattern
Import from src/middleware/index.ts:
import {
jsonValidator,
paramValidator,
requireUserMiddleware,
resolveOrganizationContextMiddleware,
} from "../../middleware/index.js"
Then compose only what a route needs.
Rule of thumb
- If a value is broadly useful across multiple route areas, put it here
- If a helper only exists for one route area, keep it in that route folder instead