98 lines
2.5 KiB
Markdown
98 lines
2.5 KiB
Markdown
# Environment Files Guide
|
|
|
|
This project uses environment files for configuration. Each workspace has its own `.env` files.
|
|
|
|
## File Structure
|
|
|
|
### Frontend (`frontend/`)
|
|
- `.env.local.example` - Template for local development
|
|
- `.env.production.example` - Template for production deployment
|
|
- `.env.local` - Local development (gitignored)
|
|
- `.env.production` - Production deployment (gitignored)
|
|
|
|
### Backend (`backend/`)
|
|
- `.env.example` - Template for backend API
|
|
- `.env.indexer.example` - Template for event indexer
|
|
- `.env` - Backend API configuration (gitignored)
|
|
- `.env.indexer` - Indexer configuration (gitignored)
|
|
|
|
### Contracts (`contracts/`)
|
|
- `.env.example` - Template for contract deployment
|
|
- `.env` - Contract deployment configuration (gitignored)
|
|
|
|
## Setup Instructions
|
|
|
|
### 1. Frontend Setup
|
|
|
|
**For local development:**
|
|
```bash
|
|
cd frontend
|
|
cp .env.local.example .env.local
|
|
# Edit .env.local with your values
|
|
```
|
|
|
|
**For production:**
|
|
```bash
|
|
cd frontend
|
|
cp .env.production.example .env.production
|
|
# Edit .env.production with your values
|
|
```
|
|
|
|
### 2. Backend Setup
|
|
|
|
**Backend API:**
|
|
```bash
|
|
cd backend
|
|
cp .env.example .env
|
|
# Edit .env with your database password and contract addresses
|
|
```
|
|
|
|
**Event Indexer:**
|
|
```bash
|
|
cd backend
|
|
cp .env.indexer.example .env.indexer
|
|
# Edit .env.indexer with your database password and contract address
|
|
```
|
|
|
|
### 3. Contracts Setup
|
|
|
|
```bash
|
|
cd contracts
|
|
cp .env.example .env
|
|
# Edit .env with your private key and RPC URLs
|
|
```
|
|
|
|
## Required Values
|
|
|
|
### Frontend
|
|
- `NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID` - Get from https://cloud.walletconnect.com
|
|
- `NEXT_PUBLIC_TREASURY_WALLET_ADDRESS` - After contract deployment
|
|
- `NEXT_PUBLIC_SUB_ACCOUNT_FACTORY_ADDRESS` - After contract deployment
|
|
|
|
### Backend
|
|
- `DATABASE_URL` - PostgreSQL connection string
|
|
- `CONTRACT_ADDRESS` - Treasury wallet address (after deployment)
|
|
- `RPC_URL` - Chain 138 RPC endpoint
|
|
|
|
### Contracts
|
|
- `PRIVATE_KEY` - Deployer account private key (with ETH balance on Chain 138)
|
|
- `CHAIN138_RPC_URL` - Chain 138 RPC endpoint
|
|
|
|
## Security Notes
|
|
|
|
⚠️ **NEVER commit `.env` files to version control!**
|
|
|
|
- All `.env` files are gitignored
|
|
- Only `.env.example` files should be committed
|
|
- Use strong passwords and secure private keys
|
|
- Rotate credentials regularly
|
|
|
|
## Chain 138 Configuration
|
|
|
|
All environment files are pre-configured for Chain 138:
|
|
- RPC URL: `http://192.168.11.250:8545`
|
|
- WebSocket: `ws://192.168.11.250:8546`
|
|
- Chain ID: `138`
|
|
|
|
Update these if your Chain 138 RPC endpoints are different.
|