A comprehensive CrossFit gym management platform built with Next.js, Cloudflare Workers, and modern web technologies. WODsmith enables gyms to manage workouts, programming tracks, athlete performance tracking, and team collaboration.
- Features
- Tech Stack
- Getting Started
- Development
- Project Structure
- Database Schema
- Deployment
- Testing
- Contributing
- License
- Create, edit, and organize workouts with detailed components
- Support for various workout schemes (AMRAP, For Time, EMOM, etc.)
- Movement tracking with weightlifting, gymnastic, and monostructural categories
- Tag system for workout categorization
- Workout templates and cloning functionality
- Rich text descriptions with formatting support
- Multiple programming tracks for different athlete levels
- Drag-and-drop workout scheduling interface
- Weekly and monthly programming views
- Schedule templates for recurring programming patterns
- Auto-generation of training schedules
- Track subscriptions for athletes
- Athlete workout result logging
- Performance analytics and progress tracking
- Personal records (PR) tracking
- Benchmark workout comparisons
- Historical data visualization
- Export capabilities for athlete data
- Multi-tenant architecture with team isolation
- Role-based access control (Owner, Admin, Member, Guest)
- Custom role creation with granular permissions
- Team invitations and member management
- Personal teams for individual athletes
- Team switching and collaboration features
- Class scheduling and management
- Coach assignments and scheduling
- Equipment tracking and management
- Gym setup and configuration
- Member check-ins and attendance
- Barbell calculator for weight loading
- Percentage-based workout calculators
- Spreadsheet-style workout planning
- Movement substitution suggestions
- Workout scaling options
- Email/Password authentication
- Google OAuth integration
- WebAuthn/Passkey support
- Two-factor authentication
- Session management with Cloudflare KV
- Rate limiting and CAPTCHA protection
- Secure password reset flow
- Email verification
- Credit-based billing system
- Stripe payment integration
- Monthly credit refresh
- Usage tracking and analytics
- Transaction history
- Multiple pricing tiers
- Modern, responsive design with Tailwind CSS
- Dark/Light mode support
- Mobile-first approach
- Real-time updates and notifications
- Drag-and-drop interfaces
- Loading states and animations
- Toast notifications
- Transactional email system
- Beautiful email templates with React Email
- Team invitations
- Workout notifications
- Performance summaries
- Framework: Next.js 15.3.2 with App Router
- UI Library: React 19
- Styling: Tailwind CSS, Shadcn UI
- State Management: Zustand, NUQS (URL state)
- Forms: React Hook Form + Zod validation
- Calendar: FullCalendar
- Drag & Drop: Atlaskit Pragmatic Drag and Drop
- Runtime: Cloudflare Workers (Edge Computing)
- Database: Cloudflare D1 (SQLite)
- ORM: Drizzle ORM
- Session Store: Cloudflare KV
- Authentication: Lucia Auth
- API: Server Actions with ZSA
- Deployment: OpenNext for Cloudflare
- CI/CD: GitHub Actions
- Type Safety: TypeScript
- Code Quality: Biome (linting & formatting)
- Testing: Vitest + Testing Library
- Email Development: React Email
- Node.js 22+ and pnpm
- Cloudflare account (for production deployment)
- Stripe account (for billing features)
- Email service account (Resend or Brevo)
-
Clone the repository
git clone https://github.com/your-username/wodsmith.git cd wodsmith -
Install dependencies
pnpm install
-
Set up environment variables
cp .dev.vars.example .dev.vars cp .env.example .env
Fill in the required values in both files.
-
Initialize the database
pnpm db:migrate:dev pnpm db:seed # Optional: seed with sample data -
Start the development server
pnpm dev
pnpm dev- Start development serverpnpm build- Build for productionpnpm preview- Preview production build locally
pnpm db:generate [name]- Generate new migrationpnpm db:migrate:dev- Apply migrations locallypnpm db:studio- Open Drizzle Studio for database managementpnpm db:seed- Seed database with sample data
pnpm lint- Run Biome linterpnpm format- Format code with Biomepnpm type-check- Run TypeScript type checkingpnpm test- Run tests with Vitest
pnpm email:dev- Start email template development server (port 3001)
- Never write SQL migrations manually - Always use
pnpm db:generate - Use Server Components by default - Add
use clientonly when necessary - Follow the established patterns - Check existing code for conventions
- Type safety is mandatory - No
anytypes allowed - Test your changes - Write tests for new features
src/
├── app/ # Next.js App Router
│ ├── (auth)/ # Authentication pages
│ ├── (main)/ # Main application
│ │ ├── workouts/ # Workout management
│ │ ├── programming/ # Programming tracks
│ │ ├── log/ # Workout logging
│ │ ├── movements/ # Movement library
│ │ └── calculator/ # Workout calculators
│ ├── (admin)/ # Admin dashboard
│ ├── (settings)/ # User settings
│ └── api/ # API routes
├── components/ # Reusable React components
├── db/ # Database configuration
│ ├── schemas/ # Database schema definitions
│ └── migrations/ # Auto-generated migrations
├── server/ # Server-side business logic
├── actions/ # Server actions (ZSA)
├── utils/ # Utility functions
├── state/ # Client state management (Zustand)
├── schemas/ # Zod validation schemas
└── react-email/ # Email templates
The application uses a modular database schema with the following main entities:
- Users - User accounts and authentication
- Teams - Multi-tenant team management
- Workouts - Workout definitions and components
- Movements - Exercise movement library
- Programming Tracks - Training programs
- Workout Results - Athlete performance data
- Schedule Templates - Recurring programming patterns
- Team Memberships - User-team relationships
- Team Roles - Custom roles and permissions
- Billing - Credit transactions and usage
- Sessions - User authentication sessions
-
Create Cloudflare resources
- Create D1 database
- Create KV namespace for sessions
- Set up Turnstile for CAPTCHA
-
Configure environment variables
- Set
RESEND_API_KEYorBREVO_API_KEY - Set
TURNSTILE_SECRET_KEY - Configure Stripe keys
- Set
-
Update wrangler.jsonc
- Add your Cloudflare account ID
- Update database and KV namespace IDs
- Configure environment variables
-
Set up GitHub Actions
# Add to GitHub secrets CLOUDFLARE_API_TOKEN=your_token # Add to GitHub variables CLOUDFLARE_ACCOUNT_ID=your_account_id CLOUDFLARE_ZONE_ID=your_zone_id # Optional
-
Deploy
pnpm deploy:prod
DATABASE_URL- D1 database connectionKV_SESSIONS- KV namespace for sessionsTURNSTILE_SECRET_KEY- Cloudflare Turnstile secretNEXT_PUBLIC_TURNSTILE_SITE_KEY- Turnstile site keyRESEND_API_KEYorBREVO_API_KEY- Email service API key
STRIPE_SECRET_KEY- Stripe API keySTRIPE_WEBHOOK_SECRET- Stripe webhook secretGOOGLE_CLIENT_ID- Google OAuth client IDGOOGLE_CLIENT_SECRET- Google OAuth client secret
# Run all tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Run tests with coverage
pnpm test:coverageTests are located in the test/ directory and use Vitest with Testing Library.
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
We use semantic commit messages:
feat:- New featuresfix:- Bug fixeschore:- Maintenance tasksdocs:- Documentation changestest:- Test additions or changes
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with the Cloudflare Workers Next.js SaaS Template
- UI components from Shadcn UI
- Drag and drop powered by Atlaskit Pragmatic Drag and Drop
For support, please open an issue in the GitHub repository or contact the development team.
Built with ❤️ for the CrossFit community