Local Development Setup

Get Pushy up and running locally for development.

Prerequisites

Before installing Pushy, ensure you have the following software installed:

Rust - Latest stable version (1.88.0+)
Docker & Docker Compose - For running services
Node.js - For Contentful CLI (20.12.1+)
PostgreSQL client - psql command-line tool
Check Prerequisites
# Check Rust version
$ rustc --version
rustc 1.88.0 (6b00bc388 2025-06-23)
# Check Docker
$ docker --version
Docker version 23.0.0, build e92dd87c32
# Check Node.js
$ node --version
v20.12.1
# Check PostgreSQL client
$ psql --version
psql (PostgreSQL) 14.18 (Homebrew)

Installation

1

Clone the Repository

bash
# Clone the Pushy repository
git clone https://github.com/julina-imho/pushy.git
cd pushy
2

Start Docker Services

Start all required services using Docker Compose:

bash
# Start all services
docker-compose up -d
# Wait for services to be ready
# Verify services are running
docker-compose ps

Services Started:

  • • PostgreSQL (port 5432)
  • • Redis (port 6379)
  • • LocalStack SQS (port 4566)
  • • MailHog (ports 1025, 8025)
3

Setup Database

bash
# Create database
sqlx database create
# Run migrations
sqlx migrate run
# Verify tables were created
psql postgresql://pushy:pushy@localhost:5432/pushy -c "\dt"
4

Generate VAPID Keys

Generate keys for web push notifications:

bash
# Run setup utility
cargo run --bin setup
# This will output:
# VAPID_PUBLIC_KEY=BNcRdreALRFXTkOOUHK1EtK2wtaz5Ry4YfYCA_0QTpQtUbVlUls0VJXg7A8u-Ts1XbjhazAkj7I99e8QcYP7DkM
# VAPID_PRIVATE_KEY=s3VJd6nSsU9JlGgRZ5vJQGXWz9dR8vQyQzQc8-HVHcI
# VAPID_SUBJECT=mailto:admin@pushy.local

Configuration

Environment Variables

Create a .env file in the project root:

.env
# Database
DATABASE_URL=postgresql://pushy:pushy@localhost:5432/pushy
# AWS Configuration (LocalStack for development)
AWS_ENDPOINT_URL=http://localhost:4566
AWS_ACCESS_KEY_ID=test
AWS_SECRET_ACCESS_KEY=test
AWS_REGION=us-east-1
SQS_QUEUE_URL=http://localhost:4566/000000000000/pushy-notifications.fifo
# Email Configuration
SMTP_HOST=localhost
SMTP_PORT=1025
FROM_EMAIL=noreply@pushy.local
# Web Push Configuration
VAPID_PUBLIC_KEY=YOUR_PUBLIC_KEY_HERE
VAPID_PRIVATE_KEY=YOUR_PRIVATE_KEY_HERE
VAPID_SUBJECT=mailto:admin@pushy.local
# Contentful Configuration
CONTENTFUL_SPACE_ID=your_space_id
CONTENTFUL_ACCESS_TOKEN=your_access_token
# Logging
RUST_LOG=pushy=debug,tower_http=debug

Contentful Setup

Import notification templates to Contentful:

bash
# Install Contentful CLI
npm install -g contentful-cli
# Login to Contentful
contentful login
# Import content model
contentful space import --content-file contentful/content-type-only.json --space-id YOUR_SPACE_ID
# Import templates
contentful space import --content-file contentful/crypto-templates.json --space-id YOUR_SPACE_ID

Send Your First Notification

Start the Services

bash
# Terminal 1: Start API server
cargo run
# Terminal 2: Start background worker
cargo run --bin worker
# Terminal 3: Test health endpoint
curl http://localhost:3000/health

1. Create a User

bash
curl -X POST http://localhost:3000/users \
-H "Content-Type: application/json" \
-d '{
"email": "trader@crypto.com",
"name": "Crypto Trader"
}'
# Response:
# {
# "id": "550e8400-e29b-41d4-a716-446655440000",
# "email": "trader@crypto.com",
# "name": "Crypto Trader",
# "created_at": "2024-01-15T10:00:00Z"
# }

2. Send a Notification

bash
curl -X POST http://localhost:3000/notifications \
-H "Content-Type: application/json" \
-d '{
"user_id": "550e8400-e29b-41d4-a716-446655440000",
"template_id": "purchase_confirmed",
"language": "en",
"template_variables": {
"userName": "Crypto Trader",
"amount": "0.5",
"currency": "BTC",
"txHash": "0xabc123def456",
"exchangeName": "Crypto Exchange"
},
"notification_type": "purchase",
"channel": "email"
}'

3. Check the Results

View the sent email in MailHog:

MailHogEmail inbox at localhost:8025

Congratulations! 🎉

You've successfully set up Pushy and sent your first notification. Ready to explore more features?

Having issues? Check out our troubleshooting guide or contact support.