Skip to content

Repository files navigation

DevInsights

DevInsights is a portfolio sample project demonstrating production-oriented .NET development practices. It is a service-oriented ASP.NET Core application that aggregates and enriches developer profiles from Github, augmenting them with geographic and real-time weather data.

Note

This project was built as a work sample to demonstrate backend architecture, API design, CLI tooling, testing practices, and containerized deployment. It is fully functional and reflects real-world engineering standards.

Projects

The solution is composed of three projects:

DevInsights.Server

An ASP.NET Core Minimal API that forms the core of the system. It exposes a REST API for tracking Github developers and enriching their profiles with country metadata and current temperature data. Data is persisted in MongoDB.

Responsibilities:

  • REST API for developer tracking, retrieval, and removal
  • Profile enrichment via REST Countries and Open-Meteo APIs
  • Background synchronization via a hosted GithubSyncJob
  • Structured logging with Serilog
  • OpenAPI and Scalar documentation (development only)

Internal structure:

DevInsights.Server
├── BackgroundJobs     # Hosted synchronization service
├── Domain             # Core entity (Developer)
├── DTOs               # Internal data transfer types
├── Infrastructure     # Typed HTTP clients (Github, Weather, Country, Mongo)
├── Services           # Application logic (GithubService, WeatherService, CountryService)
└── Program.cs         # Composition root and endpoint definitions

DevInsights.Cli

A cross-platform command-line interface built with Spectre.Console.Cli for interacting with the DevInsights server.

Commands:

Command Description
track <username> Track a new Github developer
get <username> Get a tracked developer's enriched profile
get <username> --json Output enriched profile as raw JSON
list List all tracked developers
list --json Output developer list as raw JSON
sync Synchronise all tracked developers with latest data
remove <username> Remove a tracked developer
clear Remove all tracked developers

DevInsights.Tests

An xUnit-based test project containing integration and unit tests.

Coverage:

  • ApiIntegrationTests - full HTTP integration tests via WebApplicationFactory
  • GithubServiceTests - unit tests for tracking and sync logic
  • CountryServiceTests - unit tests for country resolution and fallback behaviour
  • WeatherServiceTests - unit tests for temperature resolution and geocoding fallback

CLI Usage

# Track a developer
devinsights track MrRobinOfficial

# Track and output as JSON
devinsights track MrRobinOfficial --json

# View enriched profile
devinsights get MrRobinOfficial

# View enriched profile as JSON
devinsights get MrRobinOfficial --json

# List all tracked developers
devinsights list

# List as JSON
devinsights list --json

# Sync all tracked developers with latest Github and weather data
devinsights sync

# Remove a specific developer
devinsights remove MrRobinOfficial

# Remove all tracked developers (prompts for confirmation)
devinsights clear

Example track output:

┌─Tracked Developer──────────────────────────┐
│ Username:  mrrobinofficial                 │
│ Location:  Sweden (Stockholm)              │
│ Repos:     11                              │
│ Temp:      2.5°C                           │
└────────────────────────────────────────────┘

Example get output:

╭──────────────┬──────────────────────────╮
│ Field        │ Value                    │
├──────────────┼──────────────────────────┤
│ Username     │ mrrobinofficial          │
│ Location     │ Sweden                   │
│ Capital      │ Stockholm                │
│ Public Repos │ 11                       │
│ Temperature  │ 2.5°C                    │
│ Last Synced  │ 2026-04-03T07:52:41.256Z │
╰──────────────┴──────────────────────────╯

Example list output:

╭─────────────────┬──────────────────────┬───────┬──────────────────────────╮
│ Username        │ Location             │ Repos │ Last Synced              │
├─────────────────┼──────────────────────┼───────┼──────────────────────────┤
│ mrrobinofficial │ Sweden               │ 11    │ 2026-04-03T07:52:41.256Z │
│ thecherno       │ Melbourne, Australia │ 30    │ 2026-04-03T08:07:13.625Z │
╰─────────────────┴──────────────────────┴───────┴──────────────────────────╯
Total: 2 developer(s)

Getting Started

Prerequisites

  • .NET 10 SDK
  • Docker and Docker Compose

Run with Docker Compose

The recommended way to run the full stack:

docker-compose up --build

This starts:

  • API at http://localhost:5226
  • MongoDB at localhost:27017 with a persistent volume (mongo-data)

Run locally without Docker

MongoDB must be available at mongodb://localhost:27017.

cd DevInsights.Server
dotnet restore
dotnet run

Run tests

dotnet test

API Reference

POST /api/devinsights/{username}

Track a new Github developer. Fetches profile data, enriches it with country and weather information, and persists to MongoDB.

GET /api/devinsights/{username}

Retrieve a tracked developer's enriched profile. Returns cached data if fresh (within 1 hour), otherwise re-fetches from Github.

Example response:

{
  "username": "mrrobinofficial",
  "publicRepos": 11,
  "lastSyncedAt": "2026-04-03T07:52:41.256Z",
  "location": "Sweden",
  "capital": "Stockholm",
  "temperature": 2.5
}

GET /api/devinsights

List all tracked developers.

DELETE /api/devinsights/{username}

Remove a tracked developer and their persisted data.

DELETE /api/devinsights

Remove all tracked developers.

POST /api/devinsights/sync

Trigger a manual synchronisation of all tracked developers. Updates Github stats, country metadata, and temperature for each profile.

Example response:

{
  "updated": 2
}

Configuration

Key Default Description
MongoDB:ConnectionString mongodb://localhost:27017 MongoDB connection string
MongoDB:DatabaseName devinsights Target database name
ASPNETCORE_ENVIRONMENT Production Controls OpenAPI exposure and logging verbosity

Environment variables follow the standard ASP.NET Core double-underscore convention:

MongoDB__ConnectionString=mongodb://mongo:27017
MongoDB__DatabaseName=devinsights

Background Synchronisation

GithubSyncJob is a hosted background service that periodically re-syncs all tracked developers. Each sync cycle:

  1. Fetches the latest public repo count and profile data from Github
  2. Re-resolves country metadata from the developer's location string
  3. Fetches the current temperature at the resolved capital city
  4. Persists the updated document to MongoDB, preserving the existing _id

Manual sync is also available via POST /api/devinsights/sync or the devinsights sync CLI command.

External Integrations

Provider Purpose
Github REST API Developer profile and repository data
REST Countries Country metadata and capital city resolution
Open-Meteo Current temperature via geocoding + forecast API

All integrations are encapsulated behind typed HttpClient implementations with Polly-based retry policies.

Observability

  • Structured request/response logging via Serilog
  • Debug-level logging for all external HTTP calls
  • Centralised exception handler returning consistent application/problem+json responses
  • OpenAPI + Scalar interactive docs available at /scalar in development

License

This project is licensed under the MIT License unless stated otherwise.

About

Service-oriented ASP.NET Core application that aggregates and enriches developer profiles from Github, augmenting them with geographic and real-time weather data.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages