This repository contains a React application that displays blockchain node statistics from Chainstack. When working on the project interactively with an agent (e.g. the Codex CLI) please follow the guidelines below for efficient development and deployment.
- Always use
npm startfor local development. - Test UI changes in browser at http://localhost:5173.
- Do not deploy to production during agent development sessions.
- Check console for any React warnings or errors.
If you update dependencies:
- Install packages with
npm install. - Update specific packages with
npm update <package>. - Run
npm audit fixto resolve vulnerabilities. - Verify compatibility with current React and Ant Design versions in
package.json.
Follow the standard React development flow:
-
Start dev server: Run application locally
npm start
-
Build for production: Create optimized build
npm run build
-
Deploy to GitHub Pages: Publish to chainstats.org
npm run deploy
Before completing any task:
| Command | Purpose |
|---|---|
npm run build |
Verify build succeeds |
| Browser DevTools | Check for console errors |
| React DevTools | Inspect component tree |
| Network tab | Monitor API calls |
When modifying components:
- Follow existing component structure in
src/components/. - Keep styles in corresponding
.scssfiles. - Maintain icon assets in appropriate directories.
- Use Ant Design components consistently.
- Preserve responsive design patterns.
The app fetches data from Chainstack API:
- API endpoint:
https://console.chainstack.com/api/core/v1/calc/ - Data processing:
src/helpers/getData.js - Caching: Consider localStorage for performance
- Error handling: Display user-friendly messages
- Use SCSS for styling (
.scssfiles). - Follow BEM naming convention where applicable.
- Maintain dark/light theme support.
- Keep responsive breakpoints consistent.
- Use CSS variables for theme colors.
Maintain the existing structure:
src/
├── components/ # React components
│ ├── Header/ # App header
│ ├── Icons/ # SVG icons
│ ├── ProtocolCards/ # Protocol display cards
│ └── TableWrapper/ # Data table
├── helpers/ # Utility functions
└── index.js # App entry point
When adding new protocols:
- Add SVG icon to
src/components/ProtocolIcon/ - Import in
ProtocolIcon.jsx - Add mapping in
iconTypes - Test icon rendering
The search feature:
- Filters protocols by name
- Updates results in real-time
- Case-insensitive matching
- Shows "No results" message when empty
- Minimize API calls (data fetched once on load).
- Use React.memo for expensive components.
- Lazy load images where appropriate.
- Optimize bundle size with code splitting.
- Monitor performance with React DevTools Profiler.
For GitHub Pages deployment:
- Ensure
homepagein package.json is correct - Build the production bundle
- Deploy with
npm run deploy - Verify at https://chainstats.org
- Check CNAME file in public/ for custom domain
- Add icon to ProtocolIcon directory
- Update
iconTypesinProtocolIcon.jsx - Test data display in table/cards
- Modify relevant .scss file
- Check both light and dark themes
- Test responsive breakpoints
- Check network tab for API response
- Console.log in getData.js
- Verify data parsing logic
Before deployment:
- Search functionality works
- All protocol icons display
- Table sorts correctly
- Responsive design intact
- No console errors
- Build completes successfully
- Deployment preview looks correct
| Command | Purpose |
|---|---|
npm install |
Install dependencies |
npm start |
Start development server |
npm run build |
Create production build |
npm run deploy |
Deploy to GitHub Pages |
npm test |
Run test suite |
"Module not found"
- Run
npm install - Clear node_modules and reinstall
"Build failed"
- Check for TypeScript/JSX errors
- Verify all imports are correct
- Check environment variables
"Deploy failed"
- Ensure gh-pages branch exists
- Check GitHub repository settings
- Verify build completes first
Following these practices ensures smooth React development, maintains code quality, and enables reliable deployment to production. Always test thoroughly in development before deploying to chainstats.org.