This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a ShipFast boilerplate - a Next.js (App Router) SaaS starter with integrated authentication, payments, email, and database functionality. Built for rapid MVP development.
# Development
npm run dev # Start dev server on localhost:3000
# Building
npm run build # Build for production
npm run postbuild # Auto-runs after build - generates sitemap
# Production
npm start # Start production server
# Linting
npm run lint # Run ESLint- app/: Next.js App Router pages and API routes
- api/: Server-side API endpoints
auth/[...nextauth]/route.js: NextAuth.js authentication handlerlead/route.js: Lead capture endpointstripe/: Stripe checkout and portal creationwebhook/stripe/route.js: Stripe webhook handler for payment events
- blog/: Blog system with dynamic routes (articles, authors, categories)
- dashboard/: Protected user dashboard
layout.js: Root layout with global SEO tags and theme configurationpage.js: Landing page
- api/: Server-side API endpoints
All components live in /components and are imported using the @/ alias.
Key Components:
- ButtonCheckout: Triggers Stripe checkout sessions
- ButtonSignin: Handles authentication flow
- ButtonAccount: User account dropdown menu
- LayoutClient: Client-side wrapper containing Crisp chat, toasts, and tooltips
Landing Page Components:
- Hero, Features (Grid/Accordion/Listicle), Testimonials, FAQ, Pricing, CTA, Footer
- next-auth.js: Authentication configuration (Google OAuth + Email)
- stripe.js: Stripe integration (checkout, portal, session retrieval)
- api.js: Axios client for frontend API calls with auth interceptors
- mongoose.js: MongoDB connection handler
- mongo.js: MongoDB native client (for NextAuth adapter)
- seo.js: SEO metadata generator
- resend.js: Email service client
- User.js: User schema with Stripe integration (customerId, priceId, hasAccess)
- Lead.js: Lead capture schema
- plugins/toJSON.js: Mongoose plugin for JSON serialization
config.js - Central configuration file containing:
- App metadata (name, description, domain)
- Stripe plans and pricing
- Authentication URLs
- Email settings (Resend)
- Crisp chat configuration
- DaisyUI theme settings
Environment Variables (see .env.example):
NEXTAUTH_URL&NEXTAUTH_SECRET: AuthenticationGOOGLE_ID&GOOGLE_SECRET: Google OAuthMONGODB_URI: Database connectionSTRIPE_PUBLIC_KEY,STRIPE_SECRET_KEY,STRIPE_WEBHOOK_SECRET: PaymentsRESEND_API_KEY: Email service
- NextAuth.js handles auth via Google OAuth or Email (magic links)
- MongoDB adapter stores user sessions and accounts
- Session strategy: JWT
- Protected routes check session in
libs/api.jsinterceptor - On 401: redirects to login with
callbackUrlfromconfig.js
- User clicks
<ButtonCheckout />with a priceId - Frontend calls
/api/stripe/create-checkout - User completes payment on Stripe
- Stripe webhook (
/api/webhook/stripe) receives events checkout.session.completed: Setsuser.hasAccess = truecustomer.subscription.deleted: Setsuser.hasAccess = false- User model fields:
customerId,priceId,hasAccess
- Uses both Mongoose (for app models) and MongoDB native client (for NextAuth)
- Connection established in
libs/mongoose.jsandlibs/mongo.js - Models use singleton pattern:
mongoose.models.User || mongoose.model("User", userSchema)
- Tailwind CSS with DaisyUI component library
- Theme configured in
config.js(light/dark) - Custom animations in
tailwind.config.js: opacity, appearFromRight, wiggle, popup, shimmer - Global styles in
app/globals.css
- Default SEO tags set in root
layout.jsviagetSEOTags()fromlibs/seo.js - Override per page by passing params to
getSEOTags() - Sitemap auto-generated via
next-sitemapin postbuild script
When writing HTML or React components, add START/END comments for major sections:
{/* Hero START */}
<section className="hero">
...
</section>
{/* Hero END */}
{/* Footer START */}
<footer>
...
</footer>
{/* Footer END */}- Never commit sensitive data: All secrets go in
.env.local(gitignored) - Stripe plans: Define in
config.jsand ensure priceIds match Stripe dashboard - MongoDB required: For authentication and user management
- Image domains: Whitelist in
next.config.jsfor Next.js<Image>component - Path alias:
@/maps to root directory (configured injsconfig.json)