🏗️ AuraLog Architecture - GemsForge/aura-logbook-api GitHub Wiki
AuraLog is designed as a modular, API-first web application that follows clean separation of concerns. It uses a layered architecture for flexibility, maintainability, and scalability.
- Responsibility: Handle HTTP requests/responses
- Contents: Routes, request validation, auth decorators
- Example:
MoodController
,AuthController
- Responsibility: Business logic
- Contents: Mood calculations, user auth, summaries
- Example:
MoodService
,AuthService
- Responsibility: Communicate with SQLite using Dapper
- Contents: SQL queries, connection handling
- Example:
MoodRepository
,UserRepository
- Responsibility: Core data structures and contracts
- Contents: DTOs, database models, request/response types
- Example:
MoodEntry
,User
,DashboardSummaryDTO
Dapper is used for performance and SQL-first control, avoiding heavy ORM overhead.
-
Users
-
Id (PK)
,Email
,PasswordHash
,CreatedAt
-
-
MoodEntries
-
Id (PK)
,UserId (FK)
,Date
,Mood
,Comment
,CreatedAt
-
❗ Each
MoodEntry
is tied to a specific user viaUserId
.
AuraLog uses JWT (JSON Web Token) for stateless, secure authentication.
- User registers or logs in
- Server generates a JWT token
- Token is stored on client (e.g., in localStorage)
- All protected endpoints require
Authorization: Bearer <token>
Middleware checks token validity and user identity for secure access.
Method | Route | Description |
---|---|---|
POST |
/auth/register |
Register a new user |
POST |
/auth/login |
Authenticate and return JWT token |
GET |
/moods |
Retrieve moods by date range |
POST |
/moods |
Create a new mood entry |
PUT |
/moods/{id} |
Update an existing mood entry |
DELETE |
/moods/{id} |
Delete a mood entry |
GET |
/dashboard/summary |
Return mood summary for the user |
- Passwords are hashed securely (e.g., using BCrypt).
- JWT tokens include expiration and are validated per request.
- Each user can only access their own data via UserId-based authorization.
Feature | Layer(s) Affected |
---|---|
Mood trend visualization |
Service , Dashboard
|
CSV Export of mood data |
Controller , Repo
|
PWA support | Frontend (external) |
Streak tracking/reminders |
Service layer |
Tags or emoji mood types |
Model , API upgrade |
Controllers → Services → Repositories → Database
↓
Models