TrainFlow is a hospitality training platform for onboarding and upskilling staff through short, structured learning modules. It supports separate staff and manager experiences, role-based access, quizzes, progress tracking, and training group assignment.
- React 18
- TypeScript
- Vite
- React Router
- Tailwind CSS
- shadcn/ui
- TanStack Query
- Supabase
- Vitest
- Node.js 18+ recommended
- npm
- A Supabase project with the required environment variables configured
npm installCreate a .env file in the project root and add the required Supabase values:
VITE_SUPABASE_URL=your_supabase_url
VITE_SUPABASE_PUBLISHABLE_KEY=your_supabase_publishable_key
VITE_SUPABASE_PROJECT_ID=your_supabase_project_idThese are publishable client-side values (safe to expose). Server-side secrets (e.g. SUPABASE_SERVICE_ROLE_KEY, LOVABLE_API_KEY) are configured separately as Edge Function secrets — never put them in .env.
If you are using Supabase Edge Functions or storage features, make sure the linked Supabase project is set up with the expected schema, buckets, and policies.
npm run devThe app runs through Vite's development server.
npm run devstarts the local development servernpm run buildcreates a production buildnpm run build:devcreates a development-mode buildnpm run previewpreviews the production build locallynpm run lintruns ESLintnpm run testruns the test suite oncenpm run test:watchruns tests in watch mode
src/
assets/ Static images and template media
components/ Shared UI, manager tools, and microlearning components
contexts/ React context providers such as authentication
data/ Seeded template data and static configuration
hooks/ Reusable React hooks
integrations/ External service clients and generated types
lib/ Shared utilities
pages/ Route-level pages for public, staff, and manager flows
test/ Test setup and example tests
supabase/
functions/ Edge Functions
migrations/ Database schema and policy migrations
TrainFlow is a client-side React application with Supabase as the backend platform.
- Routing is defined in
src/App.tsxusingreact-router-dom - Authentication state is managed through
AuthProviderinsrc/contexts/AuthContext.tsx - Access control is enforced in the UI using route guards such as
RoleGuard - Manager and staff experiences are separated into dedicated route groups under
src/pages/managerandsrc/pages/staff - Shared presentational and interaction patterns live in
src/components - Supabase client setup and generated database types live under
src/integrations/supabase
The app relies on Supabase for:
- Authentication
- Database reads and writes
- Storage uploads for module assets
- Edge Functions for server-side actions
Current Edge Functions include:
condense-textfor shortening training copyremove-stafffor manager-side staff removal workflows
Database schema and policies are tracked in the supabase/migrations directory.
Run the test suite with:
npm run testVitest configuration lives in vitest.config.ts, and test setup files live in src/test.
- Path aliases use
@to referencesrc - Styling is handled with Tailwind CSS and shared UI primitives
- The app uses role-based routing, so testing both manager and staff flows is important
- Supabase policies and storage permissions should be validated alongside UI changes
Build the project for production with:
npm run buildYou can then deploy the generated output using any hosting platform that supports static frontends, provided the required environment variables are available at build time.