Skip to content

Quick Setup Guide

Get the CyferWall Engage Backend running locally in just a few steps.

Prerequisites

Make sure you have the following installed:

  • Node.js 18+ or Bun (recommended)
  • PostgreSQL (local or remote)
  • Git
  • Python 3.8+ (for documentation)

๐Ÿƒโ€โ™‚๏ธ Quick Start

1. Clone and Setup

# Clone the repository
git clone <repository-url>
cd cws_engage/backend

# Install dependencies (using bun for speed)
bun install

# Or with npm
npm install

2. Environment Configuration

Create your .env file:

cp .env.example .env

Update the key variables:

# Database
DATABASE_URL="postgresql://user:password@localhost:5432/engage_db"

# Notification Services (optional for development)
NOVU_API_KEY="your_novu_key"
RESEND_API_KEY="your_resend_key"

# Authentication
JWT_SECRET="your_jwt_secret"

Database URL Quoting

Make sure to quote your DATABASE_URL if it contains special characters:

DATABASE_URL="postgresql://user:password@localhost:5432/engage_db"

3. Database Setup

# Generate Prisma client
bun run postinstall

# Run database migrations
npx prisma migrate dev

# (Optional) Seed with sample data
npx prisma db seed

4. Start Development Server

# Start with auto-reload
bun run dev

# Or with npm
npm run dev

The server will start on http://localhost:3000 ๐ŸŽ‰

๐Ÿงช Test the Notification System

Once running, test the notification system:

# Test template rendering
node src/util/notifications/test-comprehensive.js

# Test notification sending
node src/util/notifications/test-multiple-templates.js

๐Ÿ“– Documentation Setup

To run this documentation locally:

# Install Python dependencies
pip install -r docs/requirements.txt

# Serve documentation
mkdocs serve

# Open http://127.0.0.1:8000

๐Ÿ” Verify Setup

Health Check

curl http://localhost:3000/health

Expected response:

{
  "status": "healthy",
  "timestamp": "2025-01-27T...",
  "service": "engage-backend"
}

Notification Service Check

curl -X POST http://localhost:3000/api/support/case \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Test User",
    "email": "test@example.com",
    "customerType": "FREE",
    "issueType": "TECHNICAL",
    "urgency": "MEDIUM",
    "subject": "Test Case",
    "message": "This is a test case"
  }'

Check the logs for notification outputs.

๐Ÿš€ Next Steps

  1. Explore the Notification System - Learn how to send notifications
  2. Check Support APIs - Understand the customer and internal APIs
  3. Review Templates - See available notification templates
  4. Read Integration Guide - Integrate notifications in your code

๐Ÿ”ง Development Scripts

Command Description
bun run dev Start development server with auto-reload
bun run build Build for production
bun run test Run test suite
bun run test:watch Run tests in watch mode
npx prisma studio Open database admin UI
mkdocs serve Serve documentation locally

๐Ÿ› Common Issues

Database Connection Failed

# Check if PostgreSQL is running
brew services start postgresql

# Verify connection string
psql "postgresql://user:password@localhost:5432/engage_db"

Notification Templates Not Found

# Check template structure
node src/util/notifications/test-structure.js

# Verify paths
ls -la templates/notifications/

Build Errors

# Clear node_modules and reinstall
rm -rf node_modules bun.lockb
bun install

# Regenerate Prisma client
bun run postinstall

๐Ÿ“ž Getting Help

  • Check the logs: Most issues show clear error messages
  • Test templates: Use the built-in testing scripts
  • Review configuration: Double-check your .env file
  • Ask for help: Reach out on Slack #engage-backend-support

Next: Development Environment Setup โ†’