Skip to content
@coinhub-uit

CoinHub

Let us protect your money

ToC


DB

Warning

  • UUID or serial? if delete, that empty slot is skipped
  • User:

    erDiagram
      user {
        uuid userId PK "Bind with Supabase"
        varchar(20) userName UK "Index"
        nvarchar fullName
        char(12) citizenId
        date birthDay
        text pin "Hashed"
        bytea avatar "Optional, fallback OAuth image"
        text address "Optional"
        text email "Optional"
        char(10) phoneNumber "Optional"
      }
    
      source {
        varchar(20) sourceId PK "User choice"
        uuid userId FK
        money balance "Default 0, >= 0"
      }
    
      method {
        %% Non-renewal, principal rollover, principal & interest rollover
        varchar(3) methodId "Seed(NR, PR, PIR)"
      }
    
      interest_rate {
        serial interestRateId PK "Auto inc"
        int planId FK
        date definedDate
        decimal rate
      }
    
      ticket {
        uuid ticketId PK
        int sourceId FK
        int methodId FK
        %% So what if I changed and there're other ... already, will be failed
        money initMoney ">= settings[minimumInitMoney] when insert"
        %% Calculate before return to client (not in DB)?
        date createdAt "Default now"
        date closedDate "Nullable, defined later"
      }
    
      %% Use latest plan
      %% The name is ambiguous
      ticket_interest_rate {
        uuid ticketId PK,FK
        int interestRateId FK
        date issueDate PK "= ticket[createdAt] + 1 || prev[issueDate] + 1"
        date maturityDate "= issueDate + plan[days]"
      }
    
      plan {
        serial planId PK "Auto inc"
        int days UK ">= -1, Seed(-1, 90, 180)"
        boolean isDisabled
        serial latestInterestRate FK "Nullable"
      }
    
      transaction {
        uuid transactionId PK
        int sourceId FK
        money amount "> 0"
        enum type "deposit, withdraw, interest_payment"
        timestamp createdAt "Default now"
      }
    
      notification {
        serial notificationId PK
        uuid userId FK "Index"
        nvarchar title
        text content
        timestamp createdAt "Default now"
      }
    
      source }o--|| transaction : "has"
      user }o--|| notification : "has"
      user }|--|| source : "has"
      source }o--|| ticket : "has"
      ticket ||--o{ method : "has"
      ticket }|--|| ticket_interest_rate : "has sequential"
      plan }o--|| interest_rate : "has history"
      ticket_interest_rate ||--}o interest_rate : "has latest"
    
    Loading
  • Admin related stuff

    erDiagram
      statistic {
          date date
          int users "Σ user"
          int tickets
          money deposits "Σ ticket[initMoney]"
        }
    
        settings {
          money minimumInitMoney
        }
    
        admin {
          nvarchar username PK,UK
          text password "Hashed"
        }
    
    Loading

Note

  • user[phoneNumber], user[email] are optional (for contact)

Backend:

  • Ticket:
    • Return paidInterest = initMoney * interest_rate[rate] / 100"
    • Return anticipatedInterest is when instantly settle (latest interest_rate[rate] where plan[days=-1])

Architect

architecture-beta
  group supabase[Supabase]
  service authentication_server(server)[Authenticate Server] in supabase
  service database(database)[Database] in supabase

  group own_server[Own Server]
  service api_server(server)[API] in own_server
  service admin_web_server(server)[Admin Web] in own_server

  group firebase[Firebase]
  service fcm(server)[FCM] in firebase

  group ai_server[AI Server]
  service api_ai(server)[API] in ai_server

  junction junction_bot_left

  service mobile[Mobile]
  service admin[Admin]

  api_server:L -- R:authentication_server{group}
  authentication_server:L -- R:database

  admin_web_server:L -- R:api_server

  fcm{group}:R -- L:junction_bot_left

  api_ai{group}:B -- T:api_server

  admin:T -- B:admin_web_server

  mobile:T -- B:api_server
  mobile:L -- R:junction_bot_left
  junction_bot_left:T -- B:authentication_server{group}
Loading

Pinned Loading

  1. mobile mobile Public

    CoinHub mobile app for client (cross platforms)

    Dart 1

  2. web web Public

    CoinHub admin website

    TypeScript

  3. server server Public

    CoinHub API server

    TypeScript

Repositories

Showing 6 of 6 repositories
  • server Public

    CoinHub API server

    coinhub-uit/server’s past year of commit activity
    TypeScript 0 MIT 0 5 0 Updated Mar 4, 2025
  • .github Public

    Public info

    coinhub-uit/.github’s past year of commit activity
    0 1 0 0 Updated Mar 4, 2025
  • mobile Public

    CoinHub mobile app for client (cross platforms)

    coinhub-uit/mobile’s past year of commit activity
    Dart 1 MIT 0 14 0 Updated Mar 4, 2025
  • web Public

    CoinHub admin website

    coinhub-uit/web’s past year of commit activity
    TypeScript 0 0 2 0 Updated Mar 3, 2025
  • coinhub-uit.github.io Public

    Coinhub website for docs and reports

    coinhub-uit/coinhub-uit.github.io’s past year of commit activity
    TypeScript 0 MIT 0 1 0 Updated Mar 2, 2025
  • android Public

    CoinHub android app for client (Kotlin)

    coinhub-uit/android’s past year of commit activity
    0 MIT 0 0 0 Updated Feb 26, 2025

Top languages

Loading…

Most used topics

Loading…