A complete productivity suite built with Next.js and Cloudflare, featuring documents, spreadsheets, presentations, file storage, photo management, calendar, email, video meetings, and task management.
# 1. Clone and install
git clone <your-repo-url>
cd leadership-legacy
npm install
# 2. Install and login to Wrangler
npm install -g wrangler
wrangler login
# 3. Create database
wrangler d1 create leadership-legacy-db
# Update wrangler.toml with database ID
# 4. Run migrations
wrangler d1 execute leadership-legacy-db --file=./schema/schema.sql
wrangler d1 execute leadership-legacy-db --file=./migrations/0002_create_suite_schema.sql
wrangler d1 execute leadership-legacy-db --file=./migrations/0003_insert_demo_user.sql
# 5. Create R2 bucket
wrangler r2 bucket create leadership-legacy-assets
# 6. Deploy
./deploy-suite.sh
Your suite is now live! π
βββββββββββββββββββ
β Next.js (Pages)β β Static frontend on Cloudflare Pages
ββββββββββ¬βββββββββ
β /api/*
β
βββββββββββββββββββ
β Cloudflare Workerβ β API backend with business logic
ββββββββββ¬βββββββββ
β
ββββββ΄βββββ¬βββββββββββ¬βββββββββββ
β β β β
ββββββββ ββββββββ ββββββββ ββββββββ
β D1 β β R2 β β KV β β AI β
β DB β β Filesβ βConfigβ β Chat β
ββββββββ ββββββββ ββββββββ ββββββββ
# Option 1: Use the helper script
./scripts/dev-local.sh
# Option 2: Manual start (2 terminals)
Terminal 1: wrangler dev --port 8787
Terminal 2: npm run dev
Visit:
# View Worker logs
wrangler tail
# Query D1 database
wrangler d1 execute leadership-legacy-db --command="SELECT * FROM users"
# List R2 files
wrangler r2 object list leadership-legacy-assets
# Check deployments
wrangler deployments list
.
βββ src/
β βββ app/ # Next.js pages
β β βββ suite/ # Suite applications
β β β βββ documents/
β β β βββ sheets/
β β β βββ slides/
β β β βββ drive/
β β β βββ photos/
β β β βββ gallery/
β β β βββ calendar/
β β β βββ mail/
β β β βββ meet/
β β β βββ tasks/
β β βββ page.tsx # Landing page
β βββ components/ # React components
β β βββ suite/ # Suite-specific components
β β βββ shared/ # Shared components
β βββ lib/ # Utilities and API client
βββ workers/
β βββ api/ # Cloudflare Worker
β βββ index.ts # API routes
βββ functions/ # Cloudflare Pages Functions
β βββ api/ # API proxy
βββ migrations/ # Database migrations
βββ public/ # Static assets
β βββ _routes.json # Pages routing config
βββ schema/ # Database schemas
Local Development (.env.local):
NEXT_PUBLIC_API_URL=http://localhost:8787
NEXT_PUBLIC_R2_PUBLIC_BASE=https://pub-YOUR_ID.r2.dev/
Production (Cloudflare dashboard):
NEXT_PUBLIC_API_URL=https://your-worker.workers.dev
NEXT_PUBLIC_R2_PUBLIC_BASE=https://your-domain.com/r2/
# Anthropic AI (optional, uses Cloudflare AI by default)
wrangler secret put ANTHROPIC_API_KEY
# Resend email (optional)
wrangler secret put RESEND_API_KEY
Visit each app and test:
All features should work with the demo user (demo-user).
./deploy-suite.sh [project-name]
# 1. Deploy Worker
wrangler deploy
# 2. Build Next.js
npm run build
# 3. Deploy Pages
npx wrangler pages deploy out --project-name=leadership-legacy
Add authentication using:
See SUITE_DEPLOYMENT_GUIDE.md for integration guides.
Enable rate limiting in the Worker:
// Add to workers/api/index.ts
const RATE_LIMIT = 100; // requests per minute
// Implement using Cloudflare Workers KV
# Real-time logs
wrangler tail
# Worker metrics
wrangler metrics
API calls fail
_routes.json exists in public/wrangler deployments listDatabase errors
wrangler.tomlwrangler d1 execute leadership-legacy-db --command="SELECT 1"File uploads fail
wrangler r2 bucket listwrangler.tomlMIT License - See LICENSE file for details
Built with amazing open-source tools:
Made with β€οΈ by Leadership Legacy
Deploy globally in minutes. Scale infinitely. Pay only for what you use.
| π Get Started Now | π Full Docs | π Report Issues |