How gomezsergio3002-afk/mimo-gift works
Purpose and Runtime
A Next.js 15 TypeScript application combining a SaaS subscription starter with a personalized gift-creation experience. It runs as a React/Next App Router service, styled with Tailwind and shadcn/ui, and is intended for Vercel deployment. Global application composition begins at src/app/layout.tsx; request/session handling is centralized in src/middleware.ts.
Route Domains and Entry Points
Public marketing routes use the site group: src/app/(site)/page.tsx and src/app/(site)/pricing/page.tsx. Authentication is isolated under src/app/(auth)/login/page.tsx, with Supabase callback completion at src/app/(auth)/auth/callback/route.ts. Signed-in account functionality is under src/app/(account)/account/page.tsx. Gift creation and rendering are separately entered through src/app/gift-wizard/page.tsx and src/app/gift-preview/page.tsx.
Authentication and Account Boundary
Supabase provides authentication and Postgres persistence. Server, admin, and middleware-scoped clients are deliberately separated in src/libs/supabase/supabase-server-client.ts, src/libs/supabase/supabase-admin.ts, and src/libs/supabase/supabase-middleware-client.ts. Account controllers encapsulate user/session/customer/subscription lookup and persistence, especially src/features/account/controllers/get-session.ts, src/features/account/controllers/get-subscription.ts, and src/features/account/controllers/upsert-user-subscription.ts.
Billing and Stripe Synchronization
Pricing UI obtains locally synchronized products, then invokes a checkout server action: src/features/pricing/controllers/get-products.ts, src/features/pricing/actions/create-checkout-action.ts, and src/features/pricing/components/pricing-section.tsx. Stripe integration is privileged behind src/libs/stripe/stripe-admin.ts. Stripe events enter through src/app/api/webhooks/route.ts, which is the critical external trust boundary: verified webhook payloads synchronize products, prices, customers, and subscription state into Supabase. The customer portal is exposed by src/app/(account)/manage-subscription/route.ts.
Gift Authoring and Presentation
The gift feature is a client-facing multi-step authoring flow. src/features/gift/wizard/wizard.tsx coordinates steps, navigation, preview, and publication-oriented UI; individual content stages live in paths such as src/features/gift/wizard/steps/step-fotos.tsx and src/features/gift/wizard/steps/step-musica.tsx. Shared gift state shape/defaults are defined by src/features/gift/models/gift-schema.ts and src/features/gift/models/defaults.ts. Final presentation is composed from sectional components through src/features/gift/components/gift-page.tsx, including photos, music, messages, activities, vouchers, and wheel content.
Persistence and Schema Ownership
Database schema is owned through Supabase migrations, beginning with supabase/migrations/20240115041359_init.sql; local bootstrap data is in supabase/seed.sql. Stripe catalog bootstrap is externalized in stripe-fixtures.json, then converges into Supabase via webhook processing. Feature controllers, rather than route components, should remain the boundary for database and Stripe-side mutations.
Supporting External Services
Resend is the transactional email provider, accessed through src/libs/resend/resend-client.ts; email templates are feature-owned, e.g. src/features/emails/welcome.tsx. Required runtime secrets cover Supabase public/service credentials, Stripe publishable/secret/webhook credentials, and Resend API access, documented by .env.local.example.
Main entry points: supabase-server-client.ts Supabase client boundary · get-session.ts Account controllers · page.tsx Account area · wizard.tsx Gift wizard
Components 19
Next.js runtime
- App composition
src/app/layout.tsx - Session middleware
src/middleware.ts - Account controllers · Session, customer, and subscription persistence boundary.
src/features/account/controllers/get-session.ts
Route domains
- Marketing & auth · Site, pricing, and login entry points.
src/app/(site)/page.tsx - Account area · Account page and subscription management endpoint.
src/app/(account)/account/page.tsx - Gift routes · Wizard and final preview entry points.
src/app/gift-wizard/page.tsx - Auth callback
src/app/(auth)/auth/callback/route.ts
Billing
- Pricing section
src/features/pricing/components/pricing-section.tsx - Checkout action
src/features/pricing/actions/create-checkout-action.ts - Stripe webhook · Verified external event trust boundary.
src/app/api/webhooks/route.ts - Stripe admin
src/libs/stripe/stripe-admin.ts
Gift experience
- Gift wizard · Coordinates multi-step authoring, preview, and publication UI.
src/features/gift/wizard/wizard.tsx - Gift content steps · Photo and music stages represent authoring inputs.
src/features/gift/wizard/steps/step-fotos.tsx - Gift state model
src/features/gift/models/gift-schema.ts - Gift presentation · Renders photos, music, messages, activities, vouchers, and wheel.
src/features/gift/components/gift-page.tsx
Data & external services
- Supabase client boundary · Separate server, admin, and middleware clients.
src/libs/supabase/supabase-server-client.ts - Supabase Auth & Postgres
supabase/migrations/20240115041359_init.sql - Stripe
stripe-fixtures.json - Transactional email · Feature-owned templates send through Resend.
src/libs/resend/resend-client.ts
Connections 20
- App composition → Marketing & auth: composes
- Session middleware → Supabase client boundary: refreshes session
- Session middleware → Account area: guards
- Auth callback → Supabase client boundary: completes auth
- Account area → Account controllers: uses
- Account controllers → Supabase client boundary: queries via
- Supabase client boundary → Supabase Auth & Postgres: auth & persistence
- Marketing & auth → Pricing section: renders
- Pricing section → Checkout action: starts checkout
- Checkout action → Stripe admin: creates session
- Stripe admin → Stripe: API access
- Stripe → Stripe webhook: signed events
- Stripe webhook → Supabase Auth & Postgres: syncs catalog & subscriptions
- Account area → Stripe admin: customer portal
- Gift routes → Gift wizard: authors
- Gift wizard → Gift content steps: drives
- Gift content steps → Gift state model: updates
- Gift wizard → Gift presentation: previews
- Gift state model → Gift presentation: supplies content
- Account controllers → Transactional email: triggers transactional mail