💻 Tech Stack

SourceNet is built with modern, cutting-edge technologies across frontend, backend, blockchain, and storage layers.

Frontend Technologies

Next.js 14

React framework with App Router, server components, and advanced optimization features.

  • App Router: File-based routing with layouts and nested routes
  • Server Components: Optimized performance with RSC architecture
  • API Routes: Backend integration and data fetching
  • Image Optimization: Automatic image optimization with next/image

TypeScript

Strongly-typed JavaScript for enhanced developer experience and fewer runtime errors.

  • Type Safety: Catch errors at compile time
  • IntelliSense: Better IDE support and autocomplete
  • Refactoring: Safer code refactoring

Tailwind CSS

Utility-first CSS framework for rapid UI development.

  • Responsive Design: Mobile-first approach
  • Dark Mode: Built-in dark mode support
  • Custom Themes: Configurable design tokens

Zustand

Lightweight state management library for React.

import { create } from 'zustand';

const useStore = create((set) => ({
  user: null,
  setUser: (user) => set({ user }),
  clearUser: () => set({ user: null }),
}));

SUI TypeScript SDK

Official SDK for interacting with the SUI blockchain.

  • Transaction Building: Programmable Transaction Blocks (PTB)
  • zkLogin: Zero-knowledge authentication
  • Wallet Integration: Support for SUI wallets
  • Query API: Read blockchain state and events

Axios

HTTP client for API requests with interceptors and error handling.

const api = axios.create({
  baseURL: process.env.NEXT_PUBLIC_API_URL,
  headers: {
    'Content-Type': 'application/json',
  },
});

api.interceptors.request.use((config) => {
  const token = localStorage.getItem('token');
  if (token) {
    config.headers.Authorization = `Bearer ${token}`;
  }
  return config;
});

Backend Technologies

Node.js & Express.js

JavaScript runtime and web framework for building the REST API.

  • Middleware: Authentication, validation, error handling
  • Routing: Organized API endpoints
  • Performance: Async/await and non-blocking I/O

PostgreSQL

Advanced open-source relational database.

FeatureUsage
JSONBStore DataPod schema and metadata
TransactionsACID compliance for purchase flows
IndexesB-tree and GiST indexes for performance
Full-Text SearchSearch DataPods by title/description

Prisma ORM

Type-safe database client with schema migrations.

// Prisma schema
model User {
  id          String   @id @default(uuid())
  googleId    String   @unique
  email       String   @unique
  suiAddress  String   @unique
  salt        String
  datapods    DataPod[]
  purchases   Purchase[]
  createdAt   DateTime @default(now())
}

Redis

In-memory data store for caching and session management.

  • Session Store: JWT token storage
  • Rate Limiting: Request throttling with sliding window
  • Cache: DataPod metadata caching (TTL: 5 minutes)
  • Download Tokens: Temporary file access tokens (TTL: 1 hour)

BullMQ

Job queue for background processing.

import { Queue, Worker } from 'bullmq';

const fulfillmentQueue = new Queue('purchase-fulfillment');

const worker = new Worker('purchase-fulfillment', async (job) => {
  const { purchaseId } = job.data;
  
  // 1. Fetch encrypted data
  // 2. Re-encrypt for buyer
  // 3. Upload to Walrus
  // 4. Update purchase record
});

Socket.io

Real-time bidirectional communication for live updates.

  • Purchase Notifications: Notify buyers when ready to download
  • Marketplace Updates: New DataPods published
  • Analytics: Real-time dashboard updates

Blockchain Technologies

SUI Blockchain

High-performance Layer 1 blockchain with parallel transaction execution.

FeatureBenefit
Move LanguageSafe, resource-oriented smart contracts
Object ModelFirst-class object ownership
Parallel ExecutionHigh throughput (100k+ TPS)
Low CostGas fees in MIST (fractions of SUI)

Move Smart Contracts

Smart contract language designed for asset safety.

module sourcenet::datapod {
    use sui::object::{Self, UID};
    use sui::tx_context::TxContext;
    
    struct DataPod has key, store {
        id: UID,
        seller: address,
        title: String,
        price_sui: u64,
        data_hash: String,
        blob_id: String,
    }
    
    public entry fun create_datapod(
        title: String,
        price_sui: u64,
        data_hash: String,
        blob_id: String,
        ctx: &mut TxContext
    ) {
        // Create DataPod object
    }
}

zkLogin

Zero-knowledge proof-based authentication using OAuth providers.

  • Privacy: No private key exposure
  • User-Friendly: Login with Google, no wallet needed
  • Security: Cryptographic proofs (Groth16)
  • Non-Custodial: Users maintain full control

🔐 zkLogin Flow

1. User authenticates with Google
2. Generate ephemeral key pair
3. Request salt from backend
4. Get ZK proof from Mysten Labs
5. Derive SUI address
6. Sign transactions with zkProof


Storage Technologies

Walrus Protocol

Decentralized storage protocol built for the SUI ecosystem.

ComponentDescription
PublisherUpload endpoint for storing data
GatewayRetrieve endpoint for fetching data
Storage NodesDistributed nodes storing data chunks
Erasure CodingRedundancy for fault tolerance
// Upload to Walrus
const formData = new FormData();
formData.append('file', encryptedBlob);

const response = await fetch(
  'https://publisher.walrus-testnet.walrus.space/v1/store',
  { method: 'PUT', body: formData }
);

const { blobId } = await response.json();

// Download from Walrus
const blob = await fetch(
  `https://gateway.walrus.space/ipfs/${blobId}`
);

Encryption

Industry-standard encryption for data at rest and in transit.

  • Algorithm: AES-256-CBC
  • Key Generation: Cryptographically secure random bytes
  • IV: Unique initialization vector per file
  • Key Storage: Encrypted with master key, stored separately

AI Technologies

OpenAI via OpenRouter

AI-powered conversational assistance using GPT-4.

  • Model: deepseek/deepseek-chat (cost-effective, high quality)
  • Context: DataPod awareness, platform knowledge
  • Features: Multi-turn conversations, history persistence
  • Rate Limits: 20 requests/min per user

Development Tools

ToolPurpose
ESLintCode linting and style enforcement
PrettierCode formatting
ZodRuntime type validation
JestUnit testing
GitVersion control

🚀 Next Steps

Now that you understand the tech stack, explore the Authentication flow to see how zkLogin works, or check out the Seller Flow to understand data upload.