Source of truth for student learning state — stores knowledge graph, skill history, XP, and preferences for personalized adaptive learning.
- Maintain student Knowledge Graph (skills, mastery levels, connections)
- Track attempt history (problems solved, time spent, errors)
- Calculate and update XP / level progression
- Provide profile data to Mentor service on demand
- Auto-create profiles on Ory Kratos registration webhook (CloudEvents)
- Cache profiles in Redis for fast reads
- Language: Go 1.25.7
- Framework: Gin (HTTP), GORM (ORM)
- Database: PostgreSQL (persistent), Redis (cache)
- Events: Kafka pub/sub (CloudEvents)
- API Docs: Swagger/OpenAPI
- Testing: Go testing + testify, Grafana k6
- Inbound: REST API (GET/PUT /profiles/{id}), Kratos webhook (POST /webhooks/registration)
- Outbound: None (passive data provider)
- Subscribes:
identity.registration.completed(auto-create profile) - Subscribes:
task.attempt.completed(update skills/XP)
- PostgreSQL: profiles, skills, attempt_history tables
- Redis: Profile cache with TTL, invalidated on mutations
DB_PASSWORD— PostgreSQL passwordREDIS_PASSWORD— Redis password- Vault path:
secret/data/{env}/mathtrail-profile/
Standard infra/ layout:
infra/helm/— Helm chart + environment overlays (dev, on-prem, cloud)infra/terraform/— Database module (K8s pod vs managed RDS)infra/ansible/— On-prem node preparation
just dev— Skaffold dev loopjust test— Go unit testsjust swagger— regenerate API docs
- Implement Knowledge Graph data model (skills → topics → prerequisites)
- Add Kafka pub/sub handler for
task.attempt.completedevents - Build Redis cache layer with write-through invalidation