|
1 | 1 | # Atlas |
2 | 2 |
|
3 | | -A lightweight Ethereum L2 blockchain explorer. |
| 3 | +Atlas is an EVM blockchain explorer for ev-node based chains. It runs a Rust indexer, REST API, background workers, PostgreSQL database, and Vite frontend as one deployable stack. |
| 4 | + |
| 5 | +## Current Architecture |
| 6 | + |
| 7 | +- `atlas-server`: one Rust binary that runs the indexer, API, live SSE stream, metrics endpoint, optional faucet, optional Data Availability tracking, NFT metadata worker, missed-block gap-fill worker, and optional snapshot scheduler. |
| 8 | +- `postgres`: stores indexed blocks, transactions, addresses, ERC-20 data, NFT data, logs, contract verification data, proxy metadata, and indexer state. |
| 9 | +- `atlas-frontend`: Vite app served by unprivileged nginx on port 8080 inside the container, exposed as host port 80 by Docker Compose. |
4 | 10 |
|
5 | 11 | ## Quick Start |
6 | 12 |
|
7 | | -### Prerequisites |
| 13 | +Requirements: |
8 | 14 |
|
9 | | -- `just` 1.0+ |
10 | 15 | - Docker and Docker Compose |
11 | | -- Bun 1.0+ |
12 | | -- Rust 1.75+ |
13 | | - |
14 | | -### Running with Docker |
| 16 | +- An EVM JSON-RPC endpoint |
15 | 17 |
|
16 | 18 | ```bash |
17 | 19 | cp .env.example .env |
18 | | -docker-compose up -d |
| 20 | +# Edit RPC_URL and CHAIN_NAME in .env |
| 21 | +docker compose up -d |
19 | 22 | ``` |
20 | 23 |
|
21 | | -Access the explorer at http://localhost:3000 |
| 24 | +Default service URLs: |
| 25 | + |
| 26 | +| Service | URL | |
| 27 | +| --- | --- | |
| 28 | +| Explorer UI | `http://localhost` | |
| 29 | +| API through frontend nginx | `http://localhost/api` | |
| 30 | +| Backend API when running `atlas-server` locally | `http://localhost:3000/api` | |
| 31 | +| Prometheus metrics when backend port is reachable | `http://localhost:3000/metrics` | |
| 32 | +| Liveness probe when backend port is reachable | `http://localhost:3000/health/live` | |
| 33 | +| Readiness probe when backend port is reachable | `http://localhost:3000/health/ready` | |
22 | 34 |
|
23 | | -### Local Development |
| 35 | +The `postgres` service binds to `127.0.0.1:5432` for local development access. Docker Compose does not publish `atlas-server:3000` to the host by default; the frontend proxies browser API traffic through `http://localhost/api`. |
| 36 | + |
| 37 | +## Local Development |
| 38 | + |
| 39 | +Start only PostgreSQL: |
24 | 40 |
|
25 | 41 | ```bash |
26 | | -cp .env.example .env |
27 | | -docker-compose up -d postgres |
28 | | -just frontend-install |
| 42 | +docker compose up -d postgres |
29 | 43 | ``` |
30 | 44 |
|
31 | | -Start the backend: |
| 45 | +Run the backend: |
32 | 46 |
|
33 | 47 | ```bash |
34 | | -just backend-run |
| 48 | +cd backend |
| 49 | +export DATABASE_URL=postgres://atlas:atlas@localhost:5432/atlas |
| 50 | +export RPC_URL=http://localhost:8545 |
| 51 | +cargo run --bin atlas-server -- run |
35 | 52 | ``` |
36 | 53 |
|
37 | | -Start frontend: |
| 54 | +Run the frontend: |
38 | 55 |
|
39 | 56 | ```bash |
40 | | -just frontend-dev |
| 57 | +cd frontend |
| 58 | +bun install |
| 59 | +bun run dev |
41 | 60 | ``` |
42 | 61 |
|
43 | | -### Useful Commands |
| 62 | +The Vite dev server runs on `http://localhost:5173` and proxies `/api` to `http://localhost:3000`. |
| 63 | + |
| 64 | +## Operator Commands |
| 65 | + |
| 66 | +Run these from `backend/` unless noted otherwise: |
44 | 67 |
|
45 | 68 | ```bash |
46 | | -just --list |
47 | | -just frontend-lint |
48 | | -just frontend-build |
49 | | -just backend-fmt |
50 | | -just backend-clippy |
51 | | -just backend-test |
52 | | -just ci |
| 69 | +cargo run --bin atlas-server -- check |
| 70 | +cargo run --bin atlas-server -- migrate |
| 71 | +cargo run --bin atlas-server -- run |
| 72 | +cargo run --bin atlas-server -- db dump /tmp/atlas.dump |
| 73 | +cargo run --bin atlas-server -- db restore /tmp/atlas.dump |
| 74 | +cargo run --bin atlas-server -- db reset --confirm |
53 | 75 | ``` |
54 | 76 |
|
55 | | -## Configuration |
| 77 | +Useful validation commands: |
56 | 78 |
|
57 | | -Copy `.env.example` to `.env` and set `RPC_URL`. Common options: |
| 79 | +```bash |
| 80 | +cd backend && cargo test --workspace |
| 81 | +cd frontend && bun run build |
| 82 | +cd frontend && bun run lint |
| 83 | +``` |
58 | 84 |
|
59 | | -| Variable | Description | Default | |
60 | | -|----------|-------------|---------| |
61 | | -| `RPC_URL` | Ethereum JSON-RPC endpoint | Required | |
62 | | -| `DATABASE_URL` | PostgreSQL connection string | `postgres://atlas:atlas@localhost:5432/atlas` (local dev) | |
63 | | -| `START_BLOCK` | Block to start indexing from | `0` | |
64 | | -| `BATCH_SIZE` | Blocks per indexing batch | `100` | |
65 | | -| `RPC_REQUESTS_PER_SECOND` | RPC rate limit | `100` | |
66 | | -| `FETCH_WORKERS` | Parallel block fetch workers | `10` | |
67 | | -| `RPC_BATCH_SIZE` | Blocks per RPC batch request | `20` | |
68 | | -| `IPFS_GATEWAY` | Gateway for NFT metadata | `https://ipfs.io/ipfs/` | |
69 | | -| `REINDEX` | Wipe and reindex from start | `false` | |
| 85 | +## Configuration |
70 | 86 |
|
71 | | -See [White Labeling](docs/WHITE_LABELING.md) for branding customization (chain name, logo, colors). |
| 87 | +Copy `.env.example` to `.env`. `RPC_URL` is required. When running without Docker, `DATABASE_URL` is also required. |
| 88 | + |
| 89 | +Common variables: |
| 90 | + |
| 91 | +| Variable | Purpose | Default | |
| 92 | +| --- | --- | --- | |
| 93 | +| `RPC_URL` | EVM JSON-RPC endpoint | required | |
| 94 | +| `DATABASE_URL` | PostgreSQL connection URL for local backend runs | required outside Docker | |
| 95 | +| `CHAIN_NAME` | Display name served by `/api/config` and `/api/status` | `Unknown` | |
| 96 | +| `START_BLOCK` | First block to index | `0` | |
| 97 | +| `BATCH_SIZE` | Blocks written per DB batch | `100` | |
| 98 | +| `FETCH_WORKERS` | Concurrent block fetch workers | `10` | |
| 99 | +| `RPC_BATCH_SIZE` | Blocks fetched per RPC batch call | `20` | |
| 100 | +| `RPC_REQUESTS_PER_SECOND` | RPC request rate limit | `100` | |
| 101 | +| `DB_MAX_CONNECTIONS` | Indexer pool size | `20` | |
| 102 | +| `API_DB_MAX_CONNECTIONS` | API pool size | `20` | |
| 103 | +| `IPFS_GATEWAY` | Gateway for IPFS NFT metadata | `https://ipfs.io/ipfs/` | |
| 104 | +| `METADATA_FETCH_WORKERS` | NFT metadata worker concurrency | `4` | |
| 105 | +| `METADATA_RETRY_ATTEMPTS` | Retry attempts for retryable metadata failures | `3` | |
| 106 | +| `REINDEX` | Wipe indexed data and restart from `START_BLOCK` | `false` | |
| 107 | + |
| 108 | +Optional features include Data Availability tracking, faucet support, white-label branding, scheduled snapshots, JSON logging, CORS restriction, and a Solidity compiler cache. See [.env.example](.env.example) and [Backend](backend/README.md) for the full operator reference. |
72 | 109 |
|
73 | 110 | ## Documentation |
74 | 111 |
|
75 | | -- [API Reference](docs/API.md) |
76 | 112 | - [Architecture](docs/ARCHITECTURE.md) |
| 113 | +- [API Reference](docs/API.md) |
| 114 | +- [Features](docs/FEATURES.md) |
77 | 115 | - [White Labeling](docs/WHITE_LABELING.md) |
78 | | -- [Product Requirements](docs/PRD.md) |
| 116 | +- [Product and Roadmap](docs/PRD.md) |
| 117 | +- [Backend](backend/README.md) |
| 118 | +- [Frontend](frontend/README.md) |
79 | 119 |
|
80 | 120 | ## License |
81 | 121 |
|
|
0 commit comments