Private, mobile-first Threads-style social community built exclusively for the Cortis fandom, capped at 1,000 members.
| Feed | Post & Comments | Profile | Search | Login |
|---|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
- Private Fandom Gate (Max 1,000 Members)
- Google OAuth only via Better Auth (
databaseHooks.user.create.beforeenforces the 1,000-member cap and optionalADMIN_EMAILbootstrap). - Unauthenticated visitors and banned accounts are blocked at the server boundary and redirected to
/login.
- Google OAuth only via Better Auth (
- Mobile-First Threads UX
- Sticky top header, bottom navigation on mobile, and a centered
620pxfeed column with left sidebar on desktop. - Dark theme and Vietnamese (
vi) enabled by default, with user preferences (dark/light,vi/en) persisted in PostgreSQL (user_setting).
- Sticky top header, bottom navigation on mobile, and a centered
- Posts & Media Optimization
- Text posts up to 500 chars with up to 5 images and 1 video per post.
- Images: originals upload untouched when
jpeg/png/webpand ≤ 4 MB; larger or other formats are re-encoded client-side (1600px WebP q0.95), then/api/uploaddoes at most onesharppass (1600px WebP q88, only when oversized or above 2 MB) before streaming to Cloudinary. Video goes straight to Cloudflare R2 with a presignedPUT(MP4/MOV, H.264 only, ≤ 60 s, ≤ 50 MB). - For You and Following feeds powered by cursor pagination and TanStack Query.
- Engagement & 2-Level Comments
- Instagram-style Heart likes on both posts and comments (no public dislikes).
- Strict 2-level comment threads: replying to any level-1 or level-2 comment auto-prefills
@usernamein the input (YouTube-style), renders clickable blue@usernameprofile links, and keepsparentIdat level 1.
- Search & Profiles
- Search members (
@username) and posts with URL-synced query params (/search?q=...&filter=top|recent), Top / Recent sorting, and 10-item local search history (users & keywords). - User profiles (
/u/[username]) with follow/unfollow, bio, avatar upload, and a 30-day username change cooldown.
- Search members (
- Moderation & Admin Dashboard (
/admin)- Desktop-only (
≥ 1024px) moderation panel with stats overview, post/comment deletion, user ban/unban (admins protected), and report resolution.
- Desktop-only (
- Supabase Keep-Alive
/api/healthruns a real DB query (prisma.user.count()), pinged automatically by Vercel Cron (vercel.json) and GitHub Actions (.github/workflows/keep-alive.yml) to prevent Supabase free-tier auto-pause.
| Layer | Technology |
|---|---|
| Runtime & Package Manager | Bun 1.4.4 |
| Framework | Next.js 16.4.6 (App Router, Turbopack), React 19.3, TypeScript 5 |
| Styling & Icons | CSS Tokens (Dark/Light), Tailwind CSS 4.3.3, Phosphor Icons, Sonner |
| Data Fetching | TanStack Query 5.107.1 |
| Authentication | Better Auth 1.7.23 (Google OAuth + Prisma Adapter) |
| Database & ORM | PostgreSQL (Supabase) + Prisma 7.10.1 (@prisma/adapter-pg) |
| Media | Cloudinary 2.11.0 + sharp 0.35.5 (images); Cloudflare R2 with presigned uploads (video) |
| Hosting | Vercel |
├── prisma/
│ └── schema.prisma # User, UserSetting, Session, Account, Post, Comment, Like, CommentLike, Follow, Report
├── src/
│ ├── app/
│ │ ├── api/ # REST endpoints (auth, posts, comments, likes, search, users, admin, upload, health)
│ │ ├── admin/ # Desktop admin dashboard
│ │ ├── compose/ # Post composer
│ │ ├── login/ # Google OAuth gate
│ │ ├── post/[id]/ # Post detail & 2-level comments
│ │ ├── search/ # Member & post search (Top / Recent)
│ │ ├── settings/profile/ # Profile editor
│ │ └── u/[username]/ # Member profile
│ ├── components/ # UI shell, cards, modals, skeletons
│ ├── hooks/ # Feed & post-detail mutations
│ ├── lib/ # Constants, i18n, image compression, client error helpers
│ ├── server/ # Auth config, Prisma client, session guards, Cloudinary, post mapper
│ └── types/ # Shared DTO contracts
├── .github/workflows/keep-alive.yml
└── vercel.json
- Bun
>= 1.4 - A Supabase PostgreSQL project
- A Google Cloud Console OAuth 2.0 Web Client (
<APP_URL>/api/auth/callback/google) - A Cloudinary account
- A Cloudflare account with an R2 bucket, a public custom domain (never an
r2.devURL), and a CORS policy allowingPUT+content-typefrom the app origins — without CORS the browser video upload fails as a generic network error
Copy .env.example to .env and fill in your credentials:
cp .env.example .env| Variable | Description |
|---|---|
DATABASE_URL |
Supabase Transaction Pooler URL (:6543/postgres?pgbouncer=true) |
DIRECT_URL |
Supabase Direct Connection URL (:5432/postgres) for Prisma CLI |
BETTER_AUTH_SECRET |
Random secret (>= 32 chars, e.g. openssl rand -base64 32) |
BETTER_AUTH_URL |
Public app URL (http://localhost:3000 locally) |
GOOGLE_CLIENT_ID |
Google OAuth Client ID |
GOOGLE_CLIENT_SECRET |
Google OAuth Client Secret |
ADMIN_EMAIL |
Comma-separated emails auto-promoted to admin on first sign-up |
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME |
Cloudinary cloud name |
CLOUDINARY_API_KEY |
Cloudinary API key |
CLOUDINARY_API_SECRET |
Cloudinary API secret |
R2_ACCOUNT_ID |
Cloudflare account ID (video uploads) |
R2_ACCESS_KEY_ID |
R2 access key ID |
R2_SECRET_ACCESS_KEY |
R2 secret access key |
R2_BUCKET |
R2 bucket name (marjames-media) |
R2_PUBLIC_BASE_URL |
Public bucket domain — https, custom domain, never r2.dev |
bun install
set -a; . ./.env; set +a # export DIRECT_URL for psql
psql "$DIRECT_URL" -f prisma/sql/search-indexes.sql # pg_trgm + GIN search indexes
bun --env-file=.env run db:push
bun --env-file=.env run db:generateprisma/sql/search-indexes.sql must run first: the schema declares GIN trigram indexes,
which need the pg_trgm extension on a fresh database.
bun run devOpen http://localhost:3000.
| Command | Description |
|---|---|
bun run dev |
Start Next.js dev server with Bun & Turbopack |
bun run build |
Create production build |
bun run start |
Start production server |
bun run typecheck |
Run tsc --noEmit |
bun run lint |
Run ESLint |
bun --env-file=.env run db:push |
Sync Prisma schema to PostgreSQL |
bun --env-file=.env run db:generate |
Regenerate Prisma Client |
- Import the repository on Vercel and configure all environment variables from
.env.example(setBETTER_AUTH_URLto your production domain). - Add
https://<your-domain>/api/auth/callback/googleto Authorized redirect URIs in Google Cloud Console. - Add repository variable
APP_HEALTH_URL(https://<your-domain>/api/health) in GitHub Settings → Secrets and variables → Actions → Variables so.github/workflows/keep-alive.ymlkeeps Supabase active.




