How brainstation-23/openofficesurvey works
Main Components
• Frontend Client: Represent the client-side React application that includes:
• Pages (admin, user, survey, live, public, etc.) and components (UI library, navigation, dashboards, etc.).
• State management and hooks (React Query, custom hooks for OKR, survey responses, etc.).
• Routing management as seen from the pages organized under src/pages.
• Backend & Database (Supabase):
• Supabase Database: PostgreSQL with pre-defined SQL setup and seed scripts located under supabase/DB Setup and supabase/Seed Data.
• Supabase Authentication: Using Supabase Auth for sign-in (Email, OAuth, Magic Link) as indicated in the README and integrations.
• Supabase Functions (Serverless/API):
• Serverless functions located in supabase/functions, handling operations such as creating users, sending emails, managing surveys, toggling user status, etc.
• CI/CD & Deployment:
• GitHub workflows (.github/workflows folder) for continuous integration (SonarCloud, gitguardian, ORT) and configuration files like netlify.toml that show the deployment to Netlify.
• Third-Party Libraries & Tools:
• Tailwind CSS and Shadcn UI for styling.
• Vite as the build tool.
• ESLint, TypeScript configurations, and testing directories for quality and testing.
Interactions and Data Flow
• The Client (Frontend):
• Interacts with Supabase using the client integration found in src/integrations/supabase/client.ts.
• Communicates with Supabase Auth for user login and role-based access.
• Fetches and manages data (surveys, analytics, user data) via React Query and the provided custom hooks.
• Backend & Serverless:
• The Supabase Database stores survey details, user data, responses and configuration.
• Supabase Functions act as the API layer for survey management tasks (e.g., bulk operations, sending reminders, email service) and communicate with the database.
• CI/CD and Deployment:
• Code quality and automated testing are enforced via GitHub workflows.
• The frontend is deployed (Netlify) and integrated with the Supabase backend.
Architectural Patterns and Principles
• Component-Based Frontend Design: Strict separation of UI components into logical modules (admin, OKRs, surveys, team, etc.), layouts, and navigation.
• Modular Backend with Serverless Functions: Supabase functions encapsulate discrete business logic, keeping the backend modular and scalable.
• Integration & Config Driven: Use of configuration files (tsconfig, vite.config.ts, and supabase/config.toml) to manage environment-specific settings.
• Test-Driven Development: The presence of a robust __tests__ directory for backend and component-level testing shows a focus on quality assurance.