Skip to Content
For DevelopersArchitecture

Architecture

This page describes Auktiva’s technical architecture and project structure.

Project Structure

auktiva/ β”œβ”€β”€ cli/ # CLI setup wizard β”œβ”€β”€ docs/ # Documentation (Nextra) β”œβ”€β”€ prisma/ β”‚ β”œβ”€β”€ schema.prisma # Database schema β”‚ └── seed-currencies.ts # Currency seed data β”œβ”€β”€ src/ β”‚ β”œβ”€β”€ components/ # React components β”‚ β”œβ”€β”€ generated/ # Generated Prisma client β”‚ β”œβ”€β”€ hooks/ # Custom React hooks β”‚ β”œβ”€β”€ lib/ # Utility libraries β”‚ └── pages/ # Next.js pages β”œβ”€β”€ .env.example # Environment template └── package.json # Dependencies

Tech Stack

Frontend

  • Next.js 16 - React framework with Pages Router
  • React 19 - UI library
  • Tailwind CSS - Utility-first CSS
  • DaisyUI - Tailwind component library
  • SWR - Data fetching and caching

Backend

  • Next.js API Routes - Serverless API endpoints
  • Prisma ORM - Database access layer
  • NextAuth.js v4 - Authentication

Database

  • SQLite - Local file-based database
  • Turso/LibSQL - Cloud-distributed SQLite

Data Flow

Page Request Flow

Browser β†’ Next.js Server β†’ getServerSideProps ↓ Prisma Query ↓ Database ↓ Props β†’ React Component β†’ HTML

Real-Time Updates

Auktiva supports WebSocket-based real-time updates using Soketi (self-hosted) or Pusher (cloud). When realtime is not configured, it falls back to SWR polling.

With WebSocket (Soketi/Pusher): Browser ← WebSocket ← Soketi/Pusher ← API (on data change) ↓ Instant UI update Fallback (Polling): Browser β†’ SWR (interval) β†’ API Route β†’ Database ↓ Update UI on change

See Realtime Features for configuration details.

Database Schema

Core Entities

  • User has many AuctionMembers (memberships)
  • Auction has many AuctionMembers and AuctionItems
  • AuctionItem has many Bids and ItemImages
  • Bid belongs to User and AuctionItem

API Structure

RESTful Endpoints

/api/auth/* # NextAuth endpoints /api/auctions # List/create auctions /api/auctions/[id] # Get/update/delete auction (owner only) /api/auctions/[id]/close # End the auction now (owner only) /api/auctions/[id]/reopen # Reopen bidding (owner only) /api/auctions/[id]/items # List/create items /api/notifications # User notifications /api/upload # File uploads

Errors are returned as JSON with message and code (for example BAD_REQUEST, FORBIDDEN or VALIDATION_ERROR), plus any details. Validation errors (422) include an errors object keyed by field.

Auction End Date

PATCH /api/auctions/[id] is owner only. Its optional endDate field takes:

  • an ISO 8601 date-time with a UTC offset, such as "2026-11-30T18:00:00Z" or "2026-11-30T19:00:00+01:00", to set the end
  • null to remove the end date
  • nothing (leave the field out) to keep the current end

Any other value, such as a date-time without an offset, is rejected with 422. When endDate is present, the change goes through the same transition as reopening. Items without their own end date that move from closed to open count as reopened: their bidders are notified and the next close notifies the winner again. Moving the end of a running auction, or saving the same end again, reopens nothing and sends nothing. The response is the updated auction.

Reopening Bidding

POST /api/auctions/[id]/reopen is owner only.

Request body:

{ "endDate": "2026-11-30T18:00:00Z", "itemIds": ["item-id-1", "item-id-2"] }
  • endDate (required): the new auction end, an ISO 8601 date-time with a UTC offset that lies in the future, or null for no end time.
  • itemIds (required, up to 500): published items of this auction that are currently closed. They drop their own end date and then follow the auction end. Use [] to only move the auction end.

Items without their own end date reopen whenever the new end reopens the auction, whether or not they are listed. Bids, currentBid and highestBidder are left unchanged.

Response (200):

{ "auction": { "id": "...", "endDate": "2026-11-30T18:00:00.000Z", "...": "..." }, "reopenedCount": 2, "notifiedCount": 3 }

reopenedCount counts every item that went from closed to open, with or without bids. notifiedCount is the number of bidders who got the in-app β€œbidding reopened” notification. The owner who reopens is never notified.

Errors:

StatusWhen
401Not signed in
403Not a member of the auction, or not its owner
422The body does not match the schema (missing fields, an endDate without an offset, more than 500 itemIds)
400endDate is not in the future, or an item ID is unknown, belongs to another auction, is a draft or is still open. The body lists invalidItemIds, and notInAuction, drafts or open where they apply. Nothing changes.

PATCH /api/auctions/[id]/items/[itemId] still refuses to reopen an ended item. A later endDate, or clearing the end date while the auction is still running, returns 400.

Notification Types

In-app notifications have a type from the NotificationType enum. The app creates:

TypeSent when
NEW_ITEMAn item is added to an auction you’re a member of
OUTBIDSomeone outbids you
AUCTION_WONAn item closes and you are the highest bidder (at most once per close)
BIDDING_REOPENEDBidding reopens on items you bid on; the text tells previous winners the win is not final

The enum also holds AUCTION_ENDED, INVITE_RECEIVED and MEMBER_JOINED, which the bell can display but the app does not currently create. Notification text is English and stored when it is created. Times in it are in UTC.

There is no scheduled job for winner notifications. Each GET /api/notifications starts the auction-end notifier in the background without waiting for it (up to 50 items per run), so several runs can overlap. Each item is claimed atomically before anything is sent; see Winner Notification Fields.

Last updated on