How algoamigoo/micdrop-backend works
MicDrop is a Go API for a crowdsourced comedy platform. Users authenticate, create and browse prompts, add responses, and vote; profiles expose user details and activity. The graph follows HTTP routing through handlers into persistence, and keeps prompt, response, profile, and voting responsibilities distinct. Source excerpts show startup, routing, selected handlers, and SQL behavior; unsampled handler implementations and some runtime wiring are not inferred beyond documented capabilities.
Main entry points: router.go Route dispatch · main.go HTTP server · auth.go OAuth and signup · prompts.go Prompt endpoints
Components 20
HTTP API
- HTTP server
cmd/server/main.go - Route dispatch
internal/router/router.go - Session middleware
internal/middleware/auth.go - Response handling
internal/handlers/handlers.go - Environment config
internal/config/config.go
Identity
- OAuth and signup
internal/handlers/auth.go - User profiles
internal/handlers/users.go
Comedy content
- Prompt endpoints
internal/handlers/prompts.go - Response endpoints
internal/handlers/responses.go - Domain models
internal/models/models.go
Community signals
- Vote endpoints
internal/handlers/votes.go
Persistence
- User persistence
internal/repository/users.go - Prompt persistence
internal/repository/prompts.go - Response persistence
internal/repository/responses.go - Vote transactions
internal/repository/votes.go - Repository wiring
internal/repository/users.go - DB connection
internal/db/db.go
Other components
- API client
- Google OAuth
- PostgreSQL
Connections 23
- API client → HTTP server: sends requests
README.md - HTTP server → Environment config: loads config
cmd/server/main.go - HTTP server → DB connection: connects to
cmd/server/main.go - HTTP server → Repository wiring: creates repository
cmd/server/main.go - HTTP server → Route dispatch: builds routes
cmd/server/main.go - Route dispatch → OAuth and signup: routes auth
internal/router/router.go - Route dispatch → User profiles: routes profiles
internal/router/router.go - Route dispatch → Prompt endpoints: routes prompts
internal/router/router.go - Route dispatch → Response endpoints: routes responses
internal/router/router.go - Route dispatch → Vote endpoints: routes votes
internal/router/router.go - Route dispatch → Session middleware: applies auth
internal/router/router.go - OAuth and signup → Google OAuth: exchanges OAuth
internal/handlers/auth.go - OAuth and signup → User persistence: creates users
internal/handlers/auth.go - User profiles → User persistence: reads and updates
internal/handlers/users.go - Prompt endpoints → Prompt persistence: reads and creates
internal/handlers/prompts.go - Response endpoints → Response persistence: delegates
- Vote endpoints → Vote transactions: delegates
- Repository wiring → DB connection: uses connection
- User persistence → PostgreSQL: queries
- Prompt persistence → PostgreSQL: queries
internal/repository/prompts.go - Response persistence → PostgreSQL: queries
internal/repository/responses.go - Vote transactions → PostgreSQL: updates votes and scores
internal/repository/votes.go - Prompt endpoints → Domain models: returns prompt data