How sinkaroid/matoi works
Matoi is a unified REST and GraphQL gateway that normalizes results from 15 booru providers into a shared post schema. The principal request path is client → Fiber routing and authentication → REST handler → provider → upstream imageboard; handlers cache results, add proxy-media URLs, and return normalized JSON. GraphQL offers parallel post and tag-completion operations. Configuration and Prometheus metrics are supporting runtime capabilities. The README and selected excerpts establish the main wiring; individual provider implementations and several handler files were not all sampled, so their internal details are not expanded.
Main entry points: router.go Route registry · handlers REST handlers · graphql.go GraphQL API · providers Booru providers
Components 12
API surface
- Fiber server
main.go - Route registry
router/router.go - API key auth
middleware/auth.go - REST handlers
handlers - GraphQL API
handlers/graphql.go
Provider integration
- Normalized posts
models/post.go - Booru providers
providers
Runtime services
- Redis cache
cache/redis.go - Configuration
config/config.go - Prometheus metrics
middleware/prometheus.go
Other components
- API client
- Booru services
Connections 15
- API client → Fiber server: sends request
- Fiber server → Route registry: sets up routes
main.go - Route registry → API key auth: protects API
router/router.go - Route registry → REST handlers: routes requests
router/router.go - Route registry → GraphQL API: routes GraphQL
router/router.go - Route registry → Prometheus metrics: installs middleware
router/router.go - REST handlers → Booru providers: fetches and completes
handlers/rule34.go - GraphQL API → Booru providers: resolves queries
handlers/graphql.go - Booru providers → Booru services: fetches provider data
- Booru providers → Normalized posts: normalizes results
- REST handlers → Redis cache: reads and writes cache
handlers/rule34.go - GraphQL API → Redis cache: reads cache
handlers/graphql.go - REST handlers → Normalized posts: returns JSON
- GraphQL API → Normalized posts: returns post results
handlers/graphql.go - Fiber server → Configuration: loads settings
main.go