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 --versionrustc 1.88.0 (6b00bc388 2025-06-23)# Check Docker$ docker --versionDocker version 23.0.0, build e92dd87c32# Check Node.js$ node --versionv20.12.1# Check PostgreSQL client$ psql --versionpsql (PostgreSQL) 14.18 (Homebrew)Installation
1
Clone the Repository
bash
# Clone the Pushy repositorygit clone https://github.com/julina-imho/pushy.gitcd pushy2
Start Docker Services
Start all required services using Docker Compose:
bash
# Start all servicesdocker-compose up -d# Wait for services to be ready# Verify services are runningdocker-compose psServices Started:
- • PostgreSQL (port 5432)
- • Redis (port 6379)
- • LocalStack SQS (port 4566)
- • MailHog (ports 1025, 8025)
3
Setup Database
bash
# Create databasesqlx database create# Run migrationssqlx migrate run# Verify tables were createdpsql postgresql://pushy:pushy@localhost:5432/pushy -c "\dt"4
Generate VAPID Keys
Generate keys for web push notifications:
bash
# Run setup utilitycargo run --bin setup# This will output:# VAPID_PUBLIC_KEY=BNcRdreALRFXTkOOUHK1EtK2wtaz5Ry4YfYCA_0QTpQtUbVlUls0VJXg7A8u-Ts1XbjhazAkj7I99e8QcYP7DkM# VAPID_PRIVATE_KEY=s3VJd6nSsU9JlGgRZ5vJQGXWz9dR8vQyQzQc8-HVHcI# VAPID_SUBJECT=mailto:admin@pushy.localConfiguration
Environment Variables
Create a .env file in the project root:
.env
# DatabaseDATABASE_URL=postgresql://pushy:pushy@localhost:5432/pushy# AWS Configuration (LocalStack for development)AWS_ENDPOINT_URL=http://localhost:4566AWS_ACCESS_KEY_ID=testAWS_SECRET_ACCESS_KEY=testAWS_REGION=us-east-1SQS_QUEUE_URL=http://localhost:4566/000000000000/pushy-notifications.fifo# Email ConfigurationSMTP_HOST=localhostSMTP_PORT=1025FROM_EMAIL=noreply@pushy.local# Web Push ConfigurationVAPID_PUBLIC_KEY=YOUR_PUBLIC_KEY_HEREVAPID_PRIVATE_KEY=YOUR_PRIVATE_KEY_HEREVAPID_SUBJECT=mailto:admin@pushy.local# Contentful ConfigurationCONTENTFUL_SPACE_ID=your_space_idCONTENTFUL_ACCESS_TOKEN=your_access_token# LoggingRUST_LOG=pushy=debug,tower_http=debugContentful Setup
Import notification templates to Contentful:
bash
# Install Contentful CLInpm install -g contentful-cli# Login to Contentfulcontentful login# Import content modelcontentful space import --content-file contentful/content-type-only.json --space-id YOUR_SPACE_ID# Import templatescontentful space import --content-file contentful/crypto-templates.json --space-id YOUR_SPACE_IDSend Your First Notification
Start the Services
bash
# Terminal 1: Start API servercargo run# Terminal 2: Start background workercargo run --bin worker# Terminal 3: Test health endpointcurl http://localhost:3000/health1. 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" }'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.