Skip to content

baytekincan/CatHealthTracker

Repository files navigation

🐾 CatHealthTracker

CatHealthTracker is a modern ASP.NET Core Web API project that helps cat owners manage their pets’ health information in one place.

It allows users to track vaccinations, monitor weight changes, store medical history, and manage health reminders to avoid missing important care events.

The system provides features such as:

  • Cat management
  • Vaccination tracking
  • Reminder management

The goal of the system is to make cat health tracking simple, organized, and reliable.


πŸš€ Tech Stack

Technology Description
ASP.NET Core 10 Web API framework
Entity Framework Core ORM
SQL Server Database
JWT Bearer Authentication Authentication system
AutoMapper DTO mapping
FluentValidation Request validation
Scalar API documentation UI
BCrypt.Net Password hashing
Repository Pattern Data access abstraction
Unit Of Work Transaction management

πŸ—οΈ Project Architecture

The project follows a layered architecture:

CatHealthTracker
β”‚
β”œβ”€β”€ CatHealthTracker.API
β”œβ”€β”€ CatHealthTracker.Business
β”œβ”€β”€ CatHealthTracker.DataAccess
└── CatHealthTracker.Entity

Layers

API Layer

Handles:

  • Controllers
  • Middleware
  • Authentication configuration
  • HTTP request/response pipeline

Business Layer

Handles:

  • Business rules
  • Services
  • DTOs
  • Validators
  • JWT generation
  • Mapping profiles

DataAccess Layer

Handles:

  • Entity Framework Core
  • Repository pattern
  • Unit of Work
  • DbContext
  • Database operations

Entity Layer

Handles:

  • Database entities
  • Base entity definitions

πŸ” Authentication

The project uses JWT Bearer Authentication.

Features:

  • User registration
  • User login
  • Password hashing with BCrypt
  • JWT token generation
  • Protected endpoints with [Authorize]
  • User-based resource access control

Example:

Authorization: Bearer YOUR_TOKEN

🧠 Features

🐱 Cat Management

  • Create cat
  • Update cat
  • Delete cat (soft delete)
  • Get user-specific cats
  • Ownership protection

πŸ’‰ Vaccination Tracking

  • Vaccine records
  • Vaccination history
  • Vaccine frequency tracking

⏰ Reminder System

  • Reminder creation
  • Reminder status tracking
  • User-specific reminders

πŸ”’ Security

  • JWT authentication
  • User ownership validation
  • Protected endpoints
  • Password hashing

πŸ—‘οΈ Soft Delete

Entities are not physically removed from the database.

Instead:

IsDeleted = true
DeletedAt = DateTime.UtcNow

Global query filters automatically hide deleted records.


πŸ“Œ API Endpoints

πŸ” Auth

Method Endpoint
POST /api/auth/register
POST /api/auth/login

🐱 Cats

Method Endpoint
GET /api/cats
GET /api/cats/{id}
POST /api/cats
PUT /api/cats
DELETE /api/cats/{id}

⏰ Reminders

Method Endpoint
GET /api/reminders
POST /api/reminders
PUT /api/reminders/{id}/mark-sent

πŸ’‰ Vaccination Records

Method Endpoint
GET /api/vaccinationrecords
GET /api/vaccinationrecords/{id}
POST /api/vaccinationrecords

πŸ’Š Vaccines

Method Endpoint
GET /api/vaccines
POST /api/vaccines
PUT /api/vaccines
DELETE /api/vaccines/{id}

πŸ“¦ API Documentation

The project uses Scalar UI for API documentation.

After running the project:

https://localhost:7237/scalar

βš™οΈ Installation

1. Clone the repository

git clone https://github.com/baytekincan/CatHealthTracker.git
cd CatHealthTracker

2. Configure User Secrets

JWT and connection strings are stored using .NET User Secrets.

Initialize secrets:

dotnet user-secrets init --project CatHealthTracker.API

Add SQL Server connection string:

dotnet user-secrets set "ConnectionStrings:SqlServer" "Server=(localdb)\\MSSQLLocalDB;Database=CatHealthTrackerDb;Trusted_Connection=True;" --project CatHealthTracker.API

Add JWT configuration:

dotnet user-secrets set "Jwt:Issuer" "CatHealthTracker" --project CatHealthTracker.API

dotnet user-secrets set "Jwt:Audience" "CatUsers" --project CatHealthTracker.API

dotnet user-secrets set "Jwt:SecretKey" "YOUR_SECRET_KEY" --project CatHealthTracker.API

3. Create Database

Run migrations:

dotnet ef database update \
--project CatHealthTracker.DataAccess \
--startup-project CatHealthTracker.API

4. Run the project

dotnet run --project CatHealthTracker.API

πŸ“š Future Improvements

Planned improvements:

  • Role-based authorization
  • Email notifications
  • Redis caching
  • Docker support
  • CI/CD pipeline
  • Cloud deployment (Azure/AWS)
  • Generic repository improvements

πŸ‘¨β€πŸ’» Author

Can Baytekin

GitHub LinkedIn

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages