├── src ├── components │ ├── layout │ │ ├── sections │ │ │ ├── services.tsx │ │ │ ├── sponsors.tsx │ │ │ ├── faq.tsx │ │ │ ├── testimonial.tsx │ │ │ ├── features.tsx │ │ │ ├── footer.tsx │ │ │ ├── pricing.tsx │ │ │ └── hero.tsx │ │ ├── theme-provider.tsx │ │ ├── toogle-theme.tsx │ │ ├── dashboard │ │ │ ├── contact-us.tsx │ │ │ ├── settings │ │ │ │ └── settings.tsx │ │ │ └── newsLetterform.tsx │ │ └── navbar.tsx │ ├── ui │ │ ├── icon.tsx │ │ ├── label.tsx │ │ ├── textarea.tsx │ │ ├── separator.tsx │ │ ├── input.tsx │ │ ├── RippleBackground.tsx │ │ ├── sonner.tsx │ │ ├── checkbox.tsx │ │ ├── TextAnimation.tsx │ │ ├── badge.tsx │ │ ├── Meteors.tsx │ │ ├── orbitingCircles.tsx │ │ ├── avatar.tsx │ │ ├── button.tsx │ │ ├── card.tsx │ │ ├── accordion.tsx │ │ ├── sheet.tsx │ │ ├── navigation-menu.tsx │ │ ├── select.tsx │ │ ├── carousel.tsx │ │ └── dropdown-menu.tsx │ ├── NavWrapper.tsx │ ├── utils │ │ ├── CheckoutButton.tsx │ │ └── AuthButton.tsx │ ├── Emails │ │ ├── WelcomeEmail.tsx │ │ ├── ReciptEmail.tsx │ │ └── NewsLetter.tsx │ └── Logos.tsx ├── app │ ├── favicon.ico │ ├── api │ │ ├── auth │ │ │ └── [...nextauth] │ │ │ │ ├── route.ts │ │ │ │ └── options.ts │ │ ├── cron │ │ │ ├── keep-alive │ │ │ │ └── route.ts │ │ │ ├── check-subscriptions │ │ │ │ └── route.ts │ │ │ └── sendEmails │ │ │ │ └── route.ts │ │ ├── newsletter │ │ │ └── route.ts │ │ └── webhook │ │ │ └── stripe │ │ │ └── route.ts │ ├── page.tsx │ ├── dashboard │ │ ├── settings │ │ │ └── page.tsx │ │ └── page.tsx │ ├── layout.tsx │ ├── globals.css │ └── send │ │ └── page.tsx ├── lib │ ├── upstash.ts │ ├── utils.ts │ ├── validators │ │ └── FormValidators.ts │ ├── UsersHelpers.ts │ ├── EmailHandler.ts │ ├── metadata.ts │ └── Stripe.ts ├── hooks │ ├── useUserAccess.ts │ └── useSignInModel.ts ├── types │ └── next-auth.d.ts ├── middleware │ └── authMeddleware.ts └── middleware.ts ├── .eslintrc.json ├── public ├── logos │ ├── logo.png │ ├── prisma.svg │ ├── stripe.svg │ ├── nextjs.svg │ ├── supabase.svg │ ├── next-auth.svg │ └── redis.svg ├── thumbnail.png ├── vercel.svg ├── next.svg └── README.md ├── prisma ├── migrations │ ├── migration_lock.toml │ ├── 20240628114017_init │ │ └── migration.sql │ └── 20240628114538_init │ │ └── migration.sql └── schema.prisma ├── vercel.json ├── postcss.config.mjs ├── next.config.mjs ├── components.json ├── .gitignore ├── tsconfig.json ├── .env.example ├── LICENSE ├── package.json ├── tailwind.config.ts └── README.md /src/components/layout/sections/services.tsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /src/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tejashVaishnav/Fast-saas-next.js-boilerplate/HEAD/src/app/favicon.ico -------------------------------------------------------------------------------- /public/logos/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tejashVaishnav/Fast-saas-next.js-boilerplate/HEAD/public/logos/logo.png -------------------------------------------------------------------------------- /public/thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tejashVaishnav/Fast-saas-next.js-boilerplate/HEAD/public/thumbnail.png -------------------------------------------------------------------------------- /prisma/migrations/migration_lock.toml: -------------------------------------------------------------------------------- 1 | # Please do not edit this file manually 2 | # It should be added in your version-control system (i.e. Git) 3 | provider = "postgresql" -------------------------------------------------------------------------------- /vercel.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 2, 3 | "crons": [ 4 | { 5 | "path": "/api/cron/keep-alive", 6 | "schedule": "0 0 * * *" 7 | } 8 | ] 9 | } -------------------------------------------------------------------------------- /postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /src/lib/upstash.ts: -------------------------------------------------------------------------------- 1 | import { Redis } from '@upstash/redis' 2 | 3 | export const redis = new Redis({ 4 | url: process.env.UPSTASH_URL!, 5 | token: process.env.UPSTASH_TOKEN!, 6 | }) 7 | -------------------------------------------------------------------------------- /src/app/api/auth/[...nextauth]/route.ts: -------------------------------------------------------------------------------- 1 | import NextAuth from "next-auth"; 2 | import { authOptions } from "./options"; 3 | 4 | const handler = NextAuth(authOptions); 5 | 6 | export { handler as GET, handler as POST }; 7 | -------------------------------------------------------------------------------- /next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | images: { 4 | domains: ["lh3.googleusercontent.com", "vercel.com","dragonicon.blob.core.windows.net"], 5 | }, 6 | 7 | }; 8 | 9 | export default nextConfig; 10 | -------------------------------------------------------------------------------- /src/hooks/useUserAccess.ts: -------------------------------------------------------------------------------- 1 | import { useSession } from 'next-auth/react' 2 | 3 | export function useUserAccess() { 4 | const { data: session } = useSession() 5 | 6 | return { 7 | isProUser: session?.user?.UserAccessLevel ?? false, 8 | isAuthenticated: !!session, 9 | } 10 | } -------------------------------------------------------------------------------- /src/components/layout/theme-provider.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import * as React from "react"; 4 | import { ThemeProvider as NextThemesProvider } from "next-themes"; 5 | import { type ThemeProviderProps } from "next-themes/dist/types"; 6 | 7 | export function ThemeProvider({ children, ...props }: ThemeProviderProps) { 8 | return {children}; 9 | } 10 | -------------------------------------------------------------------------------- /components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "default", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.ts", 8 | "css": "src/app/globals.css", 9 | "baseColor": "zinc", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils" 16 | } 17 | } -------------------------------------------------------------------------------- /src/components/ui/icon.tsx: -------------------------------------------------------------------------------- 1 | import { icons } from "lucide-react"; 2 | 3 | export const Icon = ({ 4 | name, 5 | color, 6 | size, 7 | className, 8 | }: { 9 | name: keyof typeof icons; 10 | color: string; 11 | size: number; 12 | className?: string; 13 | }) => { 14 | const LucideIcon = icons[name as keyof typeof icons]; 15 | 16 | return ; 17 | }; 18 | -------------------------------------------------------------------------------- /src/components/NavWrapper.tsx: -------------------------------------------------------------------------------- 1 | import { authOptions } from "@/app/api/auth/[...nextauth]/options"; 2 | import AuthButton from "@/components/utils/AuthButton"; 3 | import { Session, getServerSession } from "next-auth"; 4 | const NavWrapper = async() => { 5 | const userSession = await getServerSession(authOptions) 6 | return ( 7 | <> 8 | 9 | 10 | ); 11 | }; 12 | 13 | export default NavWrapper; 14 | -------------------------------------------------------------------------------- /src/hooks/useSignInModel.ts: -------------------------------------------------------------------------------- 1 | import { useState } from 'react'; 2 | 3 | const useSigninModal = () => { 4 | const [isOpen, setIsOpen] = useState(false); 5 | 6 | const openModal = () => setIsOpen(true); 7 | const closeModal = () => setIsOpen(false); 8 | const toggleModal = () => setIsOpen(prev => !prev); 9 | 10 | return { 11 | isOpen, 12 | openModal, 13 | closeModal, 14 | toggleModal, 15 | }; 16 | } 17 | 18 | export default useSigninModal; 19 | 20 | -------------------------------------------------------------------------------- /src/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { type ClassValue, clsx } from "clsx" 2 | import { twMerge } from "tailwind-merge" 3 | import { PrismaClient } from "@prisma/client"; 4 | declare global { 5 | var prisma: PrismaClient | undefined; 6 | } 7 | 8 | 9 | const prisma = global.prisma || new PrismaClient(); 10 | if (process.env.NODE_ENV === "development") global.prisma = prisma; 11 | export default prisma; 12 | 13 | export function cn(...inputs: ClassValue[]) { 14 | return twMerge(clsx(inputs)) 15 | } -------------------------------------------------------------------------------- /src/types/next-auth.d.ts: -------------------------------------------------------------------------------- 1 | import NextAuth from "next-auth" 2 | 3 | declare module "next-auth" { 4 | interface Session { 5 | user: { 6 | id: string 7 | name?: string | null 8 | email?: string | null 9 | image?: string | null 10 | UserAccessLevel: string 11 | } 12 | } 13 | 14 | interface User { 15 | UserAccessLevel: string 16 | } 17 | } 18 | 19 | declare module "next-auth/jwt" { 20 | interface JWT { 21 | UserAccessLevel: string 22 | } 23 | } -------------------------------------------------------------------------------- /src/lib/validators/FormValidators.ts: -------------------------------------------------------------------------------- 1 | import * as z from "zod"; 2 | 3 | export const formSchema = z.object({ 4 | name: z.string().min(2, { 5 | message: "Name must be at least 2 characters.", 6 | }), 7 | email: z.string().email({ 8 | message: "Please enter a valid email address.", 9 | }), 10 | query: z.string().min(10, { 11 | message: "Query must be at least 10 characters.", 12 | }), 13 | }); 14 | 15 | 16 | 17 | export const newsletterSchema = z.object({ 18 | email: z.string().email({ message: "Invalid email address" }), 19 | }); -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env 30 | todo.md 31 | 32 | # vercel 33 | .vercel 34 | 35 | # typescript 36 | *.tsbuildinfo 37 | next-env.d.ts 38 | -------------------------------------------------------------------------------- /public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["dom", "dom.iterable", "esnext"], 4 | "allowJs": true, 5 | "skipLibCheck": true, 6 | "strict": true, 7 | "noEmit": true, 8 | "esModuleInterop": true, 9 | "module": "esnext", 10 | "moduleResolution": "bundler", 11 | "resolveJsonModule": true, 12 | "isolatedModules": true, 13 | "typeRoots": ["./node_modules/@types", "./types"], 14 | "jsx": "preserve", 15 | "incremental": true, 16 | "plugins": [ 17 | { 18 | "name": "next" 19 | } 20 | ], 21 | "paths": { 22 | "@/*": ["./src/*"] 23 | } 24 | }, 25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 26 | "exclude": ["node_modules"] 27 | } 28 | -------------------------------------------------------------------------------- /src/lib/UsersHelpers.ts: -------------------------------------------------------------------------------- 1 | import { authOptions } from "@/app/api/auth/[...nextauth]/options"; 2 | import { getServerSession } from "next-auth"; 3 | import prisma from "./utils"; 4 | 5 | export async function isAutorizedto() { 6 | const session = await getServerSession(authOptions); 7 | 8 | if (session) { 9 | const user = await prisma.user.findFirst({ 10 | where: { email: session.user?.email }, 11 | }); 12 | 13 | if (!user?.stripeCurrentPeriodEnd) { 14 | return false; //means no access 15 | } 16 | const endDate = new Date(user.stripeCurrentPeriodEnd); 17 | const currentDate = new Date(); 18 | 19 | return !(endDate < currentDate); //if true then has access else no access 20 | } 21 | 22 | return false; 23 | } 24 | 25 | 26 | //TODO: 27 | export async function removeUsers() { 28 | return true 29 | } -------------------------------------------------------------------------------- /src/components/ui/label.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import * as React from "react" 4 | import * as LabelPrimitive from "@radix-ui/react-label" 5 | import { cva, type VariantProps } from "class-variance-authority" 6 | 7 | import { cn } from "@/lib/utils" 8 | 9 | const labelVariants = cva( 10 | "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" 11 | ) 12 | 13 | const Label = React.forwardRef< 14 | React.ElementRef, 15 | React.ComponentPropsWithoutRef & 16 | VariantProps 17 | >(({ className, ...props }, ref) => ( 18 | 23 | )) 24 | Label.displayName = LabelPrimitive.Root.displayName 25 | 26 | export { Label } 27 | -------------------------------------------------------------------------------- /src/components/ui/textarea.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | import { cn } from "@/lib/utils" 4 | 5 | export interface TextareaProps 6 | extends React.TextareaHTMLAttributes {} 7 | 8 | const Textarea = React.forwardRef( 9 | ({ className, ...props }, ref) => { 10 | return ( 11 |