A production-ready social platform template built with Next.js, Prisma, Supabase, and modern frontend tooling.
一个可直接二次开发的社交平台模板,基于 Next.js、Prisma、Supabase 与现代前端技术栈。
- Overview / 项目概览
- Demo Screenshots / 页面截图
- Architecture / 架构图
- Features / 功能列表
- Tech Stack / 技术栈
- Project Structure / 目录结构
- Quick Start / 快速开始
- Environment Variables / 环境变量
- Scripts / 常用命令
- Analytics & Dashboard / 数据看板
- Roadmap / 路线图
- FAQ / 常见问题
- Troubleshooting / 排障
- Contributing / 贡献指南
- Security / 安全
- License / 许可证
- Social core: posts, replies, likes, bookmarks, shares, follow graph, messaging
社交核心:发帖、回复、点赞、收藏、转发、关注关系、私信 - AI hooks: AI chat and content-assist endpoints (Vercel AI SDK compatible)
AI 能力:AI 对话与内容辅助接口(兼容 Vercel AI SDK) - i18n: Chinese and English (
next-intl)
国际化:中英文双语(next-intl) - Analytics dashboard: UV/PV, funnel segmentation, cohort retention, DAU/WAU/MAU
数据看板:UV/PV、漏斗分层、cohort 留存、DAU/WAU/MAU
Screenshots are stored in docs/screenshots/.
截图统一放在 docs/screenshots/ 目录。
flowchart LR
A["Next.js App Router"] --> B["API Routes"]
B --> C["Prisma Service Layer"]
C --> D["PostgreSQL"]
A --> E["Supabase SSR Auth"]
A --> F["Zustand Client State"]
A --> G["next-intl"]
B --> H["Analytics Events (user_action)"]
H --> I["Dashboard Aggregations"]
- Post creation / editing / deletion
- Reply threads
- Like / bookmark / share
- Follow / unfollow
- User profile and relationship graph
- Messaging entry and conversation views
- Chat routes and streaming-ready integration points
- AI-assisted generation hooks for content workflows
- Lightweight business home (
/dashboard) - Deep analytics module (
/dashboard/vip-support) - Cohort retention (daily/weekly)
- Traffic source / funnel / audience / content segmentation
- Framework: Next.js 16.1.6 (App Router)
- Language: TypeScript (strict mode)
- Styling: Tailwind CSS v4 + shadcn/ui
- Database: PostgreSQL + Prisma 7.x
- Auth/Storage: Supabase SSR
- State: Zustand
- Forms: React Hook Form + Zod
- i18n: next-intl
app/ App Router pages and API routes
components/ UI and business components
lib/ services and shared utilities
store/ Zustand stores
messages/ i18n dictionaries (zh-CN / en)
utils/ helper utilities
prisma/ schema and migrations
generated/ generated Prisma client
# 1) Install dependencies
npm install
# 2) Configure env
cp .env.example .env.local
# 3) Generate Prisma client
npx prisma generate
# 4) Sync schema (dev)
npx prisma db push
# 5) Run dev server
npm run devOpen http://localhost:3000.
Required (minimum) / 最低必需:
DATABASE_URLNEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEYNEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY
Optional / 可选:
NEXT_PUBLIC_URLorNEXT_PUBLIC_APP_URLGOOGLE_GENERATIVE_AI_API_KEYGLM_API_KEYNOTION_TOKEN,NOTION_DATABASE_IDSTRIPE_SECRET_KEY,NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY,STRIPE_WEBHOOK_SECRET
npm run dev # start dev server
npm run build # build for production
npm run start # start production server
npm run lint # run eslint
npx tsc --noEmit # type-check onlyPrisma:
npx prisma generate
npx prisma db push
npx prisma migrate dev
npx prisma studio/dashboard: lightweight business overview(轻量总览)/dashboard/vip-support: deep analytics workspace(深度分析工作台)
FEED_IMPRESSIONPOST_CLICKPROFILE_ENTER(stored asPOST_CLICK+ metadata)REPLY_CREATEPOST_LIKEPOST_SHAREPOST_BOOKMARKFOLLOW
- UV/PV switch supported in dashboard modules.
- Cohort view supports daily and weekly aggregation.
- Core social interactions
- Multilingual UI
- Analytics dashboard (UV/PV + cohort + segmentation)
- Real-time notifications
- Full-text search and ranking improvements
- Recommender model experimentation workspace
- E2E testing suite
- Ensure your env points to the expected database.
- Verify event writes in
user_action.
- Small cohort size or missing activity in the measured day can yield 0%.
- Weekly mode is usually more stable than daily mode.
- Add event logging in route/component.
- Extend aggregation in
lib/dashboard/service.ts. - Add types in
lib/dashboard/types.tsand render in dashboard page.
- Type errors:
- Run
npx tsc --noEmit
- Run
- Prisma/client mismatch:
- Run
npx prisma generate
- Run
- Schema mismatch:
- Run
npx prisma db pushin development
- Run
- Auth issues:
- Verify Supabase keys and callback URL configuration
- Create a feature branch.
- Keep changes scoped and typed.
- Run checks before PR:
npm run lintnpx tsc --noEmit
- Include context, impact, and screenshots (for UI changes).
- Never commit secrets (
.env.local, API keys). - Rotate leaked keys immediately.
- For vulnerabilities, contact maintainers privately first.
MIT. See LICENSE.






