Skip to content

askeroglu/book-audit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Book Audit

A simple full-stack app for tracking a personal book collection. Every change is recorded, so you can see exactly what happened to a book and when.

What it does

  • Add, edit and delete books
  • Slug-based URLs for each book
  • Multiple authors per book
  • Publish date with validation (no future dates allowed)
  • Full audit history shown as a timeline or a searchable table
  • Soft delete — removed books stay in history but disappear from the list
  • Draggable add/edit and history dialogs

Tech stack

Backend

  • .NET 10 Web API
  • Entity Framework Core
  • SQLite
  • Swashbuckle (Swagger)

Frontend

  • React 19 with TypeScript
  • Vite
  • MUI (Material UI)
  • React Router
  • TanStack Query
  • React Hook Form + Zod
  • Dayjs

Project structure

book-audit/
├── backend/
│   └── BookAudit.Api/          # Web API
└── frontend/
    └── book-audit-client/      # React SPA

Getting started

Backend

cd backend/BookAudit.Api

dotnet restore
dotnet build
dotnet ef database update
dotnet run --launch-profile http

Local Swagger: http://127.0.0.1:5000/swagger

Frontend

cd frontend/book-audit-client

npm install
npm run dev

Local app: http://localhost:5173/

Docker

docker compose up --build

Docker Swagger: http://localhost:5132/swagger

If the database already exists and migrations fail, remove the old volume:

docker volume rm book-audit_backend-data

How the history works

Every create, update, delete, author addition or author removal is captured by an EF Core interceptor. The frontend shows these events in two views: a timeline grouped by day, and a paginated, filterable list.

Notes

  • Slugs are generated automatically from the book title.
  • Renaming a book updates the slug and the URL changes with it.
  • Audit history is stored in the same SQLite database.

Future improvements / TODO

  • Generic audit with IAuditableEntity: Currently the interceptor explicitly tracks Book and BookAuthor. A marker interface like IAuditableEntity plus an [AuditIgnore] attribute would let any entity opt-in to audit logging without touching the interceptor.
  • Centralized AuditLog table: Today history is stored in a book-specific BookHistory table. A generic AuditLog table with EntityName, EntityId, Action, PropertyName, OldValue, NewValue would support publishers, categories and other future entities.
  • Optimistic updates on all mutations: Update and delete already use optimistic cache updates; create could also be made optimistic once the server-generated id/slug handling is worked out.
image image image image

About

A simple full-stack app to track a personal book collection with audit history.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages