Skip to content

SkyDev16/Merry-Christmas-crypto-store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Full-Stack Web3 Store Project

πŸš€ Quick Start

Run both frontend and backend with a single command:

npm install
npm start

This will start:

  • Backend Server on http://localhost:3001
  • Frontend App on http://localhost:8080

πŸ“ Project Structure

β”œβ”€β”€ src/                      # Frontend React app
β”‚   β”œβ”€β”€ pages/               # Home, Staking, Exchange pages
β”‚   β”‚   β”œβ”€β”€ Index.tsx       # Main store page
β”‚   β”‚   β”œβ”€β”€ Staking.tsx     # Staking interface
β”‚   β”‚   β”œβ”€β”€ Exchange.tsx    # Token swap interface
β”‚   β”‚   └── Auth.tsx        # Authentication page
β”‚   β”œβ”€β”€ components/          # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ Header.tsx      # Navigation header
β”‚   β”‚   β”œβ”€β”€ Footer.tsx      # Footer component
β”‚   β”‚   └── ui/             # shadcn/ui components
β”‚   β”œβ”€β”€ layout/              # Layout wrappers
β”‚   β”‚   └── MainLayout.tsx  # Main page layout
β”‚   β”œβ”€β”€ abi/                 # Smart contract ABIs
β”‚   β”‚   β”œβ”€β”€ StakingContract.json
β”‚   β”‚   └── NFTContract.json
β”‚   β”œβ”€β”€ hooks/               # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ useWallet.ts    # Wallet connection
β”‚   β”‚   β”œβ”€β”€ useAuth.ts      # Authentication
β”‚   β”‚   └── useCart.ts      # Shopping cart
β”‚   β”œβ”€β”€ token/               # Token configurations
β”‚   β”‚   └── tokenList.ts    # Supported tokens
β”‚   └── services/            # API services
β”‚       └── api.ts          # Backend API client
β”‚
β”œβ”€β”€ server/                  # Backend Express server
β”‚   β”œβ”€β”€ modules/            # Feature modules
β”‚   β”‚   β”œβ”€β”€ user/           # User management
β”‚   β”‚   β”œβ”€β”€ nft/            # NFT operations
β”‚   β”‚   β”œβ”€β”€ auction/        # Auction system
β”‚   β”‚   └── auth/           # Authentication
β”‚   β”œβ”€β”€ routes/             # API routes
β”‚   β”‚   └── api/            # API endpoints
β”‚   β”œβ”€β”€ helper/             # Utility functions
β”‚   β”‚   β”œβ”€β”€ validation.js   # Input validation
β”‚   β”‚   └── authMiddleware.js # JWT auth
β”‚   └── server.js           # Server entry point
β”‚
└── public/                 # Static assets
    β”œβ”€β”€ favicon.ico
    └── robots.txt

πŸ”§ Available Scripts

  • npm start - Run both frontend and backend concurrently
  • npm run dev - Run frontend only (development mode)
  • npm run server - Run backend only
  • npm run build - Build for production
  • npm run lint - Run ESLint

πŸ” Features

Frontend

  • βœ… Wallet connection (MetaMask)
  • βœ… User authentication with wallet signature
  • βœ… Staking interface
  • βœ… Token exchange/swap
  • βœ… Shopping cart
  • βœ… Responsive design with Tailwind CSS
  • βœ… Modern UI with shadcn/ui components

Backend

  • βœ… RESTful API with Express
  • βœ… JWT authentication
  • βœ… Wallet signature verification
  • βœ… User management
  • βœ… NFT operations
  • βœ… Auction system
  • βœ… CORS enabled

🌐 API Endpoints

Authentication

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - Login user
  • POST /api/auth/verify-wallet - Verify wallet signature

Users

  • GET /api/users/:id - Get user by ID
  • GET /api/users/profile/:address - Get user by wallet address
  • PUT /api/users/:id - Update user

NFTs

  • GET /api/nfts - Get all NFTs
  • GET /api/nfts/:id - Get NFT by ID
  • POST /api/nfts - Create NFT (auth required)
  • PUT /api/nfts/:id - Update NFT (auth required)

Auctions

  • GET /api/auctions - Get all auctions
  • GET /api/auctions/:id - Get auction by ID
  • POST /api/auctions - Create auction (auth required)
  • POST /api/auctions/:id/bid - Place bid (auth required)

πŸ”‘ Environment Variables

Copy .env.example to .env and configure:

# Backend
PORT=3001
JWT_SECRET=your-secret-key

# Frontend
VITE_API_URL=http://localhost:3001/api
VITE_CHAIN_ID=1
VITE_STAKING_CONTRACT_ADDRESS=0x...
VITE_NFT_CONTRACT_ADDRESS=0x...

πŸ› οΈ Tech Stack

Frontend

  • React 18
  • TypeScript
  • Vite
  • Tailwind CSS
  • shadcn/ui
  • Ethers.js v6
  • React Router
  • TanStack Query

Backend

  • Node.js
  • Express
  • JWT
  • Ethers.js
  • CORS

πŸ“¦ Installation

  1. Clone the repository
  2. Install dependencies:
    npm install
  3. Configure environment variables
  4. Start the application:
    npm start

πŸš€ Deployment

Frontend

npm run build

Deploy the dist folder to your hosting service.

Backend

Deploy the server folder to your Node.js hosting service.

πŸ”’ Security Notes

  • Change JWT_SECRET in production
  • Use environment variables for sensitive data
  • Implement rate limiting for production
  • Add database instead of in-memory storage
  • Enable HTTPS in production

πŸ“ Next Steps

  1. Connect to a real database (MongoDB, PostgreSQL)
  2. Deploy smart contracts
  3. Add more token pairs for exchange
  4. Implement real-time updates with WebSockets
  5. Add transaction history
  6. Implement admin panel

About

πŸŽ„Happy ✨"Merry Christmas"🎁Please give me⭐

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •