Files
2026-02-12 20:04:53 +07:00
..
2026-02-12 20:04:53 +07:00
2026-02-12 20:04:53 +07:00
2026-02-12 20:04:53 +07:00
2026-02-12 20:04:53 +07:00
2026-02-12 20:04:53 +07:00
2026-02-12 20:04:53 +07:00
2026-02-12 20:04:53 +07:00

Wedding RSVP Server

A Node.js/Express backend server for managing wedding RSVPs with individual guest authentication.

Features

  • Individual Guest Authentication: Each guest has a unique code for secure access
  • RSVP Management: Guests can confirm attendance and provide dietary restrictions
  • Admin Dashboard: Full admin interface for managing guests and groups
  • Email Notifications: Automated email confirmations and notifications
  • Google Sheets Integration: Export data to Google Sheets for easy tracking
  • Security: JWT authentication, rate limiting, and input validation
  • Database: SQLite with proper schema and relationships

API Endpoints

Public Endpoints

Authentication

  • POST /api/auth/login - Guest login with code and name
  • POST /api/auth/admin/login - Admin login with username and password

RSVP Management

  • POST /api/rsvp - Submit RSVP response (requires authentication)
  • GET /api/rsvp/guest/:code - Get guest details (requires authentication)
  • PUT /api/rsvp/guest/:code - Update guest information (requires authentication)

Admin Endpoints

Guest Management

  • GET /api/admin/guests - Get all guests
  • GET /api/admin/guests/:id - Get specific guest
  • PUT /api/admin/guests/:id - Update guest information
  • DELETE /api/admin/guests/:id - Delete guest

Group Management

  • GET /api/admin/groups - Get all groups
  • POST /api/admin/groups - Create new group
  • PUT /api/admin/groups/:id - Update group
  • DELETE /api/admin/groups/:id - Delete group

Data Export

  • GET /api/admin/export - Export all data to Google Sheets

Health Check

  • GET /api/health - Server health status

Environment Variables

Create a .env file based on .env.example:

# Server Configuration
PORT=3000
NODE_ENV=development

# JWT Configuration
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
JWT_EXPIRES_IN=7d

# Admin Configuration
ADMIN_USERNAME=admin
ADMIN_PASSWORD=hashed-password-here
ADMIN_EMAIL=admin@example.com

# Google Sheets Integration
GOOGLE_SHEETS_WEBHOOK_URL=https://script.google.com/macros/s/xxx/exec

# Email SMTP Configuration
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
NOTIFICATION_EMAIL=admin@example.com

# Frontend Configuration
VITE_API_URL=http://localhost:3000/api

# Database
DATABASE_PATH=./data/wedding.db

# Security
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100

Installation

  1. Install dependencies:
npm install
  1. Set up environment variables:
cp .env.example .env
# Edit .env with your configuration
  1. Start the server:
npm run dev

Database

The server uses SQLite with the following schema:

  • guests: Guest information with unique codes
  • groups: Guest groups with plus-one limits
  • plus_ones: Additional guests for plus-one arrangements
  • admin_users: Admin user accounts

Security Features

  • JWT-based authentication
  • Rate limiting (100 requests per 15 minutes)
  • Input validation with Joi
  • Helmet security headers
  • CORS configuration
  • SQL injection prevention

Email Service

The server can send automated emails for:

  • RSVP confirmations
  • Admin notifications
  • Guest welcome emails

Configure SMTP settings in the environment variables.

Google Sheets Integration

Export all guest and group data to Google Sheets using a webhook URL. Configure the webhook URL in the environment variables.

Testing

Run the test suite:

npm test

Development

  • Server runs on http://localhost:3000
  • API base URL: http://localhost:3000/api
  • Health check: GET /api/health

Production

For production deployment:

  1. Set NODE_ENV=production
  2. Use a strong JWT secret
  3. Configure proper SMTP settings
  4. Set up reverse proxy (e.g., Nginx)
  5. Use a process manager (e.g., PM2)

API Documentation

See the API Documentation for detailed endpoint specifications and examples.