A brief, compelling description of what QIE-DEX does and why it matters.
Traditional decentralized exchanges face three critical challenges:
High Gas Fees: Ethereum-based DEXes can charge $50-200+ per transaction during peak times, making DeFi inaccessible for average users and preventing microtransactions
Slow Transaction Speed: 15-second block times create poor user experience, front-running opportunities, and limit real-world adoption for time-sensitive trading
Complex Token Creation: Launching tokens requires technical expertise, smart contract knowledge, and substantial costs ($1000+), creating barriers for entrepreneurs and businesses
QIE-DEX leverages the QIE blockchain's superior architecture:
⚡ 25,000 TPS with 1-second finality - Transactions complete faster than credit card payments
💰 Ultra-low fees (0.1% of Ethereum costs) - Makes microtransactions profitable and DeFi accessible to everyone
🛠️ No-code token creator - Launch tokens in seconds without writing a single line of code
🔄 Uniswap V2 architecture - Proven AMM model with familiar interface and battle-tested smart contracts
🌉 Cross-chain bridges - Seamless USDT/USDC transfers from Ethereum and BSC
📊 Decentralized oracles - Accurate price feeds powered by QIE's validator network
- About
- Features
- Installation
- Usage
- Project Structure
- Project Architecture
- Configuration
- API Documentation
- Contributing
- Testing
- Deployment
- Technologies Used
- Roadmap
- License
- Contact
- Acknowledgments
QieDex serves as a decentralized trading and token creation platform built on the high-performance QIE Network. The repository hosts the core qiedex directory for this Uniswap-style DEX implementation. It supports automated cryptocurrency transactions and liquidity provision on the QIE blockchain. QIE-DEX is a Real-Time Trade Route Auditor that verifies DEX trades are executed fairly by comparing expected vs actual execution, recording cryptographic proofs on QIE blockchain, and exposing MEV/slippage exploitation.
Route Optimizer Logic:
-
Direct swap calculation using constant product formula (x*y=k)
-
Multi-hop route discovery through intermediate tokens
-
Price impact calculation
-
Route ranking by best output
Proof Generation:
-
Creates proof object with trade parameters
-
Generates unique hash for blockchain storage
-
Links proof to transaction receipt
Smart Features:
-
Real-time route comparison
-
Visual feedback for trade fairness
-
Slippage detection (flags >2% deviation)
-
Historical audit tracking
-
1. Token Swapping : Trade any QIE-based token instantly with automated market maker (AMM) pricing, similar to Uniswap but with near-zero fees and 1-second confirmation.
-
2. Liquidity Provision : Provide liquidity to any trading pair and earn 0.3% of all trading fees. Become a market maker and earn passive income from the protocol.
-
3. Yield Farming & Staking : Stake your liquidity provider (LP) tokens to earn QIEDEX governance tokens. Participate in protocol decisions and earn rewards.
-
4. No-Code Token Creator : Revolutionary feature allowing anyone to create tokens without coding knowledge - perfect for: Loyalty reward programs, Gaming economies, Community governance tokens, Business utility tokens, NFT project currencies
-
5. Cross-Chain Bridges : Transfer USDT and USDC seamlessly between:
i). Ethereum ↔ QIE Network
ii). Binance Smart Chain ↔ QIE Network
-
6. Decentralized Governance : QIEDEX token holders can vote on protocol upgrades, fee structures, and ecosystem development proposals.
Before you begin, ensure you have the following installed:
Backend (qie-backend)
Runtime Dependencies
- express ^4.18.2
- cors ^2.8.5
- mongoose ^7.3.1
- dotenv ^16.3.1
- axios ^1.4.0
- ws ^8.14.0
Dev Dependencies None
Smart Contracts (qie-contracts) Dev Dependencies
- hardhat ^2.16.0
- @nomicfoundation/hardhat-toolbox ^3.0.0
- chai ^4.3.7
- ethers ^6.9.0
Frontend (qie-frontend)
Runtime Dependencies
- react ^18.2.0
- react-dom ^18.2.0
- react-scripts 5.0.1
Dev Dependencies None (react-scripts includes its own tooling)
WebSocket Service (qie-websocket)
Dependencies
- ws ^8.13.0
- dotenv ^16.3.1
- express ^4.18.2
- ethers ^6.7.0
- axios ^1.4.0
- node-cron ^3.0.2
Monorepo Root (qie-dex-monorepo)
Dev Dependencies
- concurrently ^8.2.0
- npm-run-all ^4.1.5 (Workspaces reference other packages; no runtime dependencies)
Infrastructure / Deployment Tools
- railway/render (implicit via railway.json config)
- vercel (implicit via vercel.json config)
- MongoDB plugin (from project.json)
git clone https://github.com/divs-spec/qie-dex.git
cd qie-dex/qiedexnpm install
# or
yarn installCreate a .env file in the root directory and add your configuration:
REACT_APP_API_KEY=your_api_key_here
REACT_APP_API_URL=your_api_url_here
# Add other environment variablesStart the development server:
npm start
# or
yarn startThe application will be available at http://localhost:3000
Create an optimized production build:
npm run build
# or
yarn build// Add a simple code example showing how to use your project
import { QieDex } from 'qie-dex';
const app = new QieDex({
// configuration options
});
app.initialize();1. Select Tokens: Choose token pair (USDC → ETH, etc.)
2. Enter Amount: Input trade size
3. Simulate Routes: Click "Find Best Route" to see all available paths
4. Record Proof: Save expected output to QIE blockchain
5. Execute Trade: Run trade and verify actual output matches proof
6. View Results: See if trade was fair or had excessive slippage
qiedex/
├─ .github/
│ └─ workflows/
│ └─ ci.yml # CI pipeline configuration
│
├─ backend/
│ ├─ Procfile # Backend process definition
│ ├─ package.json # Backend Node.js dependencies and scripts
│ └─ server.js # HTTP API server entrypoint
│
├─ config/
│ └─ database.js # Database connection and configuration
│
├─ contracts/
│ └─ scripts/
│ ├─ deploy.js # Smart contract deployment script
│ ├─ contracts.txt # Deployed contract addresses / metadata
│ ├─ hardhat.config.js # Hardhat configuration for QIE network
│ └─ package.json # Contracts tooling dependencies
│
├─ deployment/
│ ├─ Dockerfile.backend # Docker image for backend API
│ ├─ Dockerfile.frontend # Docker image for frontend app
│ ├─ Dockerfile.websocket # Docker image for websocket service
│ └─ deployment_config.txt # Infra/deployment configuration notes
│
├─ frontend/
│ ├─ public/
│ │ ├─ index.html # Frontend HTML shell
│ │ ├─ manifest.json # PWA / metadata config
│ │ └─ robots.txt # Crawler configuration
│ ├─ src/
│ │ ├─ index.tsx # React/TSX frontend entrypoint
│ │ └─ qie_dex_optimizer.tsx# DEX optimizer / main UI logic
│ ├─ .env # Frontend environment variables (local)
│ └─ package.json # Frontend dependencies and scripts
│
├─ test/
│ └─ mobile.js # Mobile-focused tests / utilities
│
├─ websocket/
│ ├─ Procfile # Websocket process definition
│ ├─ package.json # Websocket service dependencies
│ ├─ websocket-server.js # Websocket server entrypoint
│
├─ .env.example # Root env template for all services
├─ .gitignore # Global Git ignore rules
├─ DEPLOYMENT.md # Project-level deployment guide
├─ docker-compose.yml # Orchestrates backend/frontend/websocket
├─ package.json # Root scripts / dev tooling
├─ railway.json # Railway deployment config (root)
├─ vercel.json # Vercel deployment config (root)
└─ LICENSE # Project license
+---------------------+
| Frontend (UI) |
| React / TypeScript |
+----------+----------+
|
| HTTP / REST + WebSocket
v
+--------------------------+--------------------------+
| |
+-------+--------+ +-------+--------+
| Backend API | | Websocket |
| Node.js server | | Server |
| server.js | | websocket-... |
+-------+--------+ +-------+--------+
| |
| On-chain calls / events | Real-time
v v
+-------+----------------------------+ +---------+--------+
| Smart Contracts | | Database |
| contracts/ (Hardhat, deploy.js) |<-------------->| config/database |
| Deployed on QIE blockchain | off-chain | state, user data |
+----------------+------------------+ data +------------------+
+------------------------------------+
| Deployment & DevOps |
| Dockerfiles (backend/frontend/ws), |
| docker-compose, Railway, Vercel |
+------------------------------------+
- The frontend consumes the backend REST APIs and subscribes to the websocket server for real-time updates such as order book or trade events.
- The backend coordinates business logic, interacts with the smart contracts on the QIE blockchain, and persists off-chain data in the configured database.
- The websocket service pushes live data (prices, swaps, liquidity changes) from the backend and contracts to connected clients for a responsive trading UI.
- The contracts layer defines and deploys DEX and token-related smart contracts using Hardhat scripts, while the deployment folder plus Docker, Railway, and Vercel configs support containerized and cloud-based deployment of each service
This document outlines all configuration settings used across the QIE DEX Pro monorepo. Settings are categorized into Backend, Frontend, Database, Smart Contracts, WebSocket services, and additional operational layers.
PORT=3001
MONGO_URI=mongodb://localhost:27017/qiedex
REDIS_URL=redis://localhost:6379
JWT_SECRET=<secret>
ENABLE_LIVE_PRICES=true
RATE_LIMIT=10
RPC_URL=<QIE RPC endpoint>
CHAIN_ID=<network id>
CONTRACT_ROUTER=<router address>
CONTRACT_ORDERBOOK=<orderbook address>
| Endpoint | Method | Description |
|---|---|---|
| /api/health | GET | Health check |
| /api/orders | GET/POST | Create or fetch orders |
| /api/trade/quote | POST | Route optimization & swap quote |
| /api/trade/execute | POST | Executes swap on-chain |
| /api/user/favorites | GET/POST | Manage saved pairs |
| /api/history | GET | Trade history |
| /api/analytics | GET | Platform metrics |
- JWT-based authentication
- Wallet-signature verification via ethers.js
- Optional API key support
ENABLE_ROUTE_OPTIMIZATION=true
ENABLE_ORDER_MATCHING=true
ENABLE_AUDIT_PROOFS=true
ENABLE_DEBUG_LOGS=false
ENABLE_SIMULATION_MODE=false
REACT_APP_API_URL=http://localhost:3001
REACT_APP_WS_URL=ws://localhost:8080
REACT_APP_CHAIN_ID=<QIE chain id>
REACT_APP_ENABLE_NEW_UI=true
REACT_APP_THEME=dark
REACT_APP_SHOW_ADVANCED_TRADING=true
Supports UI theme variations:
- Light/Dark mode
- Forest Black theme
- Minimal theme
Primary color palette:
Primary: #16a34a
Secondary: #86efac
Background: #fef9f3
Accent: #f97316
- Slippage control
- Gas priority settings
- Chart intervals
- Mobile layout optimization
WS_PORT=8080
PRICE_REFRESH_INTERVAL=3000
ORDER_MATCH_INTERVAL=1000
RPC_URL=<rpc-endpoint>
ENABLE_PRICE_STREAMS=true
ENABLE_ORDER_EVENTS=true
| Channel | Purpose |
|---|---|
| price:update | Live token price feed |
| orderbook:update | Market depth updates |
| trade:executed | Trade execution notifications |
| order:triggered | Stop/limit order notifications |
| system:alert | System-level alerts |
PRIVATE_KEY=<deployer key>
RPC_URL=<QIE Mainnet/Testnet RPC>
ETHERSCAN_API=<optional>
npx hardhat run scripts/deploy.js --network <target>
Contracts managed:
- Router Contract
- Audit Registry
- Order Book Contract
Collections:
- Users
- Orders
- Trades
- Favorites
- AuditProofs
- PriceCache
- OrderTriggers
- Logs
- Analytics
Environment variables:
MONGO_URI=mongodb://localhost:27017/qiedex
MONGO_POOL_SIZE=20
MONGO_TIMEOUT=3000
Used for caching, order book storage, and sessions.
REDIS_URL=redis://localhost:6379
REDIS_TTL=5
RATE_LIMIT=10
CORS_ORIGIN=*
ENABLE_INPUT_VALIDATION=true
ENABLE_CSRF=true
Supports:
- Docker
- Kubernetes manifests
- Nginx reverse proxy routing
- GitHub Actions CI/CD
ENABLE_DEBUG_LOGS=true
LOG_LEVEL=verbose
DEV_WATCH_MODE=true
MOCK_PRICE_FEEDS=true
{
"api": {
"baseURL": "https://api.example.com",
"timeout": 5000
},
"features": {
"featureName": true
}
}GET /api/resource/:idParameters:
id(string): Resource identifier
Response:
{
"status": "success",
"data": {
// response data
}
}Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature/amazing-feature) - Make your changes
- Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow the existing code style
- Write clear commit messages
- Add tests for new features
- Update documentation as needed
Please read our Code of Conduct before contributing.
This monorepo contains multiple services (Frontend, Backend, WebSocket, Smart Contracts). Each workspace includes its own isolated testing environment.
This guide explains:
- How to run tests in each workspace
- How to run all tests in sequence
- How to generate and view coverage reports
- How to create new tests following the project structure
- Frontend:
frontend/src/__tests__/ - Backend:
backend/tests/ - Smart Contracts:
contracts/test/ - WebSocket:
websocket/tests/
cd frontend
npm testcd backend
npm testcd websocket
npm testcd contracts
npx hardhat testnpm run test --workspacesThis executes all test commands defined in each workspace.
npm run test:coverageNote: Ensure a test:coverage script exists in each workspace.
npx hardhat coverage- Create files under
src/__tests__/componentName.test.js - Use
render(),screen, andfireEventfor UI tests.
- API tests should mock DB or use a test MongoDB URI.
- Place files inside
backend/tests/. - Use
supertestto hit API endpoints.
- Use
ethers+chaiassertions. - Test gas usage, revert conditions, events.
- Mock or simulate WebSocket connections.
- Validate message structure, connection flow, and error conditions.
- CI/CD Integration: Optional GitHub Actions workflow can run tests on every push.
- Mock Services: Use mock providers for API and blockchain interactions.
- Snapshot Testing: Useful for UI and config output.
- Load Testing: Optional K6/Gatling scripts for backend stress.
- Clear caches:
npm cache verify - Delete
node_modulesand reinstall
- Ensure Jest or Hardhat coverage plugin is installed.
- Make sure server closes after tests (
server.close()).
- Use Hardhat Network instead of external RPCs.
Before deploying to any platform, ensure the following are ready:
- Environment variables configured (
.env) - Build command verified locally (
npm run buildoryarn build) - Production API endpoints set
- SSL/HTTPS readiness (handled automatically by Vercel/Netlify)
Below are the recommended deployment targets with clear instructions.
Vercel is recommended for optimal performance and CI-friendly deployments.
- Install the Vercel CLI:
npm i -g vercel- Log in:
vercel login- Deploy:
vercel deploy- For production deployment:
vercel deploy --prodSuitable for static builds or serverless-enabled frontends.
- Install Netlify CLI:
npm install -g netlify-cli- Authenticate:
netlify login- Link and deploy:
netlify deploy --prodIdeal for on-premise, VPS, or custom cloud environments.
docker build -t qie-dex .docker run -p 3000:3000 qie-dexdoctl apps create --spec app.yaml- Push Docker image to ECR
- Deploy via ECS Fargate
- Connect GitHub repo
- Auto-build and deploy
- Confirm Node version compatibility
- Delete
.nextordistfolder and rebuild - Validate environment variables
- Check CORS settings
- Verify API URL used during build
- Ensure server is reachable externally
- Use
docker logs <container> - Validate exposed ports
- Rebuild without cache:
docker build --no-cache -t qie-dex .- Test all routed pages
- Validate API responses
- Confirm environment variables in cloud dashboard
- Enable HTTPS/SSL
- Set up monitoring (optional)
- Add CI/CD using GitHub Actions
- Add deployment badges for Vercel/Netlify
- Create service health endpoints
Your deployment guide is now ready for Canva or documentation use.
This document provides a clean, production-ready deployment guide covering Vercel, Netlify, Docker, and major cloud providers.
Vercel is ideal for deploying the React-based frontend.
- Ensure the frontend is built:
npm run build- Install Vercel CLI:
npm i -g vercel- Deploy:
vercel deploy --prod- Configure:
- Build command:
npm run build - Output directory:
build - Automatically configures CDN, SSL, and CI/CD.
Netlify works seamlessly for static frontend deployments.
- Build the frontend:
npm run build- Deploy with Netlify CLI:
netlify deploy --prod- Configuration:
- Build command:
npm run build - Publish directory:
build
Use Docker for containerized backend, frontend, or WebSocket services.
docker build -t qie-dex .docker run -p 3000:3000 qie-dexdocker-compose up -dThis will orchestrate all services: backend, websocket, and frontend.
Below are best‑practice deployment options for production-level infrastructure.
- Frontend: S3 + CloudFront
- Backend: EC2, ECS, or Elastic Beanstalk
- WebSocket: EC2 or ECS Fargate
- Secrets: AWS Secrets Manager
- SSL: ACM
- Frontend: Firebase Hosting
- Backend: Cloud Run or GKE
- WebSocket: Cloud Run (with WebSocket enabled) or GKE
- Secrets: Secret Manager
- Use App Platform or Droplets
- Managed MongoDB available
- Good for small/medium teams
Before deployment, ensure:
NODE_ENV=production- MongoDB production URI configured
- Contract addresses and RPC URLs set
- WebSocket/REST API URLs updated
- HTTPS enabled
- Reverse proxy (Nginx) configured
- Rate limiting enabled
- Environment variables secured
- Logs + monitoring enabled
- Health checks enabled
- API regression tests run
- Smart contracts tested & verified
- Node.js: Core runtime for backend services.
- Express.js: HTTP server framework used to build RESTful APIs.
- MongoDB: NoSQL database used for storing users, trades, orders, and analytics.
- Redis: In-memory cache for price feeds, sessions, and order book acceleration.
- WebSocket (ws): Real-time communication layer for streaming prices, orders, and trades.
- Ethers.js: Blockchain interaction library for signing and executing smart contract functions.
- Hardhat: Development and testing environment for Solidity smart contracts.
- Solidity: Smart contract programming language.
- OpenZeppelin: Secure smart contract library.
- Ethers.js (client-side): Wallet connection and blockchain operations.
- React 18: Core UI library for building the trading interface.
- Tailwind CSS 3: Utility-first CSS framework for styling.
- React Router: Routing and navigation management.
- TradingView / Chart.js: Candle charts and technical indicators.
- WebSocket Client: Real-time price and order updates.
- MongoDB: Main data store for trades, orders, user settings.
- Redis: High-speed caching and rate limiting.
- IPFS: Decentralized storage for proofs and logs.
- Blockchain Storage: Immutable, on-chain audit records.
- Docker / Docker Compose: Containerized development & deployment.
- Kubernetes: Production-grade orchestration and scaling.
- GitHub Actions: CI/CD automation for builds, tests, and deployments.
- Nginx: Reverse proxy and SSL termination.
- PM2: Node process manager for backend services.
- Monitoring Tools: For logs and performance metrics.
- CDNs: Faster static asset delivery.
- Security Middleware: Helmet.js, CSP, sanitization layers.
This section outlines the complete technology stack used to build the QIE DEX application.
- Define core features: trading engine, order book, wallet integration, UI.
- Identify user personas: traders, liquidity providers, analysts.
- Prepare technical requirements and system design outline.
- Create milestone-based delivery plan.
- Design overall architecture: frontend, backend, WebSocket, blockchain, DB.
- Select technology stack: React, Express, MongoDB, Redis, Hardhat.
- Define contracts structure: router, order book, audit registry.
- Create diagrams for data flow, component interaction, and APIs.
- Initialize monorepo (frontend, backend, WebSocket, contracts).
- Configure environment variables and folder structure.
- Set up Docker for local development environment.
- Install all dependencies and tools.
- Implement base token swap router.
- Develop order book contract.
- Add audit proof registry.
- Test contracts with Hardhat and integrate scripts for deployment.
- Build REST endpoints for orders, trades, analytics.
- Integrate contract functions via ethers.js.
- Implement rate-limiting, validation, and error handling.
- Connect MongoDB and Redis for state and caching.
- Build WebSocket server for real-time updates.
- Implement order matching logic for limit/stop orders.
- Enable trade feed, price updates, and notifications.
- Optimize latency and caching mechanisms.
- Build trading UI (React + Tailwind).
- Add wallet integrations and contract interactions.
- Implement charts, order forms, order book, trade history.
- Optimize for mobile and responsive behavior.
- Write unit tests for backend and contracts.
- Perform UI and integration testing.
- Run end-to-end scenarios with Cypress.
- Conduct load testing for WebSocket and API.
- Containerize services with Docker.
- Deploy to cloud (AWS, GCP, Vercel, DigitalOcean).
- Configure CI/CD pipelines.
- Set up domain, SSL, and monitoring.
- Monitor performance, logs, and user behavior.
- Apply optimizations and patch updates.
- Begin roadmap features for Q2–Q4.
- Core decentralized exchange (DEX) functionality delivered
- Order book and matching engine implemented
- Smart contracts deployed on QIE blockchain
- Mobile-responsive interface optimized
- Leverage trading system (up to 10x)
- Liquidity mining and rewards module
- Governance token (QIEDEX) integration
- Cross-chain swapping bridge
- NFT marketplace module
- Fiat on-ramp provider integrations
- Expanded charting and real-time analytics
- Social trading features (copy trading, leaderboards)
- Native mobile applications (iOS & Android)
- Institutional trading API
- Automated trading bot framework
- Multi-language global support
Common Symptoms: UI breaks, wallet not connecting, charts not loading
Steps to Resolve:
- Ensure
npm installis completed in/frontend - Verify
.envcontains correct API & WebSocket URLs - Clear browser cache and restart dev server:
npm start - Check browser console for CORS or CSP errors
Common Symptoms: API returning 500 errors, routes not responding
Steps to Resolve:
- Confirm MongoDB is running:
docker psormongod - Restart backend:
npm run dev - Check
server.jsenvironment variables - Inspect logs for validation or rate-limit failures
Common Symptoms: Live order book not updating, trade feed lag
Steps to Resolve:
- Restart WebSocket server:
npm run devinside/websocket - Confirm port
8080is not blocked - Validate Redis is running if caching is enabled
- Check for client-side disconnections in browser console
Common Symptoms: Trades not executing, high slippage errors
Steps to Resolve:
- Ensure Hardhat network or QIE RPC is online
- Re-deploy contracts:
npx hardhat compile && npx hardhat run scripts/deploy.js - Confirm wallet is connected to correct network
- Validate liquidity availability and router path
Common Symptoms: Missing data, trades not visible, slow performance
Steps to Resolve:
- Check containers:
docker-compose up -d - Verify connection strings in backend
.env - Rebuild indexes for large collections
- Clear Redis caches to remove stale order book data
Common Symptoms: Vercel or server deployment failures
Steps to Resolve:
- Ensure build folder exists in frontend
- Validate configuration files (vercel.json, package.json, docker-compose)
- Check server logs for network binding errors
- Ensure Node version matches project requirements
If the issue persists after following the steps above:
- Check GitHub Issues for known bugs
- Review CI/CD and commit logs
- Enable debug logs in backend and WebSocket servers
- Contact the QIE DEX support team
This section is structured for inclusion in a README or Canva documentation page. Let me know if you want a visually styled Canva version (color blocks, icon headers, or timeline graphics).
This project is licensed under the MIT License - see the LICENSE file for details.
Divyani - @ikrakizoi - ikrakizoi2607@gmail.com
Project Link: https://github.com/divs-spec/qie-dex
- Thanks to QIE-DEX for inspiration
- Node.js & React.js for making development easier
⭐ If you find this project useful, please consider giving it a star on GitHub!
Made with ❤️ by Divyani