How sharad420/social-network-prod works
This is a Django REST and React social network. A user enters through the SPA, which routes to public or protected pages; those pages use API clients to authenticate or retrieve and mutate social data. Backend views validate requests and apply authentication, OTP, post, follow, and profile logic, backed by relational models and Redis for ephemeral OTP state. The map preserves the documented registration/verification and social-feature branches. Some backend endpoints and frontend pages were not sampled, so their detailed call relationships are shown only where the README or source index supports them.
Main entry points: views.py API views · App.jsx Routes and layout · api.js REST API client · Post.jsx Post interactions
Components 20
React application
- SPA entry
frontend/src/main.jsx - Routes and layout
frontend/src/App.jsx - REST API client
frontend/src/api.js
Authentication
- Auth context
frontend/src/components/AuthContext.jsx - Login
frontend/src/pages/Login.jsx - Registration form
frontend/src/components/RegistrationForm.jsx - Email OTP flow
frontend/src/pages/EmailOtpFlow.jsx - Auth API client
frontend/src/authApi.js
Social features
- Home feed
frontend/src/pages/Home.jsx - Following feed
frontend/src/pages/Following.jsx - User profile
frontend/src/pages/Profile.jsx - Post interactions
frontend/src/components/Post.jsx
Django API
- API views
backend/network/views.py - Auth utilities
backend/network/utils.py - Request serializers
backend/network/serializers.py - OTP key operations
backend/network/redis_client.py
Persistence
- Social and account models
backend/network/models.py - Redis
Other components
- Visitor
- Email service
Connections 30
- Visitor → SPA entry: opens
frontend/src/main.jsx - SPA entry → Routes and layout: renders
frontend/src/main.jsx - Routes and layout → Home feed: routes to
frontend/src/App.jsx - Routes and layout → Following feed: routes to
frontend/src/App.jsx - Routes and layout → User profile: routes to
frontend/src/App.jsx - Routes and layout → Login: routes to
frontend/src/App.jsx - Routes and layout → Registration form: routes to
frontend/src/App.jsx - Routes and layout → Auth context: provides state
frontend/src/App.jsx - Home feed → Post interactions: renders
frontend/src/pages/Home.jsx - Following feed → Post interactions: renders
frontend/src/pages/Following.jsx - User profile → Post interactions: renders
frontend/src/pages/Profile.jsx - Home feed → REST API client: requests data
frontend/src/pages/Home.jsx - Following feed → REST API client: requests data
frontend/src/pages/Following.jsx - User profile → REST API client: requests data
frontend/src/pages/Profile.jsx - Post interactions → REST API client: mutates posts
frontend/src/components/Post.jsx - Login → Auth API client: submits credentials
frontend/src/pages/Login.jsx - Login → Auth context: sets user
frontend/src/pages/Login.jsx - Auth context → REST API client: refreshes tokens
frontend/src/components/AuthContext.jsx - Registration form → Email OTP flow: starts verification
frontend/src/pages/Register.jsx - REST API client → API views: calls REST API
README.md - Auth API client → API views: calls REST API
README.md - API views → Auth utilities: uses auth helpers
backend/network/views.py - API views → OTP key operations: verifies OTP
backend/network/views.py - API views → Request serializers: serializes responses
backend/network/views.py - API views → Social and account models: reads and writes
backend/network/views.py - Auth utilities → Social and account models: tracks sessions
backend/network/utils.py - OTP key operations → Redis: stores OTP state
backend/network/redis_client.py - Auth utilities → Email service: sends verification
backend/network/utils.py - API views → Email service: sends OTP
- API views → Social and account models: serves social data
README.md