Next.js 14 DEX Interface for Blocksmith-forge DeFi Protocol
Modern, responsive web interface for the Blocksmith-forge decentralized exchange, built with Next.js 14, React, and Tailwind CSS.
This frontend application provides:
- Token Swap Interface: Seamless token swapping with slippage protection
- Liquidity Provision: Add and remove liquidity from AMM pools
- Wallet Integration: Native Freighter wallet support for Stellar
- Real-time Metrics: Live pool statistics and volume tracking
- Responsive Design: Beautiful UI that works on all devices
- Framework: Next.js 14 (App Router)
- UI Library: React 18
- Styling: Tailwind CSS
- Wallet: Freighter API integration
- Language: TypeScript
blocksmith-forge-Frontend/
├── package.json # Dependencies and scripts
├── README.md # This file
├── tsconfig.json # TypeScript configuration
├── tailwind.config.ts # Tailwind CSS configuration
├── next.config.js # Next.js configuration
└── src/
├── app/
│ ├── page.tsx # Main DEX interface
│ ├── layout.tsx # Root layout
│ └── globals.css # Global styles
└── lib/
└── freighter.ts # Wallet integration utilities
- Node.js 18.0.0 or higher
- npm or yarn
- Freighter wallet browser extension (for Stellar transactions)
# Clone the repository
git clone https://github.com/blocksmith-forge/blocksmith-forge-Frontend.git
cd blocksmith-forge-Frontend
# Install dependencies
npm installCreate a .env.local file in the root directory:
# Stellar Network Configuration
NEXT_PUBLIC_STELLAR_NETWORK=testnet
NEXT_PUBLIC_HORIZON_URL=https://horizon-testnet.stellar.org
# Backend API URL
NEXT_PUBLIC_API_URL=http://localhost:3000
# Contract Addresses
NEXT_PUBLIC_AMM_POOL_CONTRACT_ID=your_contract_id_hereThe project uses Tailwind CSS with a custom configuration. The config is located at tailwind.config.ts:
import type { Config } from 'tailwindcss'
const config: Config = {
content: [
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {
colors: {
background: 'var(--background)',
foreground: 'var(--foreground)',
},
},
},
plugins: [],
}
export default config# Run development server
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Run linter
npm run lintThe development server will start at http://localhost:3000
- Select from multiple supported tokens
- Set custom slippage tolerance (0.1%, 0.5%, 1.0%)
- Real-time price estimation
- Transaction confirmation
- Add liquidity to existing pools
- Remove liquidity by burning LP tokens
- View current liquidity positions
- Track LP token balance
- Connect Freighter wallet with one click
- View connected wallet address
- Sign transactions securely
- Auto-connection on page reload
- 24-hour trading volume
- Total liquidity locked
- LP token supply
- Personal position tracking
The application uses the Freighter wallet browser extension for Stellar transactions. Key functions:
Connects to the Freighter wallet and returns the public key.
Retrieves the public key of the connected wallet.
Signs a Stellar transaction using the connected wallet.
Signs an authentication entry for Soroban contracts.
The frontend communicates with the Blocksmith-forge backend API:
// Example API call
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/pools`);
const data = await response.json();The main DEX interface includes:
- Tab Navigation: Switch between Swap and Liquidity views
- Swap Panel: Token selection and amount inputs
- Liquidity Panel: Add/remove liquidity forms
- Stats Panel: Real-time pool statistics
Core wallet integration functions:
- Connection management
- Transaction signing
- Network configuration
- Local state persistence
The application uses Tailwind CSS with a custom dark theme:
- Primary Colors: Purple and pink gradients
- Background: Slate/dark gradient
- Glassmorphism: Backdrop blur effects
- Responsive: Mobile-first design
# Install Vercel CLI
npm install -g vercel
# Deploy
vercelFROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]# Build the application
npm run build
# The output is in the .next directory
# Serve with any Node.js hosting provider- All transactions require wallet signature
- Slippage protection on swaps
- Input validation on all forms
- HTTPS required in production
- Environment variables for sensitive data
- Chrome/Edge (latest)
- Firefox (latest)
- Safari (latest)
- Requires Freighter wallet extension
MIT License - see LICENSE file for details
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
- Organization: blocksmith-forge
- Developer: Aesdecodes
- GitHub: https://github.com/blocksmith-forge