stones/README.md

3.1 KiB

Stones Database

A web application for managing contacts and their blockchain-related information, including NFT holdings, DAO memberships, and token holdings.

Development Setup

Prerequisites

  • Node.js (v16 or higher)
  • PostgreSQL database
  • Git

Setup Instructions

  1. Clone the repository
git clone git@git.boilerhaus.org:boiler/stones.git
cd stones
  1. Install dependencies
npm install
  1. Set up the database
  • Create a PostgreSQL database named stones
  • Update the .env.local file with your database connection string:
DATABASE_URL="postgresql://username:password@localhost:5432/stones"
  1. Run database migrations
npx prisma migrate dev
npx prisma generate
  1. Start the development server
npm run dev
# or
./run-dev.sh

This will start the application at http://localhost:3000.

Utility Scripts

This project includes several utility scripts to streamline the development and deployment process:

  • run-dev.sh: Starts the development server with all necessary checks
  • check-db.sh: Tests database connectivity and displays database statistics
  • push-to-gitea.sh: Pushes changes to the Gitea repository
  • deploy.sh: Deploys the application to a production server
  • backup-db.sh: Creates a backup of the PostgreSQL database

Using the Development Server

To run the development server with automatic checks for dependencies and database setup:

./run-dev.sh

This script will:

  • Check for Node.js and npm
  • Create a .env.local file if it doesn't exist
  • Install dependencies if needed
  • Run database migrations
  • Start the development server

Checking Database Connectivity

To test your database connection and view statistics:

./check-db.sh

This script will connect to your database and display the number of contacts, NFT holdings, DAO memberships, and token holdings.

Authentication

The application uses a simple authentication system with a hardcoded admin user:

  • Username: admin
  • Password: stones1234

For security in production, this should be replaced with a proper authentication system.

Deployment

For detailed deployment instructions, see DEPLOYMENT.md.

To deploy to a server:

  1. Push changes to Gitea:
./push-to-gitea.sh
  1. Connect to your server and clone the repository:
ssh your-server-user@your-server-ip
git clone git@git.boilerhaus.org:boiler/stones.git
cd stones
  1. Run the deployment script:
./deploy.sh
  1. Update the .env.production file with your production settings:
nano .env.production
  1. Access your application at https://contact.boilerhaus.org (or your configured domain).

Database Backups

To back up your database:

./backup-db.sh

This creates a compressed SQL backup in /var/backups/stones-database/ with a timestamp.

Project Structure

  • src/app: Next.js App Router pages and API routes
  • src/components: React components
  • src/lib: Utility functions and libraries
  • prisma: Database schema and migrations
  • scripts: Data collection and processing scripts