lomavuokraus/docs/architecture.html
2025-11-24 17:31:21 +02:00

80 lines
2.3 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Logical Architecture</title>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<header>
<h1>Logical Architecture</h1>
<div class="meta">Next.js App Router, Prisma/Postgres, role-based auth, email verification, approvals.</div>
</header>
<main class="grid">
<section class="card">
<h2>Components</h2>
<ul>
<li><strong>Web</strong>: Next.js app (App Router), server-rendered pages, client hooks for auth state.</li>
<li><strong>API routes</strong>: Authentication, admin approvals, listings CRUD (soft-delete), profile update.</li>
<li><strong>Data</strong>: Postgres via Prisma (models: User, Listing, ListingTranslation, ListingImage, VerificationToken).</li>
<li><strong>Mail</strong>: SMTP (smtp.sohva.org) + DKIM signing for verification emails.</li>
<li><strong>Auth</strong>: Email/password, verified+approved requirement, JWT session cookie (<code>session_token</code>), roles.</li>
</ul>
</section>
<section class="card">
<h2>Layers Diagram</h2>
<p>Source: <code>docs/drawio/architecture.drawio</code>. Edit with draw.io and export locally.</p>
</section>
<section class="card">
<h2>Domain Model Snapshot</h2>
<div class="diagram">
<pre><code class="language-mermaid">erDiagram
USER ||--o{ LISTING : owns
USER ||--o{ LISTING : approves
LISTING ||--|{ LISTINGTRANSLATION : has
LISTING ||--o{ LISTINGIMAGE : has
USER {
string id
string email
string passwordHash
Role role
UserStatus status
datetime emailVerifiedAt
datetime approvedAt
datetime rejectedAt
datetime removedAt
}
LISTING {
string id
ListingStatus status
datetime approvedAt
datetime rejectedAt
datetime removedAt
string country
string region
string city
}
LISTINGTRANSLATION {
string id
string slug
string title
string locale
}
LISTINGIMAGE {
string id
string url
}
</code></pre>
</div>
</section>
<section class="card">
<h2>Auth Flow (High-Level)</h2>
<p>See PlantUML source: <code>docs/plantuml/auth-register-login.puml</code>. Render locally with PlantUML.</p>
</section>
</main>
</body>
</html>