BlockCreative is a platform that connects scriptwriters with producers, leveraging blockchain technology for secure transactions and AI for script analysis.
- Authentication: Connect with blockchain wallet or email/social login via Reown
- User Roles: Writer and Producer roles with different permissions and workflows
- Project Management: Producers can create, fund, and manage script acquisition projects
- Script Submissions: Writers can submit scripts to projects with AI-powered analysis
- Blockchain Integration: NFT minting for script ownership, escrow for secure payments
- AI Analysis: Gemini AI integration for script quality and marketability analysis
- Frontend: Next.js with React components
- Backend: Next.js API routes
- Database: MongoDB
- Authentication: Reown AppKit
- Blockchain: Lisk Sepolia Testnet
- AI: Google Gemini Pro API
- Smart Contracts: Custom NFT and escrow contracts
- Node.js 18+ and npm
- MongoDB instance (Atlas or local)
- Wallet with Lisk Sepolia Testnet tokens
- Google Gemini API key
- Reown Project ID (for wallet authentication)
- Pinata account (for IPFS storage)
-
Clone the repository:
git clone https://github.com/yourusername/blockcreative.git cd blockcreative -
Install dependencies:
npm install
-
Set up environment variables:
npm run setup-env
This will create a
.envfile from the template if it doesn't exist.Then edit
.envwith your own values:# MongoDB Configuration MONGODB_URI=mongodb+srv://yourusername:yourpassword@cluster0.example.mongodb.net/blockcreative?retryWrites=true&w=majority MONGODB_DB=blockcreative # Authentication - Reown NEXT_PUBLIC_APP_URL=http://localhost:3000 # Blockchain - Lisk Sepolia Testnet LISK_RPC_URL=https://sepolia.rpc.example.com LISK_PRIVATE_KEY=your_private_key_for_platform_wallet LISK_CHAIN_ID=11155111 # Smart Contract Addresses SCRIPT_NFT_ADDRESS=0x0000000000000000000000000000000000000000 PROJECT_REGISTRY_ADDRESS=0x0000000000000000000000000000000000000000 ESCROW_MANAGER_ADDRESS=0x0000000000000000000000000000000000000000 PLATFORM_FEE_MANAGER_ADDRESS=0x0000000000000000000000000000000000000000 # Public environment variables NEXT_PUBLIC_LISK_RPC_URL=https://sepolia.rpc.example.com NEXT_PUBLIC_SCRIPT_NFT_ADDRESS=0x0000000000000000000000000000000000000000 NEXT_PUBLIC_PROJECT_REGISTRY_ADDRESS=0x0000000000000000000000000000000000000000 NEXT_PUBLIC_ESCROW_MANAGER_ADDRESS=0x0000000000000000000000000000000000000000 NEXT_PUBLIC_PLATFORM_FEE_MANAGER_ADDRESS=0x0000000000000000000000000000000000000000 NEXT_PUBLIC_PLATFORM_FEE_PERCENTAGE=3 # IPFS Storage (Pinata) PINATA_JWT=your_pinata_jwt_token NEXT_PUBLIC_GATEWAY_URL=https://gateway.pinata.cloud # AI Integration GEMINI_API_KEY=your_gemini_api_key # Platform Configuration PLATFORM_FEE_PERCENTAGE=3 # Debugging (optional) DEBUG_AUTH=false -
Start the development server:
npm run dev
-
Open http://localhost:3000 in your browser.
To ensure your environment is properly configured, you can validate your setup:
npm run validate-envThis will check that all required environment variables are set and provide feedback on any missing values.
When setting up the project on a new computer:
- Clone the repository
- Run the setup script:
npm run setup-env
- Update the
.envfile with your actual values - Validate your configuration:
npm run validate-env
This approach ensures that your environment configuration remains consistent across different machines without having to manually recreate the .env file each time.
To verify your setup is working correctly:
-
Check MongoDB Connection:
- Look for successful connection logs in your terminal
- The application will fall back to mock data if connection fails
-
Test Authentication:
- Navigate to http://localhost:3000/signin
- Connect your wallet using Reown AppKit
- Check browser console for authentication flow logs
-
Verify API Endpoints:
- After authentication, test API with: http://localhost:3000/api/users/me
- Should return your user information if authentication is working
-
Test Blockchain Integration:
- Navigate to writer/producer dashboard
- Look for wallet connection info and blockchain status
-
Verify AI Integration:
- Submit a test script via the writer workflow
- Check for Gemini API analysis response
# Start development server
npm run dev
# Build for production
npm run build
# Start production server
npm run start
# Run linting
npm run lint
# Clean build files
npm run clean
# Clean and rebuild
npm run clean:buildIf you experience authentication problems:
-
Check Reown AppKit Configuration:
- Verify your project ID in
src/context/index.tsx - Check the domain configuration matches your deployment
- Verify your project ID in
-
Debug Authentication Flow:
- Set
DEBUG_AUTH=truein your.env.local - Check browser console and server logs for detailed auth flow
- Set
-
Clear Authentication State:
- Clear localStorage and cookies in your browser
- Use the
/signoutroute to properly disconnect
If you have issues connecting to MongoDB:
-
Check Database URI:
- Verify your MongoDB URI in
.env.localis correct - Ensure your IP address is whitelisted in MongoDB Atlas
- Verify your MongoDB URI in
-
Connection Fallback:
- The application falls back to mock data in development
- Check the connection status in the console logs
-
Database Models:
- Models are defined in
src/models/directory - Ensure your MongoDB cluster has appropriate permissions
- Models are defined in
-
Wallet Connection:
- Make sure your wallet has Lisk Sepolia testnet configured
- Check browser console for wallet connection errors
-
Contract Interactions:
- Verify contract addresses in your
.env.local - Check you have sufficient testnet tokens for transactions
- Verify contract addresses in your
-
Network Configuration:
- Confirm the RPC URL is accessible
- Verify chain ID matches Lisk Sepolia (11155111)
If you experience issues with CSS not loading properly:
-
Clear Next.js Cache:
npm run clean npm run dev
-
Check Tailwind Configuration:
- Review
tailwind.config.tssettings - Ensure all required CSS files are imported
- Review
-
Disable CSS Optimization:
- Make sure
optimizeCss: falseis set innext.config.js
- Make sure
- Authentication:
src/lib/auth-helpers.ts,src/middleware.ts - API Routes:
src/app/api/ - Database:
src/lib/mongodb.ts,src/models/ - Blockchain:
src/lib/blockchain.ts - Components:
src/components/ - Pages:
src/app/
The platform utilizes the following smart contracts:
- ScriptNFT: ERC-721 contract for NFT representation of script ownership
- ProjectRegistry: Manages project creation and lifecycle
- EscrowManager: Handles fund escrow and payment processing
- PlatformFeeManager: Manages platform fees (3%)
For detailed API endpoints documentation, see API-DOCUMENTATION.md.
For architectural overview, see BlockCreativeArchitecture.md.
- Connect wallet and complete writer onboarding
- Browse available projects
- Submit scripts to projects
- Receive AI analysis of script
- Update submissions based on feedback
- Receive payment when scripts are purchased
- Transfer NFT ownership to producer
- Connect wallet and complete producer onboarding
- Create projects with requirements and budget
- Fund projects through blockchain escrow
- Review and provide feedback on submissions
- Purchase scripts and receive NFT ownership
- Mint NFTs for purchased scripts
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.