A .NET Core Web API that tracks daily mood entries with weather data correlation and provides analytics on mood patterns.
- User Authentication with JWT tokens
- Daily Mood Logging (1-10 scale) with notes
- Real-time Weather Integration via OpenWeather API
- Mood Analytics showing correlations between mood and weather
- PostgreSQL Database with Entity Framework Core
- RESTful API with Swagger documentation
- .NET 8 Web API
- PostgreSQL database
- Entity Framework Core ORM
- JWT Authentication
- OpenWeather API integration
- BCrypt password hashing
- System.Text.Json for JSON handling
- .NET 8 SDK
- PostgreSQL
- OpenWeather API key (free)
-
Clone and setup
git clone https://github.com/saikat455/weather-mood.git cd WeatherMoodJournal.API dotnet restore -
Configure settings in
appsettings.json:{ "ConnectionStrings": { "DefaultConnection": "Host=localhost;Database=WeatherMoodJournal;Username=postgres;Password=your_password" }, "WeatherAPI": { "ApiKey": "your-openweather-api-key" } } -
Database setup
dotnet ef database update
-
Run the application
dotnet run
-
Test API at
https://localhost:7xxx/swagger
POST /api/auth/register- Register new userPOST /api/auth/login- Login user
POST /api/mood- Create mood entry with weather dataGET /api/mood- Get user's mood entries (paginated)GET /api/mood/{id}- Get specific mood entryDELETE /api/mood/{id}- Delete mood entryGET /api/mood/analytics- Get mood vs weather analytics
{
"totalEntries": 15,
"averageMood": 7.2,
"moodByWeather": [
{
"weatherCondition": "Clear",
"averageMood": 8.5,
"entryCount": 8
}
],
"moodByTemperatureRange": [
{
"temperatureRange": "Warm (20-30°C)",
"averageMood": 8.0,
"entryCount": 6
}
]
}- JWT Authentication Implementation - I learned token-based security
- External API Integration - I consumed third-party APIs (OpenWeather)
- Database Relationships - I designed User-MoodEntry one-to-many relationship
- Entity Framework Core - I practiced code-first migrations, LINQ queries
- Password Security - I implemented BCrypt hashing and validation
- RESTful API Design - I applied proper HTTP methods and status codes
- Async Programming - I handled multiple async operations (DB + API calls)
- Error Handling - I managed graceful handling of external API failures
- Data Analytics - I wrote complex LINQ queries for mood-weather correlations
- Authentication Flow - I secured endpoints with JWT middleware
- Configuration Management - I handled sensitive data (API keys, connection strings)
- API Security - I protected user data with proper authentication
- Third-Party Integration - I worked with external services and handled failures
- Database Design - I created normalized, efficient database schema
- JSON Handling - I parsed and serialized complex data structures
- Deployment Readiness - I structured code for production environments