|
| 1 | +# NEM Block Explorer |
| 2 | + |
| 3 | +This project is a NEM blockchain explorer built using the Next.js framework. It provides a user-friendly interface to explore and interact with the NEM blockchain, including features such as transaction searches, block exploration, and statistic data visualization. |
| 4 | + |
| 5 | +## Folder Structure |
| 6 | + |
| 7 | +- **api/**: Contains modules for making requests to APIs to fetch data. |
| 8 | +- **components/**: Contains reusable UI components. |
| 9 | +- **config/**: Contains app configuration and reexports environment variables. |
| 10 | +- **constants/**: Contains constants used across the app. |
| 11 | +- **pages/**: Contains the pages of the application. |
| 12 | +- **public/**: Contains static files. |
| 13 | +- **scripts/**: Contains CI scripts. |
| 14 | +- **styles/**: Contains stylesheets. |
| 15 | +- **utils/**: Contains commonly used functions. |
| 16 | +- **.env**: Contains environment variables. |
| 17 | + |
| 18 | +## Environment Variables |
| 19 | + |
| 20 | +- `NEXT_PUBLIC_NATIVE_MOSAIC_ID`: Native mosaic ID |
| 21 | +- `NEXT_PUBLIC_NATIVE_MOSAIC_TICKER`: Native mosaic ticker |
| 22 | +- `NEXT_PUBLIC_NATIVE_MOSAIC_DIVISIBILITY`: Native mosaic divisibility |
| 23 | +- `NEXT_PUBLIC_BLOCKCHAIN_UNWIND_LIMIT`: Blockchain unwind limit |
| 24 | +- `NEXT_PUBLIC_REQUEST_TIMEOUT`: Request timeout |
| 25 | +- `NEXT_PUBLIC_API_BASE_URL`: Explorer REST API endpoint |
| 26 | +- `NEXT_PUBLIC_SUPERNODE_STATS_URL`: Supernodes statistics endpoint |
| 27 | +- `NEXT_PUBLIC_NODELIST_URL`: Node list endpoint |
| 28 | +- `NEXT_PUBLIC_MARKET_DATA_URL`: Market data endpoint |
| 29 | +- `NEXT_PUBLIC_HISTORICAL_PRICE_URL`: Historical coin price endpoint |
| 30 | + |
| 31 | +## Requirements |
| 32 | + |
| 33 | +- Node.js v20.11.0 |
| 34 | + |
| 35 | +## Installation |
| 36 | + |
| 37 | +This project is part of a Product monorepo. Follow the steps below to set up and run the project. |
| 38 | + |
| 39 | +1. Clone the repository from GitHub: |
| 40 | + ```bash |
| 41 | + git clone https://github.com/symbol/product.git |
| 42 | + ``` |
| 43 | + |
| 44 | +2. Initialize: |
| 45 | + ```bash |
| 46 | + bash init.sh |
| 47 | + ``` |
| 48 | + |
| 49 | +3. Navigate to the project folder: |
| 50 | + ```bash |
| 51 | + cd explorer/frontend |
| 52 | + ``` |
| 53 | + |
| 54 | +4. Install Node.js dependencies: |
| 55 | + ```bash |
| 56 | + npm install |
| 57 | + ``` |
| 58 | + |
| 59 | +5. Setup environment variables (or create `.env` file in `frontend/` root directory). |
| 60 | + |
| 61 | +## Building the Project |
| 62 | + |
| 63 | +To build the project, run: |
| 64 | +```bash |
| 65 | +npm run build |
| 66 | +``` |
| 67 | + |
| 68 | +## Running the Project |
| 69 | + |
| 70 | +To run the built project, use: |
| 71 | +```bash |
| 72 | +npm run start |
| 73 | +``` |
| 74 | + |
| 75 | +## Development Server |
| 76 | + |
| 77 | +To run the development server, use: |
| 78 | +```bash |
| 79 | +npm run dev |
| 80 | +``` |
| 81 | + |
| 82 | +## Running Tests |
| 83 | + |
| 84 | +To run tests, use: |
| 85 | +```bash |
| 86 | +npm run test |
| 87 | +``` |
| 88 | + |
| 89 | +## Linting |
| 90 | + |
| 91 | +To run lint checks, use: |
| 92 | +```bash |
| 93 | +npm run lint |
| 94 | +``` |
| 95 | + |
| 96 | +To fix lint issues, use: |
| 97 | +```bash |
| 98 | +npm run lint:fix |
| 99 | +``` |
| 100 | + |
| 101 | +## Building the Docker Image |
| 102 | + |
| 103 | +1. Make sure you are in the explorer/frontend directory. |
| 104 | + |
| 105 | +2. Build the Docker image: |
| 106 | +```bash |
| 107 | +docker build -t symbolplatform/explorer-frontend . |
| 108 | +``` |
| 109 | + |
| 110 | +## Running the Docker Container |
| 111 | + |
| 112 | +Run the Docker container: |
| 113 | +```bash |
| 114 | +docker run -p 3000:3000 symbolplatform/explorer-frontend |
| 115 | +``` |
| 116 | + |
| 117 | +This command will start the container and expose the application on port 3000. |
0 commit comments