Skip to content

ashum9/redeemX

Repository files navigation

redeemX

Project Overview

redeemX is a next-generation Web3 marketplace for tradeable discount NFTs, built on the Solana blockchain. The platform enables users to buy, sell, redeem, and transfer exclusive deals as digital assets, revolutionizing how discounts are owned and exchanged. Designed for scalability, security, and seamless user experience, redeemX bridges real-world commerce with blockchain technology, empowering merchants and consumers alike.

Features

  • NFT-Powered Discounts: Mint, buy, sell, and redeem discounts as NFTs.
  • Merchant Dashboard: Onboard merchants, create and manage deals, view analytics.
  • User Dashboard: Track owned NFTs, redemption history, and transaction logs.
  • Marketplace Listings: Browse, filter, and search for available deals.
  • Secure Wallet Integration: Phantom/Solana wallet support for authentication and transactions.
  • On-Chain Transactions: All deal and NFT actions are recorded on Solana.
  • QR Code Redemption: Redeem deals in-store via QR code.
  • Responsive UI: Modern, mobile-friendly design.
  • Role-Based Access: Separate flows for merchants and users.
  • Privacy & Compliance: GDPR-ready privacy and terms pages.
  • Extensible API: RESTful endpoints for NFT minting, listing, redemption, and deal management.
  • Testing Suite: Automated tests for API and core logic.

Tech Stack

Layer Technology / Tool
Frontend Next.js (App Router), React, TypeScript, Tailwind CSS
Blockchain Solana Web3.js, Phantom Wallet Adapter
Backend Next.js API Routes, Prisma ORM, SQLite (dev)
NFT Logic Custom Solana NFT Marketplace class (solana-nft.ts)
Database Prisma, SQLite (dev), ready for Postgres/MySQL
Testing Jest, React Testing Library
Dev Tools ESLint, Prettier, Husky, VS Code, Git
Deployment Vercel, Docker-ready

Folder Structure

Path Purpose
app Next.js app pages, layouts, API routes
api RESTful API endpoints for NFTs, deals
dashboard User and merchant dashboard pages
deals Deals listing and details pages
components Reusable React components (UI, dashboard, deals, landing, etc.)
ui UI primitives (buttons, forms, modals, etc.)
dashboard Dashboard-specific components
deals Deal/NFT-specific components
landing Landing page sections
layout Layout components (navbar, footer, backgrounds)
marketplace Marketplace listing components
shared Shared visual components (cards, text)
wallet Wallet connection modal
lib Core logic: Solana NFT marketplace, types, utils, wallet context
hooks Custom React hooks
public Static assets (images, SVGs, logos)
prisma Prisma schema and dev database
styles Global CSS
tests Automated test suites
package.json Project dependencies and scripts
tsconfig.json TypeScript configuration
next.config.mjs Next.js configuration
postcss.config.mjs PostCSS configuration

System Architecture / Workflow

  • User Authentication: Users connect their Solana wallet (Phantom) to authenticate.
  • Deal Creation: Merchants create deals via dashboard; deals are stored and minted as NFTs.
  • NFT Minting: Users purchase deals, triggering NFT minting on Solana via solana-nft.ts.
  • Marketplace Listing: NFTs can be listed for sale, transferred, or redeemed.
  • Redemption: Users redeem NFTs in-store using QR codes; redemption is recorded on-chain.
  • API Layer: Next.js API routes handle backend logic, interfacing with Prisma and Solana.
  • Persistence: Deals and NFTs are stored in localStorage (dev) and/or database (Prisma).
  • Testing: Automated tests validate API endpoints and core logic.

Installation Guide

  1. Clone the repo
  2. Install dependencies with pnpm install
  3. Set up environment variables in .env.local
  4. Run locally: pnpm dev

Usage Instructions

  1. Start the app locally:
  2. Access the app: Open http://localhost:3000 in your browser.
  3. Connect Wallet: Use Phantom wallet extension to connect and interact.
  4. Create/Buy Deals: Use dashboard and marketplace pages to mint, buy, redeem, or transfer NFTs.

Deployment Steps

Vercel

  1. Push your code to GitHub.
  2. Import the repo in Vercel dashboard.
  3. Set environment variables (NEXT_PUBLIC_SOLANA_RPC_URL, etc.).
  4. Deploy.

Docker (Manual)

Prisma DB

For production, switch to Postgres/MySQL and update DATABASE_URL in .env. Run migrations:

Configuration Details

  • Environment Variables:
    • NEXT_PUBLIC_SOLANA_RPC_URL: Solana RPC endpoint (devnet/mainnet).
    • DATABASE_URL: Prisma database connection string.
  • Config Files:
    • next.config.mjs: Next.js settings.
    • schema.prisma: Database schema.
    • tsconfig.json: TypeScript options.
    • postcss.config.mjs: CSS processing.

Code Explanation

  • solana-nft.ts: Core NFT minting, transfer, redemption logic using Solana Web3.js.
  • components/dashboard/*: Merchant/user dashboard features.
  • components/deals/*: Deal/NFT UI and logic.
  • app/api/*: RESTful endpoints for NFT/deal actions.
  • types.ts: TypeScript types for deals, NFTs, users.
  • wallet-context.tsx: Wallet connection and context provider.
  • schema.prisma: Database schema for deals, users, NFTs.

Testing Guide

  • Run all tests:
  • Test coverage:
    • API endpoints (api-integration.test.ts)
    • Core logic (unit tests for solana-nft.ts)
  • Frameworks:
    • Jest, React Testing Library

Contributing Guidelines

  • Branching: Use feature branches (feature/xyz), bugfix branches (fix/xyz).
  • Commits: Write clear, atomic commit messages.
  • Pull Requests: Open PRs to main, link issues, request review.
  • Code Review: All PRs require review and CI pass.
  • Style: Follow ESLint/Prettier rules, TypeScript strictness.

Best Practices Followed

  • Coding Style: Consistent TypeScript, React functional components.
  • Naming Conventions: CamelCase for variables, PascalCase for components.
  • Architecture: Modular, reusable components; separation of concerns.
  • Git Workflow: Feature branching, atomic commits, PR reviews.
  • Security: Wallet authentication, input validation, error handling.
  • Testing: Automated unit and integration tests.

Troubleshooting and Common Issues

Issue Solution
Wallet not connecting Ensure Phantom extension is installed and unlocked
NFT minting fails ("transaction is already") Refresh page, ensure only one mint request per click
Database errors Check DATABASE_URL and run npx prisma migrate dev
API route not found Ensure Next.js server is running (npm run dev)
Styles not loading Check Tailwind/PostCSS config and restart dev server

Future Enhancements

  • Multi-chain support (Ethereum, Polygon)
  • Advanced analytics for merchants
  • Real-time notifications
  • Mobile app (React Native)
  • On-chain metadata storage
  • Marketplace orderbook and bidding
  • OAuth/social login integration

License

This project is licensed under the MIT License. See LICENSE for details.

Credits and Acknowledgements

  • Solana Web3.js and Phantom Wallet Adapter
  • Prisma ORM
  • Next.js and Vercel
  • All open-source contributors and referenced libraries

Contact Information

  • Author: Ashutosh Mishra
  • Email: ashum9dev@gmail.com
  • LinkedIn: linkedin.com/in/ashum9
  • GitHub: github.com/ashum9

For further questions or enterprise support, please contact via email or LinkedIn.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published