How alansteves/postforge works
PostForge AI is a LinkedIn-content creation app: users discuss an idea in chat, turn it into a polished post, preview and edit it, then connect LinkedIn and publish. The sampled API routes show generation, formatting, preference and post persistence, plus session-backed authentication. The graph also preserves the documented-in-source OAuth and publishing surfaces. Several client hooks and routes were not excerpted, so their wiring is shown only where supported; unverified integration links are dashed.
Main entry points: prisma.ts PostgreSQL database · post-context.tsx Post context · route.ts Chat generation API · session.ts Session management
Components 19
Creator experience
- Chat interface
components/chat - Post context
context/post-context.tsx - Client state hooks
lib/hooks
Content workflow
- Chat generation API
app/api/ai/generate/route.ts - Post formatting API
app/api/posts/format/route.ts - Preference API and controls
app/api/preferences/route.ts - Post preview and actions
components/post-preview - Post endpoints
app/api/posts - Conversation endpoints
app/api/conversations
Identity and preferences
- Sign-in and signup
components/auth - Auth endpoints
app/api/auth - Session management
lib/auth/session.ts - Password hashing
lib/auth.ts - User sanitization
lib/sanitizer.ts
External services
- LinkedIn endpoints
app/api/linkedin - Gemini API
Persistence
- PostgreSQL database
lib/db/prisma.ts
Other components
- Creator
Connections 26
- Creator → Sign-in and signup: signs in
- Sign-in and signup → Post context: uses auth state
components/auth/sign-in-form.tsx - Auth endpoints → Password hashing: checks credentials
app/api/auth/sign-in/route.ts - Auth endpoints → Session management: creates session
app/api/auth/sign-in/route.ts - Session management → PostgreSQL database: loads user
lib/auth/session.ts - Session management → User sanitization: sanitizes user
lib/auth/session.ts - Post context → Client state hooks: composes state
context/post-context.tsx - Creator → Chat interface: submits idea
- Chat interface → Post context: uses chat state
components/chat/recent-searches.tsx - Creator → Chat generation API: sends prompt
app/api/ai/generate/route.ts - Chat generation API → Gemini API: requests completion
app/api/ai/generate/route.ts - Chat generation API → PostgreSQL database: stores messages
app/api/ai/generate/route.ts - Creator → Post formatting API: requests formatting
app/api/posts/format/route.ts - Post formatting API → PostgreSQL database: reads preferences and saves post
app/api/posts/format/route.ts - Creator → Preference API and controls: updates preferences
app/api/preferences/route.ts - Preference API and controls → PostgreSQL database: reads and writes settings
app/api/preferences/route.ts - Creator → Post endpoints: manages drafts
app/api/posts/route.ts - Post endpoints → PostgreSQL database: reads and writes posts
app/api/posts/route.ts - Creator → Conversation endpoints: manages conversations
- Conversation endpoints → PostgreSQL database: reads and writes conversations
app/api/conversations/route.ts - Post context → Post preview and actions: provides post state
components/post-preview/post-preview.tsx - Creator → Post preview and actions: reviews and edits
- Post preview and actions → Post context: connects or disconnects
components/post-preview/post-preview.tsx - Post context → LinkedIn endpoints: requests account and publish actions
- LinkedIn endpoints → LinkedIn: uses OAuth and publishing
- LinkedIn endpoints → PostgreSQL database: loads account and post data
app/api/linkedin/publish/route.ts