Data Flow
How data moves through the system
Understanding how data moves through CodePlanet helps you use the platform effectively and debug issues.
Request Lifecycle
Here's how a typical user action flows through the system:
Example: Submitting a Solution
Let's trace a complete solution submission:
1. User Clicks "Submit"
2. API Route Processes Request
3. Database Operations
4. Response Returned
State Management
Server State (Database)
- Source of truth for all persistent data
- Protected by RLS policies
- Accessed via Supabase client
Client State (React)
Local State (useState):
URL State (searchParams):
Context (shared state):
Caching Strategy
Server-Side
- Static pages cached at CDN edge
- API responses cached with appropriate headers
- Database queries cached with prepared statements
Client-Side
- React Query/SWR for API caching (where used)
- Local storage for preferences
- Session storage for temporary data
Real-Time Updates
Some features use real-time subscriptions:
Error Propagation
Errors flow up through the stack:
Error Response Format
Optimistic Updates
For better UX, some actions update UI before server confirmation:
Webhook Flow
External events (like payments) use webhooks:
Next Steps
- Frontend Stack — React architecture details
- Backend Services — API implementation
- Security Overview — Data protection