7.1 KiB
7.1 KiB
Wallora Searcher Project Reference
Snapshot
- Root:
/Users/luoyangwei/Documents/workspace/wallora.top/searcher - Package:
searcher - Framework: Next.js
16.2.6with App Router - React:
19.2.4 - Styling: Tailwind CSS v4 via
@import "tailwindcss"; - TypeScript: enabled
- Package manager:
pnpm - Git: this directory is not currently a Git repository
- Intended UI system: shadcn/ui
- Intended data store: Supabase with
wg_table prefixes for project-owned tables - Intended image store: Aliyun OSS
- Intended auth foundation: NextAuth plus JWT authorization for public APIs
- Intended API documentation:
swagger.yaml
Important Files
app/layout.tsx: root HTML shell, metadata, body layout classes, CSS-variable font tokensapp/(site)/page.tsx: public website home pageapp/(admin)/admin/login/page.tsx: public admin login pageapp/(admin)/admin/(protected)/...: admin pages that require a NextAuth sessionapp/(admin)/admin/(protected)/gallery/page.tsx: admin gallery picker with picked/color filtersapp/(admin)/admin/(protected)/collections/page.tsx: admin collections CRUD surfacecomponents/admin/collections/CollectionsManager.tsx: create/edit/delete published collections from picked photosapp/api/admin/gallery-photos/route.ts: protected admin gallery list and pick/unpick endpointapp/api/admin/photo-collections/route.ts: protected admin collection list/create APIapp/api/admin/photo-collections/[id]/route.ts: protected admin collection read/update/delete APIapp/api/v1/gallery/photos/route.ts: public picked-photo API for waterfall paginationapp/api/v1/gallery/photos/[id]/route.ts: public picked-photo detail API plus favorite/unfavorite shortcutapp/api/v1/gallery/collections/route.ts: public published collection list APIapp/api/v1/gallery/collections/[slug]/route.ts: public published collection detail API with paginated photosapp/api/v1/auth/register/route.ts: app user email/password registrationapp/api/v1/auth/login/route.ts: app user email/password login and Bearer JWT issuanceapp/api/v1/users/me/route.ts: current app user profile from Bearer JWTapp/api/v1/users/me/favorites/...: app user favorites list/add/remove APIsapp/api/v1/users/me/settings/route.ts: app user preferences and download preferences APIsapp/(admin)/admin/(protected)/users/page.tsx: protected admin app user listcomponents/admin/users/UsersManager.tsx: admin app user list with enable/disable actionsapp/api/admin/app-users/[id]/route.ts: protected admin app user status update APIapp/api/cron/gallery-photos/route.ts: protected gallery sync trigger endpointapp/globals.css: Tailwind import, CSS variables for background/foreground, font theme tokenspackage.json: scripts and dependenciesnext.config.ts: Next.js configpublic/: starter SVG assets from create-next-appswagger.yaml: create or update when public API contracts are introduced or changedsupabase/migrations/: SQL migration scripts, includingwg_gallery tablesscripts/sync-gallery-photos.mjs: one-shot gallery sync script for server cron/process managers
Commands
pnpm dev
pnpm lint
pnpm build
pnpm start
pnpm sync:gallery
Use pnpm format:check, pnpm lint, and pnpm build for verification. Use pnpm sync:gallery only when intentionally touching the real Supabase database.
Current Baseline Notes
- The public home page still contains create-next-app starter content unless updated later.
- The admin dashboard uses shadcn
dashboard-01under/admin/dashboard. - The admin login page uses shadcn
login-03and NextAuth credentials under/admin/login. - The admin gallery supports picked/unpicked filters, color-family filters, pick/unpick actions, and OSS mirror status.
- The admin collections page supports create, edit, delete, publish/draft status, cover selection, and selecting photos from picked photos.
- Public photo consumption should use
/api/v1/gallery/photos, which returns picked photos only. - App photo detail should use
/api/v1/gallery/photos/{id}. Public callers can omit auth; authenticated callers receiveisFavoritedand canPOST/DELETEthe same route to favorite/unfavorite. - Public collection consumption should use
/api/v1/gallery/collectionsand/api/v1/gallery/collections/{slug}; collection photos are picked photos only. - App users register and login with email/password via
/api/v1/auth/registerand/api/v1/auth/login; the returned Bearer JWT is for public app APIs only. - App user favorites and settings live under
/api/v1/users/me/.... - Admins can review app users and enable/disable accounts under
/admin/users. - Bare
/dashboardand/loginroutes should stay absent; admin templates belong under/admin.
Coding Conventions
- Keep components typed with TypeScript and follow existing double-quote import style.
- Prefer server components unless client behavior is necessary.
- Put global tokens and truly global styles in
app/globals.css; keep page-specific styling near components with Tailwind classes. - Keep font tokens in CSS variables; avoid
next/font/googleunless the deployment environment can reliably fetch Google Fonts during build. - Avoid broad dependency additions for small UI tasks; use the platform and existing stack first.
- Use
pnpm dlx shadcn@latest ...for shadcn CLI tasks. - Verify current Supabase, NextAuth, and Aliyun OSS APIs before implementing auth-sensitive or storage-sensitive behavior.
- For database objects created by this app, use the
wg_prefix, e.g.wg_gallery_photos. - Do not read or print secrets from
.env.local; report only whether required variables are present. - This project is not targeting Vercel. Prefer server cron, process manager jobs, or external scheduler calls over
vercel.jsoncron config.
Design Conventions
- Replace starter content with domain-specific product UI when asked to build the app experience.
- Keep cards at
8pxradius or less unless a future design system says otherwise. - Do not nest cards inside cards.
- Avoid one-note palettes and generic purple/blue gradient-heavy layouts.
- Make text fit inside controls and panels at mobile and desktop widths.
Architecture Summary
- Public API: available to external users; use JWT login/authorization and document routes in
swagger.yaml. - Admin: account/password login; use NextAuth sessions to persist login state and gate admin features.
- Public website: open internet access; optimize for SEO, metadata, crawlability, and performance.
- Supabase stores application data with
wg_table prefixes; Aliyun OSS stores image files while Supabase stores image metadata. - Gallery photo ingestion writes to
wg_gallery_photosand tracks progress inwg_gallery_sync_state. - Picked photo metadata lives on
wg_gallery_photosviais_picked,picked_at,picked_by, andoss_*fields. - Collections live in
wg_photo_collectionsandwg_photo_collection_items. - App users/favorites/settings live in
wg_app_users,wg_user_favorites, andwg_user_settings; identity fields include email now and schema placeholders for phone/WeChat later.