127 lines
2.5 KiB
Markdown
127 lines
2.5 KiB
Markdown
# Quick Start Guide
|
|
|
|
## Prerequisites
|
|
|
|
- Docker and Docker Compose
|
|
- Go 1.21+
|
|
- Node.js 20+
|
|
- PostgreSQL 16+ (or use Docker)
|
|
- Elasticsearch/OpenSearch (or use Docker)
|
|
|
|
## Setup
|
|
|
|
1. **Clone and navigate to project**
|
|
```bash
|
|
cd explorer-monorepo
|
|
```
|
|
|
|
2. **Configure environment**
|
|
```bash
|
|
cp .env.example .env
|
|
# Edit .env with your configuration
|
|
```
|
|
|
|
3. **Install dependencies**
|
|
```bash
|
|
make install
|
|
# Or manually:
|
|
# cd backend && go mod download
|
|
# cd ../frontend && npm install
|
|
```
|
|
|
|
4. **Start infrastructure**
|
|
```bash
|
|
docker-compose -f deployment/docker-compose.yml up -d postgres elasticsearch redis
|
|
```
|
|
|
|
5. **Run migrations**
|
|
```bash
|
|
cd backend
|
|
go run database/migrations/migrate.go
|
|
cd ..
|
|
```
|
|
|
|
6. **Check requirements**
|
|
```bash
|
|
./scripts/check-requirements.sh
|
|
```
|
|
|
|
7. **Start development services**
|
|
```bash
|
|
./scripts/run-dev.sh
|
|
```
|
|
|
|
Note: Make sure you're in the `explorer-monorepo` directory when running scripts.
|
|
|
|
Or manually:
|
|
```bash
|
|
# Terminal 1: Indexer
|
|
cd backend/indexer && go run main.go
|
|
|
|
# Terminal 2: API
|
|
cd backend/api/rest && go run main.go
|
|
|
|
# Terminal 3: Frontend
|
|
cd frontend && npm run dev
|
|
```
|
|
|
|
## Access
|
|
|
|
- **Frontend**: http://localhost:3000
|
|
- **API**: http://localhost:8080
|
|
- **API Gateway**: http://localhost:8081
|
|
- **Search Service**: http://localhost:8082
|
|
|
|
## Configuration
|
|
|
|
Edit `.env` file with your settings:
|
|
|
|
```env
|
|
# Database
|
|
DB_HOST=localhost
|
|
DB_PORT=5432
|
|
DB_USER=explorer
|
|
DB_PASSWORD=changeme
|
|
DB_NAME=explorer
|
|
|
|
# RPC
|
|
RPC_URL=http://localhost:8545
|
|
WS_URL=ws://localhost:8546
|
|
CHAIN_ID=138
|
|
|
|
# Search
|
|
SEARCH_URL=http://localhost:9200
|
|
```
|
|
|
|
## Next Steps
|
|
|
|
1. **Index blocks**: The indexer will start processing blocks automatically
|
|
2. **Browse explorer**: Visit http://localhost:3000 to see blocks and transactions
|
|
3. **Check API**: Test endpoints at http://localhost:8080/api/v1/blocks
|
|
4. **Review documentation**: See `docs/specs/` for detailed specifications
|
|
|
|
## Troubleshooting
|
|
|
|
### Database connection errors
|
|
- Ensure PostgreSQL is running: `docker ps`
|
|
- Check connection string in `.env`
|
|
- Verify migrations ran successfully
|
|
|
|
### Indexer not processing blocks
|
|
- Check RPC URL is correct and accessible
|
|
- Verify database connection
|
|
- Check logs for errors
|
|
|
|
### Frontend not loading
|
|
- Ensure API server is running
|
|
- Check API_URL in frontend `.env`
|
|
- Verify CORS settings
|
|
|
|
## Production Deployment
|
|
|
|
See `deployment/` directory for:
|
|
- Kubernetes manifests
|
|
- Docker Compose files
|
|
- CI/CD configurations
|
|
|