This project displays real-time and historical statistics for the CKPool Bitcoin mining pool using data from their API.
- Real-time pool statistics
- Historical data chart
- Responsive design with themed display
- User and worker information
- Next.js
- Tailwind CSS
- daisyUI
- Recharts
- TypeORM
- Clone the repository (git clone https://github.com/mrv777/ckstats.git)
- Install pnpm:
curl -fsSL https://get.pnpm.io/install.sh | bash
- Install packages if needed:
sudo apt install postgresql postgresql-contrib nodejs nginx
- Go to the directory:
cd ckstats
- Set up the environment variables in
.env
- Example:
API_URL="https://solo.ckpool.org"
DB_HOST="server"
DB_PORT="port"
DB_USER="username"
DB_PASSWORD="password"
DB_NAME="database"
Replace username
, password
, server
, port
, database
with your actual PostgreSQL credentials, server details, and database names.
You can also set the DB_SSL to true if you want to use SSL and set the DB_SSL_REJECT_UNAUTHORIZED to true if you want to reject untrusted SSL certificates (like self-signed certificates).
- Install dependencies:
pnpm install
- Run database migrations:
pnpm migration:run
- Seed the database and test the connection:
pnpm seed
- Build the application:
pnpm build
- Start the production server:
pnpm start
- Set up cronjobs for regular updates:
- Open the crontab editor:
crontab -e
- Add lines to run the scripts. Example:
*/1 * * * * cd /path/to/your/project && /usr/local/bin/pnpm seed */1 * * * * cd /path/to/your/project && /usr/local/bin/pnpm update-users 5 */2 * * * cd /path/to/your/project && /usr/local/bin/pnpm cleanup
- Save and exit the editor
These cronjobs will run the seed
and update-users
scripts every 1 minute to populate the database and clean up old statistics every 2 hours.
pnpm dev
: Start the development serverpnpm build
: Build the production applicationpnpm start
: Start the production serverpnpm lint
: Run ESLintpnpm lint:fix
: Run ESLint and fix issuespnpm seed
: Save/Update pool stats to databasepnpm update-stats
: Update pool statistics #Currently not usedpnpm update-users
: Update user and worker informationpnpm cleanup
: Clean up old statisticspnpm test
: Run testspnpm test:watch
: Run tests in watch modepnpm migration:run
: Run TypeORM database migrationspnpm migration:run:skip
: Run TypeORM database migrations skipping the initial migration
GPL-3.0 license