MoodMate API is a .NET Web API designed to support the MoodMate application, enabling users to track and manage their emotional well-being. It provides secure, scalable, and RESTful endpoints for mood tracking and user management, utilizing Bearer Token authentication and authorization for secure access.
- Key Features
- Technologies Used
- Domain Models
- DTOs
- Repository Pattern
- Authentication and Authorization
- API Documentation
- Getting Started
- API Endpoints
- Contributing
- License
- Mood Tracking: Log and retrieve user mood entries with support for trend analysis.
- User Management: Handle user registration, login, and profile management.
- Secure Authentication: JWT Bearer Token-based authentication.
- Authorization: Role-based and policy-based access control.
- RESTful Architecture: Designed for scalability and maintainability.
- Data Validation: DTOs used for robust input/output validation.
- Repository Pattern: Abstracted data access for improved testability and maintainability.
- .NET Core / .NET 8
- Entity Framework Core
- ASP.NET Core Identity
- JWT (JSON Web Tokens)
- SQL Server / SQLite
- Swagger / OpenAPI
- Dependency Injection
- User:
Id,Username,Email,PasswordHash,Role - MoodEntry:
Id,UserId,MoodType,Description,Timestamp,Intensity - MoodCategory:
Id,Name
These models are mapped to database tables using Entity Framework Core.
Used for API request/response shaping and validation.
UserRegisterDto:Username,Email,PasswordUserLoginDto:Email,PasswordMoodEntryCreateDto:MoodType,Description,Intensity,TimestampMoodEntryResponseDto:Id,MoodType,Description,Timestamp,IntensityUserResponseDto:Id,Username,Email,Role
Interfaces for abstracting data access:
IUserRepositoryGetById,GetByEmail,CreateUser
IMoodEntryRepositoryCreateMoodEntry,GetMoodEntriesByUser,GetMoodEntriesByDateRange
IMoodCategoryRepositoryGetAllCategories,GetCategoryById
All repositories are registered via .NET Dependency Injection.
- Uses ASP.NET Core Identity and JWT Bearer tokens.
- Token obtained via:
POST /api/auth/login
- Role-based and policy-based access.
- Authenticated users: Access mood tracking endpoints.
- Admin users: Access user management endpoints.
JWT tokens are validated using middleware.
- Postman Collection:
/docs/MoodMate_API.postman_collection.json - Swagger UI: Available at
/swaggerwhen the API is running.
- .NET 8 SDK
- SQL Server or SQLite
- Git
- IDE (Visual Studio 2022 or VS Code)
git clone https://github.com/shevon2000/MoodMate_API.git
cd MoodMate_API
dotnet restore