How prodip-shadow/digital-life-lessons works
1. This is a Next.js App Router application with a clear separation between public-facing pages, authenticated dashboard pages, and API route handlers. The app lives under src/app, with layout.jsx files defining global and section-level shells.
2. The route structure is split into two main UI zones:
- (common): landing and browse-oriented pages such as the homepage, “browse wisdom,” profile viewing, and upgrade messaging.
- (dashboard): authenticated product areas like adding lessons, editing lessons, favorites, earnings history, my lessons, and an admin panel.
3. The core domain appears to be “lessons” or “wisdom” content. That domain is surfaced both in the public browsing experience and in the dashboard where creators manage their own content. The presence of browse-wisdom/[id], lesson editing, likes, comments, and favorites suggests a content marketplace/community model.
4. Server-side API routes are the main integration boundary. The src/app/api/lessons tree provides CRUD-style lesson endpoints plus interaction endpoints for likes, favorites, comments, and a “today-count” metric. This is likely the primary data access layer used by the UI pages.
5. Authentication is handled as a dedicated backend concern under src/app/api/auth/[...all]/route.js, with client/server helper modules in src/lib/auth-client.js and src/lib/auth.js. The proxy.js file likely protects certain routes or performs request-time auth gating for the dashboard/admin areas.
6. Payments and premium access are a separate subsystem. There is a checkout route, a checkout verification route, a Stripe webhook handler, a payment success page, and a scripts/update-premium.js maintenance script. Together these imply an external payment provider updates user entitlements, probably premium status or access unlocks.
7. User and analytics data are exposed through dedicated endpoints:
- api/users/[id] for user profile data
- api/dashboard/metrics for creator-facing stats
- api/admin/metrics for administrative reporting
- api/dashboard/favorites and api/dashboard/earnings-history for personalized account views
This indicates separate metric scopes for end users versus admins.
8. The data persistence boundary is centralized in src/lib/db.js, which likely contains the database client/connection used by route handlers. From the file layout, server routes are the main consumers of persistence rather than client components talking directly to storage.
9. The UI is built from a small set of reusable component families under src/components: navbar, footer, sidebar, cards, buttons, forms, loader, and homepage-specific sections like hero, marquee, pillars, and featured lessons. This suggests a design-system-like component layer rather than page-specific duplication.
10. Styling and presentation are handled with the standard Next.js stack plus a global stylesheet (src/app/globals.css) and PostCSS config. There is also a shader background component and a /shader page, which looks like a visual/experimental feature isolated from the main product flow.
11. Public authentication pages are separate from the dashboard: /sign-in and /sign-up live alongside the main app rather than inside the dashboard group. That keeps the auth entry points lightweight and outside the protected workspace.
12. The overall request flow is: browser hits a page route, the page composes shared components, and any interactive or data-heavy action goes through the matching API route. Payments, auth, content management, and analytics are all mediated server-side, which keeps the client layer mostly presentational and interaction-oriented.
13. Operationally, this is a Vercel-friendly Next.js project with standard package/tooling files and a repository-local script for premium updates. The architecture is optimized for serverless route handlers, authenticated dashboard views, and external webhook-driven state changes.
Main entry points: (common)/layout.jsx Public shell · (dashboard)/layout.jsx Dashboard shell · db.js Database · route.js Lessons API
Components 34
Public UI
Landing, browse, profile, auth entry pages, and experimental views.
- App shell · Global app layout and top-level shell for all routes.
src/app/layout.jsx - Public shell · Layout for the common public-facing route group.
src/app/(common)/layout.jsx - Home · Public homepage and entry point.
src/app/(common)/page.jsx - Browse · Public lesson browsing and discovery list.
src/app/(common)/browse-wisdom/page.jsx - Lesson view · Public lesson detail view with social interaction context.
src/app/(common)/browse-wisdom/[id]/page.jsx - Profile · Public profile view for a specific user.
src/app/(common)/profile/[id]/page.jsx - Upgrade · Public upgrade messaging and premium conversion entry.
src/app/(common)/upgrade/page.jsx - Sign in · Public sign-in entry point.
src/app/sign-in/page.jsx - Sign up · Public sign-up entry point.
src/app/sign-up/page.jsx - Payment done · Post-payment success page.
src/app/payment-success/page.jsx - Shader demo · Isolated shader/visual experiment page.
src/app/shader/page.jsx
Dashboard UI
Protected creator/admin workspace and account management pages.
- Dashboard shell · Layout for the protected dashboard route group.
src/app/(dashboard)/layout.jsx - Dashboard · Authenticated dashboard landing page.
src/app/(dashboard)/dashboard/page.jsx - Add lesson · Dashboard page for creating lessons.
src/app/(dashboard)/add-lesson/page.jsx - Edit lesson · Dashboard page for editing a specific lesson.
src/app/(dashboard)/dashboard/edit-lesson/[id]/page.jsx - My lessons · Dashboard page for owned lessons.
src/app/(dashboard)/dashboard/my-lessons/page.jsx - Favorites · Dashboard page for saved lessons.
src/app/(dashboard)/dashboard/favorites/page.jsx - Earnings · Dashboard page for earnings history.
src/app/(dashboard)/dashboard/earnings-history/page.jsx - Admin panel · Administrative dashboard page.
src/app/(dashboard)/admin-panel/page.jsx
API & Backend
Route handlers, auth, persistence, payments, and server-side integration points.
- Lessons API · Primary lesson collection endpoints for create, read, update, and delete.
src/app/api/lessons/route.js - Lesson API · Per-lesson read and update endpoint.
src/app/api/lessons/[id]/route.js - Lesson actions · Like, favorite, comment, and daily-count endpoints for lessons.
src/app/api/lessons/[id]/comments/route.js - Users API · User profile data endpoint.
src/app/api/users/[id]/route.js - Creator metrics · Dashboard-scoped metrics endpoint.
src/app/api/dashboard/metrics/route.js - Dashboard favorites · Authenticated favorites endpoint for dashboard views.
src/app/api/dashboard/favorites/route.js - Admin metrics · Administrative metrics endpoint.
src/app/api/admin/metrics/route.js - Auth API · Catch-all authentication backend route.
src/app/api/auth/[...all]/route.js - Checkout API · Payment checkout initiation endpoint.
src/app/api/checkout/route.js - Verify payment · Checkout verification and entitlement update endpoint.
src/app/api/checkout/verify/route.js - Stripe webhook · External payment-provider webhook handler.
src/app/api/webhooks/stripe/route.js - Database · Central database connection and persistence helper.
src/lib/db.js - Auth server · Server-side auth helpers and session logic.
src/lib/auth.js - Auth client · Client-side auth helper module.
src/lib/auth-client.js - Route proxy · Request-time protection and routing guard for protected areas.
src/proxy.js
Connections 47
- App shell → Public shell: wraps · Global shell delegates into the public route group layout.
- App shell → Dashboard shell: wraps · Global shell delegates into the protected dashboard layout.
- Public shell → Home: serves · Public layout frames the landing page.
- Public shell → Browse: serves · Public layout frames browsing.
- Public shell → Lesson view: serves · Public layout frames lesson detail pages.
- Public shell → Profile: serves · Public layout frames profile viewing.
- Public shell → Upgrade: serves · Public layout frames upgrade messaging.
- Public shell → Sign in: serves · Public layout includes sign-in entry.
- Public shell → Sign up: serves · Public layout includes sign-up entry.
- Public shell → Payment done: serves · Public layout includes checkout success page.
- Public shell → Shader demo: serves · Public layout includes the isolated visual page.
- Dashboard shell → Dashboard: serves · Dashboard layout frames the workspace landing page.
- Dashboard shell → Add lesson: serves · Dashboard layout frames lesson creation.
- Dashboard shell → Edit lesson: serves · Dashboard layout frames lesson editing.
- Dashboard shell → My lessons: serves · Dashboard layout frames owned lessons.
- Dashboard shell → Favorites: serves · Dashboard layout frames saved lessons.
- Dashboard shell → Earnings: serves · Dashboard layout frames earnings views.
- Dashboard shell → Admin panel: serves · Dashboard layout frames admin tools.
- Home → Lessons API: loads content · Homepage surfaces featured lessons and browse content.
- Browse → Lessons API: lists · Browse page reads lesson collection data.
- Lesson view → Lesson API: reads · Lesson view loads a single lesson.
- Lesson view → Lesson actions: interacts · Lesson detail uses social actions and counts.
- Profile → Users API: loads · Profile page reads user data.
- Add lesson → Lessons API: creates · Creator form posts new lessons.
- Edit lesson → Lesson API: updates · Lesson editor saves changes to a specific lesson.
- My lessons → Lessons API: manages · Owned lessons list is backed by lesson CRUD data.
- Favorites → Dashboard favorites: loads · Saved lessons view reads dashboard favorites.
- Earnings → Creator metrics: loads · Earnings history is paired with creator metrics.
- Admin panel → Admin metrics: loads · Admin panel consumes administrative reporting.
- Sign in → Auth API: authenticates · Sign-in is backed by the auth route handler.
- Sign up → Auth API: authenticates · Sign-up is backed by the auth route handler.
- Payment done → Verify payment: confirms · Success page aligns with checkout verification.
- Upgrade → Checkout API: starts checkout · Upgrade flow initiates payment checkout.
- Checkout API → Stripe webhook: completes via · Checkout state is finalized through webhook-driven updates.
- Stripe webhook → Database: persists · Webhook updates payment and entitlement state in storage.
- Lessons API → Database: reads/writes · Lesson CRUD is backed by the database layer.
- Lesson API → Database: reads/writes · Single-lesson route persists lesson changes.
- Lesson actions → Database: records · Interactions are stored through the database layer.
- Users API → Database: reads · User profiles are read from storage.
- Creator metrics → Database: aggregates · Creator metrics are computed from persisted data.
- Dashboard favorites → Database: reads · Dashboard favorites come from storage.
- Admin metrics → Database: aggregates · Admin metrics are computed from persisted data.
- Auth API → Auth server: uses · Auth backend delegates to server-side auth helpers.
- Auth server → Database: sessions · Server auth state depends on persistence.
- Auth client → Auth API: calls · Client auth helper talks to the auth backend.
- Route proxy → Dashboard shell: guards · Request-time proxy protects dashboard routes.
- Route proxy → Admin panel: guards · Proxy also protects admin access.