How mohamed-mudawi/blip works
1. Core shape of the repo
- This is a Next.js App Router application. The architecture is a single deployable web app that combines:
- server-rendered/pages UI,
- API route handlers,
- OAuth integrations for Instagram and Twitter/X,
- local file upload handling,
- and backend services via Supabase and Prisma.
2. User-facing application layer
- The main UI lives under app/:
- app/page.tsx is the root entry.
- app/home/page.tsx, app/login/page.tsx, app/signup/page.tsx, and app/settings/page.tsx define the main screens.
- app/layout.tsx and app/globals.css provide shared layout and styling.
- Shared UI components are in app/components/, including:
- SocialMediaPoster.tsx / SocialMediaPoster-updated.tsx for the posting experience,
- TopBar.tsx,
- UserMenu.tsx.
- For a diagram, this is the browser-facing presentation layer.
3. Primary product capability: social posting
- The app is built around a “social media poster” workflow.
- The UI likely collects content/media and sends it to backend routes that post to one or both platforms.
- The two platform-specific integrations are separate subsystems, not a single generic social API:
- app/api/auth/instagram/*
- app/api/auth/twitter/*
4. Instagram integration subsystem
- Instagram-specific backend logic is split into route handlers:
- route.ts for starting auth or handling the main integration endpoint,
- callback/route.ts for OAuth return handling,
- status/route.ts for checking connection state,
- post/route.ts for publishing content,
- logout/route.ts for disconnecting.
- This indicates a full lifecycle: connect → verify status → post → disconnect.
- In an architecture diagram, Instagram should be shown as an external OAuth/API dependency connected through these route handlers.
5. Twitter/X integration subsystem
- Twitter follows the same pattern as Instagram:
- route.ts,
- callback/route.ts,
- status/route.ts,
- post/route.ts,
- logout/route.ts.
- The mirrored structure suggests the app abstracts “platform integration” at the UI level but keeps platform-specific server logic isolated.
- Twitter/X is also an external dependency reached only through backend routes, not directly from the client.
6. Auth and callback boundaries
- There are two distinct callback areas:
- platform callbacks under app/api/auth/*/callback,
- and a generic app/auth/callback/route.ts.
- This suggests the app has at least one broader auth redirect/callback path in addition to the social-provider flows.
- For an architecture diagram, treat callback handling as a key boundary where the app receives redirects from external identity/providers and exchanges them for internal session/state.
7. Upload and media handling
- app/api/uploads/route.ts and public/uploads/ indicate the app supports file upload workflows.
- The upload endpoint is likely the bridge between browser-selected media and the posting pipeline.
- public/uploads/ implies uploaded assets are stored in the app’s public file area, so media becomes retrievable by URL for later use in posting flows.
8. Backend/data layer
- lib/supabase.ts shows the app integrates with Supabase as a backend service.
- prisma/schema.prisma and prisma.config.ts show Prisma is used for database schema and access patterns.
- This means persistence is not just local state; there is a structured data layer for users, connections, tokens, post metadata, or related records.
- In a diagram, place Supabase/DB beneath the app as the persistence/auth-support tier.
9. Operational endpoints
- app/api/health/route.ts provides a health check endpoint, which is useful for deployment monitoring and uptime checks.
- This is a small but important operational boundary separate from product flows.
- It indicates the app is intended to be deployed as a hosted service rather than just run locally.
10. Tooling and runtime
- The project is TypeScript-based (tsconfig.json) with Next.js config and standard frontend tooling:
- eslint.config.mjs,
- postcss.config.mjs,
- next.config.ts,
- package.json / lockfile.
- The repo follows the App Router convention, so both UI and API live in the same codebase and runtime.
- Deployment is likely serverless-friendly, with route handlers serving as the backend surface.
11. Important architecture boundaries to draw
- Browser/UI boundary: pages and components in app/.
- App backend boundary: route handlers in app/api/ and app/auth/.
- External provider boundary: Instagram, Twitter/X, and Supabase.
- Storage boundary: public/uploads/ for uploaded media.
- Data boundary: Prisma-managed database models and Supabase integration.
12. Overall flow
- A user opens the Next.js UI, authenticates or connects a social account, optionally uploads media, and triggers a post action.
- The client talks to internal route handlers, which then:
- manage OAuth callbacks,
- persist or read state via the backend/data layer,
- and call Instagram/Twitter APIs to complete posting.
- The app therefore behaves as a compact orchestration layer between the user, local media storage, and multiple external services.
Main entry points: SocialMediaPoster.tsx Poster · app/page.tsx App shell · home/page.tsx Home · settings/page.tsx Settings
Components 27
Presentation
Browser-facing pages and shared UI
- App shell · Root App Router entry and shared shell
app/page.tsx - Home · Main logged-in landing screen
app/home/page.tsx - Login · Sign-in screen
app/login/page.tsx - Signup · Account creation screen
app/signup/page.tsx - Settings · User configuration screen
app/settings/page.tsx - Poster · Social posting workflow UI
app/components/SocialMediaPoster.tsx - Top bar · Shared navigation/header
app/components/TopBar.tsx - User menu · Account menu and session actions
app/components/UserMenu.tsx
Backend
Route handlers and callbacks
- Uploads · Receives and stores uploaded media
app/api/uploads/route.ts - Health · Operational health check endpoint
app/api/health/route.ts - Auth callback · Generic authentication redirect/callback boundary
app/auth/callback/route.ts
Integrations
Platform-specific social posting flows
- Instagram auth · Starts Instagram connection flow
app/api/auth/instagram/route.ts - IG callback · Handles Instagram OAuth return
app/api/auth/instagram/callback/route.ts - IG status · Checks Instagram connection state
app/api/auth/instagram/status/route.ts - IG post · Publishes content to Instagram
app/api/auth/instagram/post/route.ts - IG logout · Disconnects Instagram account
app/api/auth/instagram/logout/route.ts - Twitter auth · Starts Twitter/X connection flow
app/api/auth/twitter/route.ts - X callback · Handles Twitter/X OAuth return
app/api/auth/twitter/callback/route.ts - X status · Checks Twitter/X connection state
app/api/auth/twitter/status/route.ts - X post · Publishes content to Twitter/X
app/api/auth/twitter/post/route.ts - X logout · Disconnects Twitter/X account
app/api/auth/twitter/logout/route.ts
Data
Persistence and media storage
- Supabase · Backend service integration used by the app
lib/supabase.ts - Prisma schema · Database models and persistence contract
prisma/schema.prisma - Uploads store · Publicly served uploaded files
public/uploads
External
Third-party services
- Instagram API · External Instagram/OAuth platform
- Twitter/X API · External Twitter/X/OAuth platform
- Supabase cloud · Hosted Supabase backend service
Connections 30
- App shell → Home: routes to · App shell leads into the main app screen
- App shell → Login: auth UI · Entry path for sign-in
- App shell → Signup: auth UI · Entry path for account creation
- App shell → Settings: routes to · Shared app shell exposes settings
- Home → Poster: uses · Home screen centers on the posting workflow
- Home → Top bar: uses · Shared top navigation on the main screen
- Home → User menu: uses · Session/account controls
- Poster → Uploads: uploads media · Poster sends selected files to backend upload handling
- Poster → Instagram auth: connects · UI can initiate Instagram connection
- Poster → Twitter auth: connects · UI can initiate Twitter/X connection
- Poster → IG post: publishes · Posting workflow can target Instagram
- Poster → X post: publishes · Posting workflow can target Twitter/X
- Settings → IG status: checks · Settings likely shows Instagram connection state
- Settings → X status: checks · Settings likely shows Twitter/X connection state
- Instagram auth → IG callback: redirects · Instagram OAuth returns through callback
- IG callback → Instagram API: exchanges token · Callback completes against Instagram
- IG status → Instagram API: reads state · Connection state is derived from Instagram integration data
- IG post → Instagram API: posts · Content is published through Instagram API
- IG logout → Instagram API: disconnects · Terminates Instagram linkage
- Twitter auth → X callback: redirects · Twitter/X OAuth returns through callback
- X callback → Twitter/X API: exchanges token · Callback completes against Twitter/X
- X status → Twitter/X API: reads state · Connection state is derived from Twitter/X integration data
- X post → Twitter/X API: posts · Content is published through Twitter/X API
- X logout → Twitter/X API: disconnects · Terminates Twitter/X linkage
- Uploads → Uploads store: stores · Uploaded media is made available as public files
- Uploads → Supabase: persists metadata · Upload flow can record state through backend services
- Supabase → Supabase cloud: connects · Client-side helper talks to hosted Supabase
- Prisma schema → Supabase: models data · Schema defines the structured data used by the app
- Auth callback → Supabase cloud: session callback · Generic auth callback completes with backend identity/session support
- Health → App shell: monitored by · Health endpoint supports deployment checks for the app