Logical Architecture

Next.js App Router, Prisma/Postgres, role-based auth, email verification, approvals.

Component map

flowchart LR
    Browser["Client browser"] -->|"HTTPS"| Traefik["Traefik ingress"]
    Traefik --> Varnish["Varnish cache\n(static + /api/images/*)"]
    Varnish --> Next["Next.js App Router\nSSR/ISR + API routes"]
    Next --> Auth["Auth/session module\n(JWT cookie)"]
    Next --> Prisma["Prisma ORM"]
    Prisma --> Postgres[(PostgreSQL\nlistings + images)]
    Next --> Mailer["SMTP mailer\nsmtp.lomavuokraus.fi (CNAME) + DKIM"]
    Admin["Admins & moderators"] --> Traefik
          
Edit the Mermaid block above to evolve the architecture.

Domain model

erDiagram
  USER ||--o{ LISTING : owns
  USER ||--o{ LISTING : approves
  LISTING ||--|{ LISTINGTRANSLATION : has
  LISTING ||--o{ LISTINGIMAGE : has

  USER {
    string id
    string email
    string passwordHash
    string role
    string status
    datetime emailVerifiedAt
    datetime approvedAt
    datetime rejectedAt
    datetime removedAt
  }
  LISTING {
    string id
    string status
    datetime approvedAt
    datetime rejectedAt
    datetime removedAt
    string country
    string region
    string city
    float latitude
    float longitude
  }
  LISTINGTRANSLATION {
    string id
    string slug
    string title
    string locale
    string teaser
  }
  LISTINGIMAGE {
    string id
    string url
    string data
    string mimeType
    int size
    string altText
    boolean isCover
    int order
  }

Key notes