Skip to content

torus-automations/NPRdreamweave

Repository files navigation

dreamweave

Dreamweave now centres on a TypeScript-first T3 stack: Next.js with tRPC, Prisma, and React Query. The Python FastAPI service has been retired in favour of a single Next.js application that owns both the UI and API surface. Docker Compose is provided for running the web stack locally with hot reload.

Confidentiality Notice

This repository contains confidential and proprietary information owned by Sepehr Mahmoudian. Access is limited to authorised collaborators for Dreamweave development. Do not share, distribute, or reuse any portion of these materials without explicit written permission from the owner.

2025-10-14 Update — Gaussian World Creation

  • Added a dedicated Dreamweave “Worlds & Environments” composer that turns prompts or multi-angle reference images into Gaussian splat assets.
  • New API endpoints: POST /api/worlds/generate (Fal.ai-backed world generation with credit metering) and POST /api/worlds/save (transaction-safe R2 uploads + asset registration).
  • Creation UI now supports text-to-world and image-to-world flows with preview and asset syncing.

Repository layout

  • apps/web – Next.js 15 application serving the marketing site and Dreamweave console
  • apps/web/lib/ai – AI service clients (Fal.ai, Gemini, Azure OpenAI) for content generation
  • apps/web/prisma – Prisma schema with PostgreSQL (Neon). Comprehensive models for users, communities, creations, assets, and crypto payments
  • apps/web/server – tRPC API routers for type-safe backend procedures
  • contracts/ – NEAR smart contracts (Rust): deposits, voting, staking, content-bounty-market
  • agents/ – Automation agents and orchestration helpers
  • scripts/ – Utility scripts (video watermarking, user management)
  • docker-compose.yml – Development stack with SQLite (use Neon for production)

Quick start with Docker

  1. Ensure Docker Desktop (or the Docker Engine + Compose Plugin) is running.

  2. From the repository root run:

    docker compose up --build
    • Next.js + tRPC runs at http://localhost:3000
    • Uses SQLite by default for development
    • For production: Configure Neon PostgreSQL in apps/web/.env
  3. Stop the stack with Ctrl+C. Add -d to run detached.

Volumes keep node_modules and .next inside the container to avoid polluting the host, while your code changes continue to hot reload through bind mounts.

Running services directly

If you prefer running without Docker:

  • Setup

    cd apps/web
    pnpm install
    cp .env.example .env
  • Configure Database

    For development (SQLite):

    # .env
    DATABASE_URL="file:./prisma/dev.db"

    For production (Neon PostgreSQL):

    # .env
    DATABASE_URL="postgresql://user:[email protected]/dbname?sslmode=require&pgbouncer=true"
    DIRECT_DATABASE_URL="postgresql://user:[email protected]/dbname?sslmode=require"
  • Start Development Server

    pnpm prisma:push    # Sync schema to database
    pnpm dev            # Start at http://localhost:3000
  • Optional Tools

    pnpm prisma:studio  # Database GUI at http://localhost:5555

Environment variables

Database

  • DATABASE_URL – Neon pooled connection string (required for production, uses PgBouncer)
  • DIRECT_DATABASE_URL – Neon direct connection string (required for migrations)

Authentication

  • NEXTAUTH_URL – Your site URL (e.g., http://localhost:3000)
  • NEXTAUTH_SECRET – Generate with openssl rand -base64 32
  • GOOGLE_CLIENT_ID – Google OAuth client ID (optional)
  • GOOGLE_CLIENT_SECRET – Google OAuth client secret (optional)

Blockchain & Payments

  • NEXT_PUBLIC_NEAR_NETWORK_ID – NEAR network (testnet or mainnet)
  • NEXT_PUBLIC_NEAR_CONTRACT_ID – NEAR deposit contract ID (must match NEAR_DEPOSIT_CONTRACT_ID)
  • NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID – WalletConnect project ID for EVM wallets
  • NEXT_PUBLIC_EVM_CONTRACT_ADDRESS – Your EVM wallet address for receiving payments
  • RPC URLs for on-chain verification (optional, uses public RPCs by default)

AI Services

  • FALAI_KEY – Fal.ai API key for image/video/3D generation
  • GEMINI_KEY – Google Gemini API key for AI vision and Dream Mode
  • ELABS_KEY – ElevenLabs API key for voice synthesis (optional)

Storage

  • R2_ACCESS_KEY_ID – Cloudflare R2 access key
  • R2_SECRET_ACCESS_KEY – Cloudflare R2 secret key
  • R2_BUCKET_NAME – R2 bucket name (e.g., dreamweave-media)
  • R2_ENDPOINT – R2 endpoint URL
  • R2_PUBLIC_URL – Public URL for accessing files

Email (Optional)

  • RESEND_API_KEY – Resend API key for transactional emails
  • RESEND_FROM_EMAIL – Sender email address

See apps/web/.env.example for a complete list with descriptions.

Database Schema

Dreamweave uses a comprehensive Prisma schema with PostgreSQL (Neon) including:

Core Features

  • Authentication – NextAuth v5 with Google OAuth, wallet authentication (NEAR + EVM chains)
  • Credits System – User credits, transactions, crypto payments (NEAR, ETH, MATIC, BNB, AVAX)
  • Creations – User-generated worlds, characters, objects, stories, voices, agents
  • Assets – Images, videos, audio, 3D models, Gaussian splats

Community Features

  • Communities – Custom branding, media assets, 10-tier custom ranking system
  • Member Gamification – Score, rank, level, contribution tracking
  • Activity Feed – Posts (text, image, video, audio, polls, announcements)
  • Engagement – Reactions, threaded comments, likes, views
  • Bounties – Community challenges with credit/badge rewards, submission review system
  • Moderation – Status tracking (active/on_notice/suspended/banned), admin & public notes

User Communication

  • Messages – Direct messages, system announcements, priority levels
  • Notifications – Activity feed for likes, comments, rank-ups, bounty approvals

See DATABASE_SCHEMA.md for detailed model documentation.

Next steps

  • Extend the tRPC router under apps/web/server/api/routers with domain-specific procedures
  • Set up Neon database and add connection strings to .env
  • Configure Google OAuth credentials for authentication (optional)
  • Set up Cloudflare R2 for file storage
  • Deploy NEAR contracts to testnet/mainnet
  • Configure AI service API keys (Fal.ai, Gemini)
  • Prepare your preferred deployment target for production

Documentation

  • Database: See DATABASE_SCHEMA.md for complete model documentation
  • Authentication: See BETTER_AUTH_SETUP.md for auth configuration
  • Smart Contracts: See SMART_CONTRACTS_EXPLAINED.md and individual contract READMEs
  • Security: See TOKEN_SECURITY_EXPLAINED.md for security best practices
  • File Storage: See R2_SETUP_GUIDE.md for Cloudflare R2 setup
  • User Scripts: See apps/web/scripts/README.md for user management utilities

Last Updated: 2025-10-14
Stack: Next.js 15, React 19, tRPC, Prisma, Better Auth, NEAR Protocol
License: See LICENSE file

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published