How barkhai-ux/api_provider works
Ubhub is a Mongolia-focused location API and developer platform. A customer submits a versioned geocoding, reverse-geocoding, or routing request; the API authorizes and rate-limits it through Convex, obtains location data through the ArcGIS adapter, and returns the public contract. The website adds an isolated public-map demo, account and key management, a playground, billing, and live usage views; an SDK supports customer applications. The README documents these cross-service flows and capabilities; several web and Convex internals are unsampled, so their finer-grained links are not inferred.
Main entry points: main.py FastAPI application · factory.py Provider factory · usage.ts Usage and rollups · overview-view.tsx Console dashboard
Components 32
Website
- Public map and demo
apps/web/components/map/map-app.tsx - Developer portal
apps/web/app/(site)/developers/page.tsx - Account screens
apps/web/components/auth/login-form.tsx - Console dashboard
apps/web/components/dashboard/overview-view.tsx - API playground
apps/web/components/playground/playground.tsx - Playground token route
apps/web/app/api/playground/token/route.ts
Public API
- FastAPI application
apps/api/app/main.py - Versioned endpoints
apps/api/app/api/v1/routing.py - Demo endpoints
apps/api/app/api/demo.py - Request authorization
apps/api/app/api/deps.py - Request controls
apps/api/app/core/middleware.py - Convex gateway client
apps/api/app/services/gateway.py - Usage recorder
apps/api/app/services/usage.py - API caches
apps/api/app/services/cache.py
Geo Services
- Provider factory
apps/api/app/services/geo/factory.py - Geocoding services
apps/api/app/services/geo/geocoding.py - Routing service
apps/api/app/services/geo/routing.py - Road graph and search
apps/api/app/services/geo/road_graph.py - ArcGIS REST adapter
apps/api/app/services/arcgis/client.py - ArcGIS authentication
apps/api/app/services/arcgis/auth.py - ArcGIS providers
apps/api/app/services/arcgis/providers.py
Accounts and Operations
- Accounts and sessions
apps/convex/convex/auth.ts - API keys
apps/convex/convex/apiKeys.ts - Gateway authorization
apps/convex/convex/gateway.ts - Usage and rollups
apps/convex/convex/usage.ts - Billing and payments
apps/convex/convex/payments.ts - Platform data model
apps/convex/convex/schema.ts
Client SDK
- TypeScript API client
packages/api-client/src/client.ts - Shared API types
packages/types/src/index.ts
Other components
- Browser users
- Customer apps
- ArcGIS FeatureServer
Connections 37
- Browser users → Public map and demo: uses map
- Browser users → Developer portal: visits portal
- Browser users → Account screens: signs in
- Browser users → Console dashboard: views console
- Browser users → API playground: tries API
- Customer apps → FastAPI application: sends requests
- Public map and demo → FastAPI application: calls demo API
- API playground → FastAPI application: calls public API
- Playground token route → API keys: issues token
apps/web/app/api/playground/token/route.ts - Console dashboard → Usage and rollups: subscribes live
- Account screens → Accounts and sessions: authenticates
- FastAPI application → Versioned endpoints: mounts routes
apps/api/app/main.py - FastAPI application → Demo endpoints: mounts routes
apps/api/app/main.py - Versioned endpoints → Request authorization: requires principal
apps/api/app/api/v1/routing.py - FastAPI application → Request controls: applies middleware
apps/api/app/core/middleware.py - Request authorization → Convex gateway client: authorizes key
apps/api/app/api/deps.py - Request authorization → API caches: caches key data
apps/api/app/api/deps.py - Convex gateway client → Gateway authorization: calls gateway
- Usage recorder → Usage and rollups: records usage
- Versioned endpoints → Provider factory: uses geo services
- Demo endpoints → Provider factory: uses geo services
apps/api/app/api/demo.py - Provider factory → Geocoding services: provides geocoding
- Provider factory → Routing service: provides routing
- Provider factory → ArcGIS providers: wires providers
- Routing service → Road graph and search: uses road graph
- ArcGIS providers → ArcGIS REST adapter: uses adapter
- ArcGIS REST adapter → ArcGIS authentication: uses token provider
apps/api/app/services/arcgis/client.py - ArcGIS REST adapter → ArcGIS FeatureServer: queries layers
- FastAPI application → Usage recorder: records requests
apps/api/app/main.py - TypeScript API client → FastAPI application: calls /v1
- TypeScript API client → Shared API types: uses types
packages/api-client/src/client.ts - Gateway authorization → API keys: checks credentials
- Gateway authorization → Usage and rollups: tracks requests
- API keys → Platform data model: stores key records
- Usage and rollups → Platform data model: stores usage data
- Console dashboard → Billing and payments: manages billing
- Accounts and sessions → Platform data model: stores account data