Quick Start Guide
Get up to speed with the InsightPro codebase
1. Understanding the State Flow
The most important concept is the Single Source of Truth (SSOT) pattern:
RequestInsights (SSOT) → QuickFeedbackPath → Individual Steps → useProjectFormSteps → Backend
2. Adding a New Step
To add a new step to the creation flow:
- Create step component in components/request/quick/ or prototype/
- Add case to saveProjectStep.js validation function
- Import and render in QuickFeedbackPath or InDepthReviewPath
- Update TOTAL_STEPS constant
- Test with browser back/forward and refresh
3. Modifying Backend Functions
All backend functions follow this pattern:
// 1. Authenticate user
const base44 = createClientFromRequest(req);
const user = await base44.auth.me();
// 2. Validate input
const validation = validateInput(body);
// 3. Check permissions
const canAccess = checkPermissions(user, resource);
// 4. Perform operation
const result = await base44.entities.X.update(...);
// 5. Return success
return Response.json({ success: true, ... });
Pattern 1: Controlled Components
All form steps use controlled components with local state:
const [title, setTitle] = useState(projectData?.title || "");
const [errors, setErrors] = useState({});
const handleContinue = () => {
if (!validate()) return;
onNext({ title, ... });
};
Pattern 2: No Page Reloads
Expert workflow uses state re-evaluation instead of reloads:
const onSuccess = async () => {
await initializeWorkflow(); // Re-evaluate state
};
// NOT: window.location.reload();
Pattern 3: Permission Checking
Always verify permissions in backend functions:
const canEdit = (
project.requester_id === user.id ||
user.role === 'admin' ||
(project.organization_id === user.organization_id &&
['admin', 'project_creator'].includes(user.organization_role))
);
DO
- ✓Use the useProjectFormSteps hook for multi-step forms
- ✓Validate data on both frontend and backend
- ✓Update state through callbacks, not direct mutations
- ✓Handle loading and error states properly
- ✓Use initializeWorkflow() to re-evaluate expert state
- ✓Check permissions in every backend function
DON'T
- ✗Use window.location.reload() - breaks state
- ✗Create projects directly in step components
- ✗Bypass the saveProjectStep function
- ✗Store sensitive data in URL parameters
- ✗Skip validation "just this once"
- ✗Assume user is authenticated without checking
Enable Logging
Common Issues & Solutions:
Project created multiple times
→ Check that handleStepComplete is only called once per submission
State not updating after save
→ Verify setProjectData() is called with backend response
Expert stuck in workflow state
→ Check database directly - may be missing NDA signature or acceptance
File upload fails silently
→ Check browser console for CORS errors or file size limits
- 1Read the full System Architecture documentation
- 2Test the creator flow end-to-end
- 3Test the expert flow with different scenarios
- 4Review backend function error handling
- 5Set up monitoring and logging for production
