AI-powered notes and blogging platform built with Next.js 15, featuring subscription management, rich text editing, and modern SaaS architecture.
- π Landing Page: https://snackstack-gold.vercel.app/
- π οΈ Admin Blog Management: https://snackstack-gold.vercel.app/admin
- π€ User Dashboard Login: https://snackstack-gold.vercel.app/sign-in
- πΊοΈ Sitemap: https://snackstack-gold.vercel.app/sitemap.xml
- π§ AI-Powered Notes - Intelligent content suggestions with Google Gemini API
- π€ AI Chat Assistant - Streaming in-note chat with Gemini (primary) and OpenAI fallback
- π Rich Text Editor - TipTap with markdown support and syntax highlighting
- π Blog Management - Full admin dashboard for blog posts
- π³ Stripe Payments - Subscription management with trial periods and billing
- π Authentication - Google OAuth via NextAuth.js v5 with Prisma adapter
- π Analytics - PostHog integration for user tracking
- ποΈ Database - PostgreSQL with Prisma ORM
- π File Storage - Cloudinary and Appwrite for images and media
- π Dark Mode - System-aware theme switching with next-themes
- π¨ 3D & Animation - Three.js scenes with GSAP, Lenis smooth scroll, and Framer Motion
- π± Responsive - Mobile-first design with Tailwind CSS
- π§ͺ Testing - Jest + React Testing Library for unit/integration, Playwright for E2E
- Framework: Next.js 15.5 with App Router & React 19
- Language: TypeScript 5
- Styling: Tailwind CSS v4, Radix UI, Framer Motion
- Database: PostgreSQL with Prisma ORM
- Auth: NextAuth.js v5 with Google OAuth
- Payments: Stripe with subscription tiers and trials
- Storage: Cloudinary, Appwrite
- AI: Google Gemini API (primary), OpenAI (fallback)
- Analytics: PostHog
- State: Zustand, TanStack Query
- Editor: TipTap with markdown, code highlighting, images, and links
- 3D: Three.js, React Three Fiber, postprocessing
- Animation: GSAP, Lenis smooth scroll
- Testing: Jest, React Testing Library, Playwright, MSW
- Validation: Zod
Before you begin, ensure you have the following installed:
- Node.js 18.17 or later
- pnpm (recommended) or npm/yarn
- PostgreSQL database (local or cloud)
- Git for version control
git clone https://github.com/marufk21/snackstack.git
cd snackstackpnpm install
# or
npm install
# or
yarn installCreate a .env.local file in the root directory:
# Database
DATABASE_URL="postgresql://username:password@localhost:5432/snackstack?schema=public"
# NextAuth.js (Generate AUTH_SECRET with: openssl rand -base64 32)
AUTH_SECRET="your_auth_secret_key"
AUTH_GOOGLE_ID="your_google_oauth_client_id"
AUTH_GOOGLE_SECRET="your_google_oauth_client_secret"
NEXTAUTH_URL="http://localhost:3000"
# Cloudinary
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME="your_cloud_name"
NEXT_PUBLIC_CLOUDINARY_API_KEY="your_cloudinary_api_key"
NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET="your_upload_preset"
CLOUDINARY_API_SECRET="your_cloudinary_api_secret"
# Appwrite
NEXT_PUBLIC_APPWRITE_ENDPOINT="https://cloud.appwrite.io/v1"
NEXT_PUBLIC_APPWRITE_PROJECT_ID="your_project_id"
NEXT_PUBLIC_APPWRITE_DATABASE_ID="your_database_id"
NEXT_PUBLIC_APPWRITE_COLLECTION_ID="your_collection_id"
NEXT_PUBLIC_APPWRITE_BUCKET_ID="your_bucket_id"
# Google Gemini AI (primary)
GEMINI_API_KEY="your_gemini_api_key"
# OpenAI (fallback for AI chat)
OPENAI_API_KEY="your_openai_api_key"
# Stripe
STRIPE_SECRET_KEY="your_stripe_secret_key"
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="your_stripe_publishable_key"
STRIPE_WEBHOOK_SECRET="your_stripe_webhook_secret"
STRIPE_PRICE_ID_BASIC="price_id_for_basic_tier"
STRIPE_PRICE_ID_PRO="price_id_for_pro_tier"
STRIPE_PRICE_ID_ENTERPRISE="price_id_for_enterprise_tier"
NEXT_PUBLIC_STRIPE_PRICE_ID_BASIC="price_id_for_basic_tier"
NEXT_PUBLIC_STRIPE_PRICE_ID_PRO="price_id_for_pro_tier"
NEXT_PUBLIC_STRIPE_PRICE_ID_ENTERPRISE="price_id_for_enterprise_tier"
# PostHog
NEXT_PUBLIC_POSTHOG_KEY="your_posthog_project_key"
NEXT_PUBLIC_POSTHOG_HOST="https://us.i.posthog.com"
# Cron Jobs (protects /api/cron routes)
CRON_SECRET="your_cron_secret"
# Blog Admin (superuser credentials for /admin/blogs-dashboard)
NEXT_PUBLIC_ADMIN_ID="admin_user_id"
NEXT_PUBLIC_ADMIN_PASSWORD="admin_password"
# App URL
NEXT_PUBLIC_APP_URL="http://localhost:3000"- Database: Use Supabase, Neon, or local PostgreSQL
- Google OAuth: Get credentials from Google Cloud Console
- Cloudinary: Create account at cloudinary.com for media storage
- Appwrite: Create account at appwrite.io and set up project
- Stripe: Get API keys from Stripe Dashboard
- Gemini API: Get key from Google AI Studio (primary AI provider)
- OpenAI API (optional): Get key from OpenAI β fallback for AI chat when Gemini is rate-limited
- PostHog: Sign up at posthog.com
pnpm prisma generate --schema=server/db/schema.prisma
pnpm prisma migrate dev --schema=server/db/schema.prisma
pnpm db:seed # Optional: seed with sample datapnpm devOpen http://localhost:3000 to see your application.
# Development
pnpm dev # Start development server (Turbopack)
pnpm build # Build for production (Turbopack)
pnpm start # Start production server
# Testing
pnpm test # Run Jest unit & integration tests
pnpm test:e2e # Run Playwright E2E tests
# Database
pnpm prisma generate --schema=server/db/schema.prisma
pnpm prisma migrate dev --schema=server/db/schema.prisma
pnpm prisma studio --schema=server/db/schema.prisma
pnpm db:seed # Seed database
pnpm db:reset # Reset and reseedsnackstack/
βββ app/ # Next.js App Router (routes only)
β βββ (auth)/sign-in/ # Sign-in page
β βββ (dashboard)/app/ # Protected dashboard (/app/*)
β β βββ admin/ # Debug/sync admin pages
β β βββ pricing/ # Pricing page
β β βββ subscription/ # Subscription management
β βββ (landing)/ # Public pages
β β βββ admin/blogs-dashboard/# Blog admin (new, edit, view)
β β βββ blogs/ # Public blog listing & details
β βββ api/ # API route handlers
β β βββ ai/ # AI chat (streaming SSE) + suggestions
β β βββ auth/ # NextAuth handlers
β β βββ cron/ # Scheduled subscription checks
β β βββ notes/ # Notes CRUD
β β βββ stripe/ # Stripe checkout, portal, webhooks
β β βββ subscription/ # Subscription lifecycle
β β βββ upload/ # Cloudinary file uploads
β βββ globals.css # Global styles
β βββ layout.tsx # Root layout + metadata
β βββ not-found.tsx # 404 page
β
βββ components/
β βββ ui/ # Reusable primitives (shadcn/ui + custom)
β βββ shared/ # App-level components (auth, error-boundary)
β βββ landing/ # Landing page sections
β βββ dashboard/ # Dashboard feature components
β
βββ server/ # Backend code
β βββ api/ # Client-side Axios API wrappers
β βββ auth/ # NextAuth v5 configuration
β βββ db/ # Prisma schema, client, seed, config
β βββ integrations/ # Third-party services
β β βββ appwrite/ # Appwrite blog CMS
β β βββ cloudinary/ # Cloudinary image upload
β β βββ stripe/ # Stripe payments
β βββ services/ # Business logic (langchain, subscription, user, notes)
β βββ utils/ # Server utilities (rate-limit, api-protection, plan-limits)
β
βββ lib/ # Client-side utilities & configs
β βββ cn.ts # Tailwind class merge utility
β βββ query-client.ts # TanStack Query config
β βββ stripe-client.ts # Client-safe Stripe config
β βββ pricing.ts # Pricing tier definitions
β βββ app-config.ts # App configuration & env validation
β
βββ hooks/ # Shared React hooks
βββ providers/ # React context providers (Query, PostHog, Theme, Lenis, Framer)
βββ stores/ # Zustand store (theme, user, sidebar)
βββ types/ # TypeScript type declarations
βββ __tests__/ # Jest + Playwright test suites
βββ public/ # Static assets (images, icons, manifest)
β
βββ middleware.ts # Auth route protection
βββ next.config.ts # Next.js + Turbopack config
βββ package.json
- Push code to GitHub
- Import on Vercel
- Add environment variables
- Deploy!
Also works on Netlify, Railway, Render, and other Next.js-compatible platforms.
Contributions are welcome! Please:
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
MIT License - see LICENSE file for details.
Built with β€οΈ using Next.js 15 and modern web technologies





