Leadership-Legacy-Startup-Agency-Website

Leadership Suite

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.

🌟 Features

Core Applications

Platform Features

πŸš€ Quick Start

5-Minute Setup

# 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! πŸŽ‰

πŸ“š Documentation

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Next.js (Pages)β”‚  ← Static frontend on Cloudflare Pages
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚ /api/*
         ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Cloudflare Workerβ”‚  ← API backend with business logic
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
    β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    ↓         ↓          ↓          ↓
β”Œβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”
β”‚  D1  β”‚ β”‚  R2  β”‚  β”‚  KV  β”‚  β”‚  AI  β”‚
β”‚  DB  β”‚ β”‚ Filesβ”‚  β”‚Configβ”‚  β”‚ Chat β”‚
β””β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”˜

Tech Stack

πŸ› οΈ Local Development

Start Development Servers

# 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:

Development Tools

# 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

πŸ“¦ Project Structure

.
β”œβ”€β”€ 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

πŸ”§ Configuration

Environment Variables

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/

Secrets (Optional)

# Anthropic AI (optional, uses Cloudflare AI by default)
wrangler secret put ANTHROPIC_API_KEY

# Resend email (optional)
wrangler secret put RESEND_API_KEY

πŸ§ͺ Testing

Test Suite Functionality

Visit each app and test:

  1. Create new items (documents, tasks, events, etc.)
  2. Edit and update items
  3. Delete items
  4. File upload (Drive, Photos)
  5. Drag & drop (Tasks board)
  6. Search and filter
  7. Sort options
  8. View toggles (grid/list)

All features should work with the demo user (demo-user).

πŸš€ Deployment

Automated Deployment

./deploy-suite.sh [project-name]

Manual Deployment

# 1. Deploy Worker
wrangler deploy

# 2. Build Next.js
npm run build

# 3. Deploy Pages
npx wrangler pages deploy out --project-name=leadership-legacy

Custom Domain

  1. Go to Cloudflare Pages dashboard
  2. Select your project
  3. Go to Custom domains
  4. Add your domain
  5. Cloudflare will automatically configure DNS

πŸ” Security

Add authentication using:

See SUITE_DEPLOYMENT_GUIDE.md for integration guides.

Rate Limiting

Enable rate limiting in the Worker:

// Add to workers/api/index.ts
const RATE_LIMIT = 100; // requests per minute
// Implement using Cloudflare Workers KV

πŸ“Š Monitoring

Analytics

Logging

# Real-time logs
wrangler tail

# Worker metrics
wrangler metrics

πŸ†˜ Troubleshooting

Common Issues

API calls fail

Database errors

File uploads fail

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

πŸ“ License

MIT License - See LICENSE file for details

πŸ’‘ Features Roadmap

πŸŽ‰ Acknowledgments

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