Installation

Set up PsicoStacks locally for development or self-hosting.

System Requirements

  • Node.js 18+ and npm 9+
  • Supabase account (for database)
  • Mistral AI API key
  • Stacks wallet for testing

Frontend Setup

1. Clone the repository

git clone https://github.com/jazminewrooman/psicostacks.git
cd psicostacks

2. Install dependencies

npm install

3. Configure environment variables

# Copy the example file
cp .env.example .env.local

# Edit .env.local with your values:
NEXT_PUBLIC_API_URL=http://localhost:3001
NEXT_PUBLIC_CONTRACT_ADDRESS=ST2QS1D1ZFCGX436QPHACJNC0R2A6HNB7BNM95J9X
NEXT_PUBLIC_CONTRACT_NAME=psicostacks-sbt
NEXT_PUBLIC_NETWORK=testnet

4. Start development server

npm run dev

Frontend will run on http://localhost:3000

Backend Setup

1. Clone the backend repository

git clone https://github.com/jazminewrooman/psicostacks-backend.git
cd psicostacks-backend

2. Install dependencies

npm install

3. Set up Supabase

  1. Create a new project at supabase.com
  2. Go to SQL Editor and run the schema from DATABASE_SCHEMA.md
  3. Get your project URL and service role key from Settings

4. Configure environment variables

# Copy the example file
cp .env.example .env

# Generate encryption key
openssl rand -base64 32

# Edit .env with your values:
PORT=3001
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
MISTRAL_API_KEY=your-mistral-api-key
CREDENTIALS_ENC_KEY=<generated-key>
FRONTEND_URL=http://localhost:3000

5. Start backend server

npm run dev

Backend will run on http://localhost:3001

Smart Contracts Setup

1. Install Clarinet

# macOS
brew install clarinet

# Other platforms
# Visit: https://github.com/hirosystems/clarinet

2. Clone the contracts repository

git clone https://github.com/jazminewrooman/psicostacks-smarts.git
cd psicostacks-smarts

3. Test the contracts

# Check syntax
clarinet check

# Run tests
clarinet test

4. Deploy to testnet

# Generate deployment plan
clarinet deployments generate --manifest deployments/default.testnet-plan.yaml

# Deploy
clarinet deployments apply -p deployments/default.testnet-plan.yaml

⚠️ Important Notes

  • Never commit .env or .env.local files
  • Use testnet for development and testing
  • Keep your encryption keys and service role keys secure
  • Rotate API keys regularly in production

Next Steps