Libertum

Docs
Table of contents

Technical Documentation

Overview

This architecture leverages various components to build a scalable, resilient, and efficient system. The API Gateway and Load Balancer manage client requests and distribute the load. The Admin and Marketplace services handle specific business logic and interact with MongoDB and Redis for storage and caching. Event Monitoring and Kafka manage real-time events and asynchronous processing. Blockchain integration provides an additional layer of security and transparency for critical data. The system can efficiently handle high loads and ensure smooth operation by decoupling services, caching, and asynchronous processing.

Client Interaction

Clients send requests to the API Gateway:

○      Clients: This can be web applications, mobile apps, or any other system that needs to interact with your backend services.

○      API Gateway: Acts as the single entry point for all client requests. It handles various tasks such as:

\ ■      Routing: Directs requests to the appropriate backend service.

\ ■      Authentication and Authorization: Ensures that only authenticated and authorised users can access certain endpoints.

\ ■      Rate Limiting: Prevents abuse by limiting the number of requests a client can make in a given period.

\ ■      Logging and Monitoring: Collects metrics and logs for monitoring and troubleshooting.

The API Gateway routes these requests to the appropriate service via the Load Balancer:

○      Load Balancer: Distributes incoming requests across multiple instances of the backend services to ensure no single instance is overwhelmed. It helps in:

\ ■      Scaling: Automatically distributing load to handle more requests as the demand increases.

\ ■      Fault Tolerance: Ensuring high availability by redirecting traffic to healthy instances if some instances fail.

Service Processing

The Admin and Marketplace services handle their respective requests:

○      Admin Service: Admin is the service that manages the end-to-end working of the platform like 

\ ■      User management 

\ ■      Offering Deployment 

\ ■      Issuer request 

\ ■      Orders Management 

\ ■      Sub-admin Management 

\ ■      Offering Requests and Assignments.

\ ■      Transactions record

○      Marketplace Service: Marketplace is the core of the platform which handles all the initiation functionalities like 

\ ■      Onboarding of issuer and Investor 

\ ■      Offering creation 

\ ■      Portfolio 

\ ■      Offerings 

\ ■      Investment - Fiat and crypto 

\ ■      Wallet connection

\ ■      Transactions records

These services interact with their MongoDB and Redis instances for data storage and caching:

○      MongoDB:

\ ■      Used for storing persistent data such as user profiles, Offering details and transaction records.

\ ■      Provides a flexible schema and allows for efficient querying and indexing.

○      Redis:

\ ■      Used as an in-memory data store for caching frequently accessed data, reducing the load on MongoDB. (For maintaining user sessions)

\ ■      Provides fast data access, which improves the overall performance of the application.

Event Monitoring

The Event Monitoring Service tracks and processes events generated by blockchain and broadcasts into a queue:

○      Tracks important events such as user actions, system errors, and significant state changes within the application.

It publishes or consumes messages from Kafka for processing or further action:

○      Kafka:

\ ■      Acts as a message broker that can handle a high throughput of messages.

\ ■      Allows the system to handle real-time data streams and process events asynchronously.

\ ■      Decouples event producers (services generating events) from event consumers (services processing events), enhancing scalability and resilience.

Database and Cache

MongoDB instances store persistent data for the Admin and Marketplace services:

○      Ensures that all critical data is safely stored and can be retrieved even after service restarts or failures.

○      Provides mechanisms for data replication and backup.

Redis instances cache frequently accessed data to reduce database load and improve response times:

○      Stores data that is expensive to fetch or compute repeatedly, such as user session data, and frequently accessed Offering details.

○      Reduces latency by serving data from memory rather than querying the database.

Asynchronous Processing

Kafka handles asynchronous message processing, enabling services to communicate without being tightly coupled:

○      Services publish events to Kafka topics, and other services can subscribe to these topics to process the events.

○      This ensures that the failure of one service does not directly affect others, as messages can be processed once the consumer service is back online.

This ensures scalability and resilience by allowing services to function independently and asynchronously:

○      Services can be scaled independently based on their load.

○      The system can handle varying loads gracefully, ensuring consistent performance.

Blockchain Integration

Certain data recorded on the blockchain for immutability and decentralized verification:

○      Important data such as transaction records, asset ownership, and other critical information can be stored on a blockchain.

The connection between the system and the blockchain ensures that relevant information is securely stored on the blockchain:

○      The system will interact with the blockchain through smart contracts. 

○      Ensures that data integrity and security are maintained, and relevant data related to token details and offering details is transparently available on the blockchain.

Schema Diagram

Collections and Fields

Users Collection

○      name (string)

○      legalFullName (string)

○      email (string, unique: true, index: true)

○      onchainID (string)

○      password (string)

○      countryCode (string)

○      mobile (string, unique: true, index: true)

○      dob (string)

○      isActive (boolean)

○      isEmailVerify (boolean)

○      kycApplicationId (string)

○      sumSubKycStatus (string, enum: sumSubKycStatusEnum)

○      webhookReceived (string)

○      levelName (string)

○      isMobileVerify (boolean)

○      is2FAActive (boolean)

○      twoFASecret (string)

○      isOtpActive (boolean)

○      isDeleted (boolean)

○      isSocialMedia (boolean)

○      userType (string, enum: UserTypeEnum)

○      isKyc (boolean)

○      kycStatus (string, enum: KycStatusEnum)

○      userImage (string)

○      kycCount (number)

○      kycReason (string)

○      issuerReason (string)

○      isIssuer (boolean)

○      issuerStatus (string, enum: IssuerStatusEnum

Address Collection

○      address (string)

○      address2 (string)

○      country (string)

○      state (string)

○      city (string)

○      zipCode (string)

userDetails Collection

●      mainInformation (object)

\ ○      birthPlace (string)

\ ○      nationality (string)

\ ○      nationalIdNumber (string)

\ ○      identificationDocument (string)

\ ○      documentExpiration (string)

\ ○      occupation (string)

\ ○      dob (string)

●      institutions (object)

\ ○      companyInformation (object)

\ ■      name (string)

\ ■      entityType (string)

\ ■      webSite (string)

\ ■      business (string)

\ ■      sourceOfFunds (string)

\ ○      address (Address Collection)

●      primaryContactInfo (object)

\ ○      personalInformation (object)

\ ■      name (string)

\ ■      jobTitle (string)

\ ■      dob (string)

\ ■      socialSecurityNumber (string)

\ ■      citizenship (string)

\ ■      countryCode (string)

\ ■      mobile (string)

\ ■      email (string)

\ ○      address (AddressCollection)

●      wallets (array of objects)

\ ○      type (string)

\ ○      address (string)

\ ○      timestamp (Date)

\ ○      isVerify (boolean)

●      isIdentityVerification (object)

\ ○      url (string)

\ ○      status (string)

\ ○      expireTime (string)

●      documents (object)

\ ○      frontId (string)

\ ○      backId (string)

\ ○      otherIdentification (string)

●      beneficialOwners (array of objects)

\ ○      personalInformation (object)

\ ■      name (string)

\ ■      dob (string)

\ ■      socialSecurityNumber (string)

\ ■      citizenship (string)

\ ○      address (AddressSchema)

\ ○      identityProof (object)

\ ■      passport (object)

●      front (string)

●      back (string)

\ ■      driversLicense (object)

●      front (string)

●      back (string)

\ ■      idCard (object)

●      front (string)

●      back (string)

●      managementInfo (array of objects)

\ ○      personalInformation (object)

\ ■      name (string)

\ ■      jobTitle (string)

\ ■      dob (string)

\ ■      socialSecurityNumber (string)

\ ■      citizenship (string)

\ ■      countryCode (string)

\ ■      mobile (string)

\ ■      email (string)

\ ○      address (AddressSchema)

●      kycSteps (number)

●      isFinalSubmission (boolean)

Password Collection

\ ○      passwords (array of strings)

Offering Collection

●      userId (ObjectId, ref: ‘users’)

\ ○     overview (object)

\ ■      title (string)

\ ■      subTitle (string)

\ ■      description (string)

\ ■      entityName (string)

\ ■      entityType (string)

\ ■      webUrl (string)

\ ■      lineOfBusiness (string)

\ ■      sourceOfFunds (string)

\ ■      location (string)

\ ■      companyDescription (string)

\ ■      icon (string)

\ ■      cover (string)

\ ■      logo (string)

\ ○     projectDetails (object)

\ ■      assetType (string)

\ ■      blockChainType (string)

\ ■      offeringType (string)

\ ■      tokenStandard (string)

\ ■      offeringName (string)

\ ■      CUSIP (string)

\ ■      isAuthorized (boolean)

\ ■      authorizedCountries (array of strings)

\ ■      startDate (date)

\ ■      endDate (date)

\ ■      minInvestment (number)

\ ■      maxInvestment (number)

\ ■      assetName (string)

\ ■      tokenTicker (string)

\ ■      tokenSupply (number)

\ ■      tokenDecimals (number)

\ ■      lockupMonths (number)

\ ■      holdTime (date)

\ ■      maxTokenHolding (number)

\ ■      navLaunchPrice (number)

\ ■      latestNav (number)

\ ■      isTransferAgent (boolean)

\ ■      taId (string)

\ ■      issuerId (string)

\ ■      issuerWallet (string)

\ ■      isPrivate (boolean)

\ ■      offeringMembers (array of strings)

\ ■      customFields (array of objects)

\ ●      label (string)

\ ●      type (string)

\ ●      value (string)

\ ■      propertyType (string)

\ ■      propertySubtype (string)

\ ■      yearBuilt (number)

\ ■      lotSize (number)

\ ■      occupancy (number)

\ ■      projectedYield (number)

\ ■      launchValuation (number)

\ ■      previousValuation (number)

\ ■      deRatio (number)

\ ○     documents (object)

\ ■      eSign (string)

\ ■      pitchDeck (string)

\ ■      confidentialInformationMemorendum (string)

\ ■      landRegistration (string)

\ ■      titleDocs (string)

\ ■      bankApproval (string)

\ ■      encumbranceCertificate (string)

\ ■      propertyTaxReceipt (string)

\ ■      articlesOfAssociation (string)

\ ■      operatingAgreement (string)

\ ■      taxAssignmentLetter (string)

\ ■      certificateOfRegistration (string)

\ ■      registerOfManagers (string)

\ ■      customDocs (array of objects)

\ ●      docsLabel (string)

\ ●      value (string)

\ ●     team (array of objects)

\ ■      name (string)

\ ■      title (string)

\ ■      summary (string)

\ ■      email (string)

\ ■      url (string)

\ ■      linkedInUrl (string)

\ ■      twitterUrl (string)

\ ○     Additional Fields

\ ■      template_id (string)

\ ■      fee (number)

\ ■      tokenAddress (string)

\ ■      isTokenDeploy (boolean)

\ ■      erc20Address (string)

\ ■      iserc20 (boolean)

\ ■      isFundDeploy (boolean)

\ ■      identityRegistry (string)

\ ■      fundAddress (string)

\ ■      deployedDate (date)

\ ■      currentStep (number)

\ ■      isActive (boolean)

\ ■      isDelete (boolean)

\ ■      isFinalSubmission (boolean)

\ ■      status (string, enum: offeringStatusEnum)

\ ■      createdBy (ObjectId, ref: ‘users’)

Whitelist Collection

●      userId (ObjectId, ref: ‘users’)

●      offeringId (ObjectId, ref: ‘offerings’)

●      address (string)

●      status (string, enum: offeringStatusEnum)

●      taStatus (string, enum: offeringStatusEnum)

●      template_id (string)

●      docuSignurl (string)

●      envelopeId (string)

●      is_expired (boolean)

●      is_signed (boolean)

●      whiteListReason (string)

Convert Collection

●      erc20Address (string)

●      createdAt (Date)

●      tokenAddress (string)

Order Collection

●      userId (ObjectId, ref: ‘users’)

●      offeringId (ObjectId, ref: ‘offerings’)

●      walletAddress (string)

●      amount (number)

●      isMinted (boolean)

●      isSettled (boolean)

●      isFreezed (boolean)

●      feesInPercentage (number)

●      quantity (number)

●      price (number)

●      status (string, enum: orderStatusEnum)

●      orderReceived (Date)

●      orderMinted (Date)

●      paymentMethod (string, enum: paymentTypeEnum)

●      tx_hash (string)

Dividend Collection

●      offeringId (ObjectId, ref: ‘offerings’)

●      offeringName (string)

●      walletAddress (string)

●      dividendAmount (number)

●      status (string)

●      dividendType (string)

●      paymentMethod (string, enum: paymentTypeEnum)

●      documentUrl (string)

●      declarationDate (Date)

●      recordDate (Date)

●      issuerId (ObjectId, ref: ‘users’)

TransferRequet Collection

●      userId (ObjectId, ref: ‘users’)

●      offeringId (ObjectId, ref: ‘offerings’)

●      securityName (string)

●      registeredName (string)

●      reason (string)

●      status (string, enum: transferStatusEnum)

●      isForceTransfer (boolean)

●      registeredEmailId (string)

●      walletAddress (string)

●      newRegisteredName (string)

●      newRegisteredEmailId (string)

●      newWalletAddress (string)

●      tokenQuantity (number)

●      remark (string)

SaveTransferRequet Collection

●      fromUserId (ObjectId, ref: ‘users’)

●      toUserId (ObjectId, ref: ‘users’)

●      offeringId (ObjectId, ref: ‘offerings’)

●      registeredName (string)

●      uniqueId (string)

●      remark (string)

●      tokenQuantity (number)

Sequence diagram

Flow Diagram