On this page

Quick Reference

Default Port

5010

Max File Size

2 GB

File Retention

7 days

Cleanup Interval

6 hours

Environment Variables

Configure the application using environment variables. Create a .env file in the project root or set them in your deployment environment.

Variable Description Default Required
DATABASE_URL PostgreSQL connection string - Required
PORT Server port number 5010 Optional
NODE_ENV Environment mode development Optional
JWT_SECRET Secret key for JWT tokens - Required
RESEND_API_KEY API key for Resend email service - Required
SMTP_FROM Sender email address - Required
FRONTEND_URL URL of the frontend application http://localhost:5173 Optional
MAX_FILE_SIZE Maximum upload size in bytes 2147483648 (2GB) Optional
UPLOAD_DIR Directory for file uploads ./uploads Optional
CLEANUP_INTERVAL_HOURS Hours between cleanup runs 6 Optional
FILE_RETENTION_DAYS Days before files expire 7 Optional
.env.example
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/transferfiles"

# Server
PORT=5010
NODE_ENV=production
JWT_SECRET="your-secure-secret-key-here"

# File Storage
MAX_FILE_SIZE=2147483648
UPLOAD_DIR="./uploads"

# Email (Resend)
RESEND_API_KEY="re_xxxxxxxxxxxxx"
SMTP_FROM="PM7 TransferFiles <noreply@pm7.email>"

# Frontend
FRONTEND_URL="https://transfer.pm7.dev"

# Cleanup
CLEANUP_INTERVAL_HOURS=6
FILE_RETENTION_DAYS=7

Database Setup

PM7 TransferFiles uses PostgreSQL with Drizzle ORM for type-safe database operations.

PostgreSQL Required

Ensure PostgreSQL 14+ is installed and running before proceeding.

Database Tables

Table Purpose
users User accounts with email and last login timestamp
verificationCodes Email verification codes (5-digit, 15-min expiry)
transfers File transfers with metadata, recipients, and expiry
downloads Download tracking with status, bytes, and timestamps
uploads Upload progress tracking with status and bytes

Running Migrations

# Generate migrations from schema changes
bun run db:generate

# Apply migrations to database
bun run db:migrate

# Open Drizzle Studio (visual database browser)
bun run db:studio

Email Configuration

Email notifications are powered by Resend for reliable delivery.

Free Tier Available

Resend offers 100 emails per day for free - perfect for small teams.

Setup Steps

  1. Sign up at resend.com
  2. Create an API key in the dashboard
  3. Verify your sending domain (or use Resend's test domain)
  4. Add RESEND_API_KEY to your environment
  5. Configure SMTP_FROM with your verified domain
Example sender formats
# With display name (recommended)
SMTP_FROM="PM7 TransferFiles <noreply@yourdomain.com>"

# Simple email only
SMTP_FROM="noreply@yourdomain.com"

File Storage

Configure where uploaded files are stored and size limits.

Setting Description Default
UPLOAD_DIR Directory path for storing uploaded files ./uploads
MAX_FILE_SIZE Maximum file size in bytes 2147483648 (2GB)

Disk Space

Ensure adequate disk space for uploads. Monitor usage regularly, especially with large file limits.

Common Size Values

# 100 MB
MAX_FILE_SIZE=104857600

# 500 MB
MAX_FILE_SIZE=524288000

# 1 GB
MAX_FILE_SIZE=1073741824

# 2 GB (default)
MAX_FILE_SIZE=2147483648

Auto-Cleanup

The cleanup service automatically removes expired files and database records.

Setting Description Default
CLEANUP_INTERVAL_HOURS Hours between cleanup runs 6
FILE_RETENTION_DAYS Days before transfers expire 7

What Gets Cleaned

Deployment

PM7 TransferFiles is designed to run in Docker for easy deployment.

Docker Required

Production deployment uses Docker and docker-compose for containerization.

Quick Deploy

# Deploy to production
./deploy.sh

# Or manually
docker-compose -f docker-compose.production.yml up -d

Container Configuration

Setting Value
Container Port 5176
Restart Policy unless-stopped
Health Check /api/health every 30s
Memory Limit 1GB
CPU Limit 1.0 core

Volumes

# Persistent storage for uploads
./uploads:/app/uploads

# Environment configuration (read-only)
./.env:/app/.env:ro