docs: add documentation for TikTok cron polling, Discord utilities, and cron container updates

This commit is contained in:
2026-07-03 21:26:23 +07:00 Unverified
parent 96b7ce11c0
commit a0eac6ce1e
+4 -1
View File
@@ -145,6 +145,7 @@ Erika is a Next.js website for the content creator "Erika!". It has two main fea
| `BASE_URL` | Public base URL, used in metadata/SEO |
| `DISCORD_CLIENT_ID` / `DISCORD_CLIENT_SECRET` | Discord OAuth app credentials for user login |
| `ADMIN_DISCORD_IDS` | **Comma-separated list of Discord user IDs that have admin access.** These users can access `/admin/form` to create, edit, and delete forms. Any Discord user NOT in this list is treated as a regular user. |
| `CRON_SECRET` | Secret key to authorize the automated `/api/cron/tiktok` polling endpoint |
| `DISCORD_BOT_TOKEN` | Bot token used to fetch Discord server member count |
| `DISCORD_GUILD_ID` | Discord server ID to fetch member count from |
| `YOUTUBE_API_KEY` / `YOUTUBE_CHANNEL_ID` | YouTube Data API credentials to fetch subscriber count |
@@ -163,6 +164,7 @@ Erika is a Next.js website for the content creator "Erika!". It has two main fea
| `lib/config.ts` | **Linktree configuration for the root page (`/`).** Defines the profile (name, description, avatar) and the list of social links (Roblox, Discord, TikTok, YouTube) displayed on the landing page. Also defines `config_p2` which adds the Form link. This does NOT configure the form system. |
| `lib/icons.tsx` | SVG icon components for social platforms (Roblox, Discord, TikTok, YouTube, Form) |
| `lib/redis.ts` | Redis client singleton using Bun's built-in `RedisClient`. Used for caching follower counts (1hr TTL) and tracking unique visitors. |
| `lib/discord.ts` | Shared Discord webhook notification utilities |
| `lib/utils.ts` | Utility functions (e.g. `cn()` for className merging) |
### `lib/followers/` — Follower Count Fetchers
@@ -244,6 +246,7 @@ Erika is a Next.js website for the content creator "Erika!". It has two main fea
| `app/api/auth/[...nextauth]/route.ts` | NextAuth.js configuration with Discord OAuth provider. Exports `authOptions`. |
| `app/api/auth/tiktok/route.ts` | Initiates TikTok OAuth flow (one-time setup to get tokens) |
| `app/api/auth/tiktok/callback/route.ts` | TikTok OAuth callback handler |
| `app/api/cron/tiktok/route.ts` | TikTok polling endpoint. Checks TikWM for new organic videos and notifies Discord. Triggered every 5 mins by the `erika-cron` Docker container. |
| `app/api/upload/route.ts` | File upload endpoint (admin-only, checks `ADMIN_DISCORD_IDS`) |
#### `app/actions/` — Server Actions
@@ -273,7 +276,7 @@ Erika is a Next.js website for the content creator "Erika!". It has two main fea
| File | Purpose |
|---|---|
| `drizzle.config.ts` | Drizzle Kit config — points to schema, outputs to `drizzle/`, uses schemas: `public`, `account`, `form` |
| `docker-compose.yml` | Runs the app + Nginx reverse proxy via Docker Compose with `network_mode: host` |
| `docker-compose.yml` | Runs the app, Nginx reverse proxy, and a self-pinging `erika-cron` container via Docker Compose with `network_mode: host` |
| `proxy.ts` | Replaces `middleware.ts` in modern Next.js. Currently a pass-through for `/form/:path*` routes — auth is handled via dialog in the layout, not here. |
| `nginx.conf` | Nginx config for reverse proxying to the Next.js app |
| `next.config.ts` | Next.js configuration |