How jakecleary/pocketmongrels works
PocketMongrels is an HTTP-driven Tamagotchi-like game. Clients create and manage users and their animals, then feed or pet an animal; its hunger and happiness are calculated from elapsed time and its type. The API also has a meta endpoint, though its behavior is not described in the available excerpts. The sampled code shows in-memory repositories wired through startup, and action controllers calling services. Resource conversion and some endpoint behavior are visible, but several implementation details were not sampled.
Main entry points: Startup.cs API Startup · UsersController.cs Users API · ActionsController.cs Actions API · UserService.cs User Operations
Components 17
HTTP API
- API Startup
src/JakeCleary.PocketMongrels.Api/Startup.cs - Users API
src/JakeCleary.PocketMongrels.Api/Controller/UsersController.cs - Animals API
src/JakeCleary.PocketMongrels.Api/Controller/AnimalsController.cs - Actions API
src/JakeCleary.PocketMongrels.Api/Controller/ActionsController.cs - Meta API
src/JakeCleary.PocketMongrels.Api/Controller/MetaController.cs - Model Validation
src/JakeCleary.PocketMongrels.Api/Filter/ModelValidator.cs - API Resources
src/JakeCleary.PocketMongrels.Api.Resources
Game Domain
- Animal Metrics
src/JakeCleary.PocketMongrels.Core/Animal.cs - User Model
src/JakeCleary.PocketMongrels.Core/User.cs - Unique Entity ID
src/JakeCleary.PocketMongrels.Core/IGloballyUniqueEntity.cs
Application Services
- Animal Actions
src/JakeCleary.PocketMongrels.Services/AnimalService.cs - User Operations
src/JakeCleary.PocketMongrels.Services/UserService.cs
In-Memory Storage
- Animal Repository Contract
src/JakeCleary.PocketMongrels.Data/IAnimalRepository.cs - User Repository Contract
src/JakeCleary.PocketMongrels.Data/IUserRepository.cs - Animal Repository
src/JakeCleary.PocketMongrels.Data.InMemory/AnimalRepository.cs - User Repository
src/JakeCleary.PocketMongrels.Data.InMemory/UserRepository.cs
Other components
- HTTP Client
Connections 24
- HTTP Client → Users API: manages users
src/JakeCleary.PocketMongrels.Api/Controller/UsersController.cs - HTTP Client → Animals API: manages animals
src/JakeCleary.PocketMongrels.Api/Controller/AnimalsController.cs - HTTP Client → Actions API: requests actions
src/JakeCleary.PocketMongrels.Api/Controller/ActionsController.cs - API Startup → Users API: registers controllers
src/JakeCleary.PocketMongrels.Api/Startup.cs - API Startup → Actions API: registers controllers
src/JakeCleary.PocketMongrels.Api/Startup.cs - API Startup → User Operations: registers service
src/JakeCleary.PocketMongrels.Api/Startup.cs - API Startup → Animal Actions: registers service
src/JakeCleary.PocketMongrels.Api/Startup.cs - API Startup → User Repository: registers repository
src/JakeCleary.PocketMongrels.Api/Startup.cs - API Startup → Animal Repository: registers repository
src/JakeCleary.PocketMongrels.Api/Startup.cs - Users API → User Operations: calls
src/JakeCleary.PocketMongrels.Api/Controller/UsersController.cs - Users API → API Resources: maps responses
src/JakeCleary.PocketMongrels.Api/Controller/UsersController.cs - Users API → Model Validation: validates input
src/JakeCleary.PocketMongrels.Api/Controller/UsersController.cs - Animals API → User Repository Contract: looks up user
src/JakeCleary.PocketMongrels.Api/Controller/AnimalsController.cs - Animals API → API Resources: maps responses
src/JakeCleary.PocketMongrels.Api/Controller/AnimalsController.cs - Actions API → User Operations: finds user
src/JakeCleary.PocketMongrels.Api/Controller/ActionsController.cs - Actions API → Animal Actions: applies action
src/JakeCleary.PocketMongrels.Api/Controller/ActionsController.cs - Animal Actions → Animal Metrics: updates metrics
src/JakeCleary.PocketMongrels.Services/AnimalService.cs - User Operations → User Repository Contract: uses repository
src/JakeCleary.PocketMongrels.Services/UserService.cs - User Repository → User Repository Contract: implements
src/JakeCleary.PocketMongrels.Data.InMemory/UserRepository.cs - Animal Repository → Animal Repository Contract: implements
src/JakeCleary.PocketMongrels.Data.InMemory/AnimalRepository.cs - User Repository → User Model: stores users
src/JakeCleary.PocketMongrels.Data.InMemory/UserRepository.cs - Animal Repository → Animal Metrics: stores animals
src/JakeCleary.PocketMongrels.Data.InMemory/AnimalRepository.cs - User Model → Unique Entity ID: implements identity
src/JakeCleary.PocketMongrels.Core/User.cs - Animal Metrics → Unique Entity ID: implements identity
src/JakeCleary.PocketMongrels.Core/Animal.cs