🎯 Goal: Get new engineers from clone to local dev in <30 minutes
SentrIQ helps SMBs in regulated spaces navigate cybersecurity compliance with AI-powered guidance, expert escalation, and automated policy generation.
- Node.js 18+ (use
nvmfor version management) - pnpm - Fast, disk space efficient package manager
- Supabase CLI - For local database development
# Install pnpm globally
npm install -g pnpm
# Install Supabase CLI
npm install -g supabasegit clone <YOUR_GIT_URL>
cd sentriq
pnpm install# Copy environment template
cp .env.example .env.local
# Configure your environment variables:
# VITE_SUPABASE_URL=your_supabase_url
# VITE_SUPABASE_ANON_KEY=your_supabase_anon_key# Start frontend (Vite dev server)
pnpm dev
# In another terminal - start Supabase locally
supabase start
# Run database migrations
supabase db reset- ✅ Frontend: http://localhost:5173
- ✅ Supabase Studio: http://localhost:54323
- ✅ Edge Functions: http://localhost:54321/functions/v1
- React 18 - UI framework
- TypeScript - Type safety
- Vite - Build tool & dev server
- Tailwind CSS - Styling framework
- shadcn/ui - Component library
- React Router - Client-side routing
- TanStack Query - Server state management
- Supabase - Backend-as-a-Service
- PostgreSQL - Database with Row Level Security (RLS)
- Edge Functions - Serverless compute (Deno runtime)
- Authentication - Built-in auth with MFA support
- Storage - File uploads and management
src/
├── components/ # Reusable UI components
│ ├── ui/ # shadcn/ui base components
│ ├── auth/ # Authentication components
│ ├── chat/ # AI chat interface
│ └── dashboard/ # Dashboard-specific components
├── contexts/ # React context providers
├── hooks/ # Custom React hooks
├── lib/ # Utility functions & helpers
├── pages/ # Route components
├── templates/ # Policy templates (.md files)
└── integrations/ # Third-party integrations
supabase/
├── functions/ # Edge functions (serverless)
├── migrations/ # Database schema changes
└── config.toml # Supabase configuration
The AuthContext provides comprehensive auth state management:
import { useAuth } from '@/contexts/AuthContext';
function MyComponent() {
const {
user, // Current user object
userRole, // 'business_owner' | 'consultant' | 'admin'
subscriptionInfo, // Subscription tier & status
loading, // Auth loading state
signIn, // Sign in function
signOut, // Sign out function
} = useAuth();
if (loading) return <div>Loading...</div>;
if (!user) return <div>Please sign in</div>;
return <div>Welcome {user.email}!</div>;
}Wrap components to enforce authentication and authorization:
import { ProtectedRoute } from '@/components/auth/ProtectedRoute';
// Basic protection (any authenticated user)
<ProtectedRoute>
<Dashboard />
</ProtectedRoute>
// Admin only
<ProtectedRoute requireAdmin>
<AdminPanel />
</ProtectedRoute>
// Specific roles
<ProtectedRoute allowRoles={['consultant', 'admin']}>
<ConsultantDashboard />
</ProtectedRoute>
// Subscription requirements
<ProtectedRoute requireSubscription minimumTier="Pro">
<PremiumFeature />
</ProtectedRoute>Three user roles with different permissions:
- business_owner: Standard user, can use basic features
- consultant: Can access escalation queue and consultant tools
- admin: Full system access, user management, analytics
# Run type checking
pnpm type-check
# Run linting
pnpm lint
# Fix linting issues
pnpm lint:fix# Create new migration
supabase migration new your_migration_name
# Apply migrations
supabase db reset
# View database in Studio
supabase studio# Create new function
supabase functions new function-name
# Deploy functions
supabase functions deploy
# View function logs
supabase functions logs function-name- Create component in
src/pages/ - Add route in
src/App.tsx - Add navigation in sidebar if needed
- Apply appropriate
ProtectedRoutewrapper
- Create edge function in
supabase/functions/ - Add CORS headers and error handling
- Use standardized error responses
- Add authentication checks
- Create in appropriate
src/components/subdirectory - Use TypeScript interfaces for props
- Follow design system patterns
- Add to component exports if reusable
# Clear node_modules and reinstall
rm -rf node_modules pnpm-lock.yaml
pnpm install
# Clear Vite cache
rm -rf .vite
pnpm dev# Restart Supabase
supabase stop
supabase start
# Check if required env vars are set
echo $VITE_SUPABASE_URL
echo $VITE_SUPABASE_ANON_KEY# Check function logs
supabase functions logs function-name --follow
# Test function locally
curl -X POST http://localhost:54321/functions/v1/function-name \
-H "Content-Type: application/json" \
-d '{"test": "data"}'- Check that Site URL and Redirect URLs are configured in Supabase Auth settings
- Verify email confirmation is disabled for local development
- Ensure proper error handling in auth flows
Before submitting your first pull request:
- Type Safety: No TypeScript errors (
pnpm type-check) - Linting: Code passes linting (
pnpm lint) - Formatting: Code is properly formatted
- Imports: Clean imports, no unused imports
- Manual Testing: Feature works in browser
- Edge Cases: Test error states and edge cases
- Mobile: Responsive design on mobile devices
- Auth States: Test both authenticated and unauthenticated states
- ProtectedRoute: Proper route protection implemented
- Input Validation: User input is validated and sanitized
- Error Handling: Errors don't expose sensitive information
- RLS Policies: Database access follows RLS policies
- Code Comments: Complex logic is commented
- README Updates: Update docs if adding new features
- Type Definitions: Proper TypeScript interfaces
feat: add user profile management
fix: resolve authentication redirect loop
docs: update API documentation
refactor: improve error handling in chat component
style: update button component design
test: add unit tests for policy generator
# Create feature branch
git checkout -b feature/your-feature-name
# Make your changes and commit
git add .
git commit -m "feat: describe your changes"
# Push and create PR
git push origin feature/your-feature-name- Documentation: Check this README and inline code comments
- Issues: Search existing GitHub issues first
- Team Chat: Reach out in team channels
- Supabase Docs: https://supabase.com/docs
- React Docs: https://react.dev
- Tailwind Docs: https://tailwindcss.com/docs
You're ready to contribute when you can:
- ✅ Run the project locally without errors
- ✅ Understand the authentication flow
- ✅ Create a simple protected page
- ✅ Make a database query using Supabase
- ✅ Deploy an edge function
- ✅ Follow the PR checklist successfully
Welcome to the SentrIQ team! 🚀