Database for Stones Project
Go to file
boilerrat b8be2cd4b2 Update deployment files for contacts.boilerhaus.org 2025-03-18 22:32:52 -04:00
.cursor/rules Initial commit of Stones project with Raid Guild DAO members and ENS resolution 2025-03-16 18:54:35 -04:00
prisma Add authentication, dashboard, contacts page, and contact details functionality 2025-03-18 21:58:47 -04:00
scripts Add authentication, dashboard, contacts page, and contact details functionality 2025-03-18 21:58:47 -04:00
src Moved authentication credentials to environment variables and added settings page for password management 2025-03-18 22:27:59 -04:00
.env.example Moved authentication credentials to environment variables and added settings page for password management 2025-03-18 22:27:59 -04:00
.env.production.template Add authentication, dashboard, contacts page, and contact details functionality 2025-03-18 21:58:47 -04:00
.gitignore Initial commit of Stones project with Raid Guild DAO members and ENS resolution 2025-03-16 18:54:35 -04:00
DEPLOYMENT.md Update deployment files for contacts.boilerhaus.org 2025-03-18 22:32:52 -04:00
README.md Add authentication, dashboard, contacts page, and contact details functionality 2025-03-18 21:58:47 -04:00
RULES.md Initial commit of Stones project with Raid Guild DAO members and ENS resolution 2025-03-16 18:54:35 -04:00
backup-db.sh Add authentication, dashboard, contacts page, and contact details functionality 2025-03-18 21:58:47 -04:00
check-db.sh Add authentication, dashboard, contacts page, and contact details functionality 2025-03-18 21:58:47 -04:00
contact-boilerhaus-org.conf Add authentication, dashboard, contacts page, and contact details functionality 2025-03-18 21:58:47 -04:00
contacts-boilerhaus-org.conf Update deployment files for contacts.boilerhaus.org 2025-03-18 22:32:52 -04:00
deploy.sh Update deployment files for contacts.boilerhaus.org 2025-03-18 22:32:52 -04:00
import-data.js Add authentication, dashboard, contacts page, and contact details functionality 2025-03-18 21:58:47 -04:00
next.config.js Add authentication, dashboard, contacts page, and contact details functionality 2025-03-18 21:58:47 -04:00
package-lock.json Add contact creation and import features 2025-03-18 22:10:08 -04:00
package.json Add contact creation and import features 2025-03-18 22:10:08 -04:00
postcss.config.js Initial commit of Stones project with Raid Guild DAO members and ENS resolution 2025-03-16 18:54:35 -04:00
push-to-gitea.sh Add authentication, dashboard, contacts page, and contact details functionality 2025-03-18 21:58:47 -04:00
requirements.txt Initial commit of Stones project with Raid Guild DAO members and ENS resolution 2025-03-16 18:54:35 -04:00
run-dev.sh Add authentication, dashboard, contacts page, and contact details functionality 2025-03-18 21:58:47 -04:00
stones_data.sql Add authentication, dashboard, contacts page, and contact details functionality 2025-03-18 21:58:47 -04:00
stones_data_only.sql Add authentication, dashboard, contacts page, and contact details functionality 2025-03-18 21:58:47 -04:00
tailwind.config.js Add authentication, dashboard, contacts page, and contact details functionality 2025-03-18 21:58:47 -04:00
tsconfig.json Add authentication, dashboard, contacts page, and contact details functionality 2025-03-18 21:58:47 -04:00

README.md

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