@digilogiclabs/create-saas-app 1.10.6 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +331 -350
- package/dist/.tsbuildinfo +1 -1
- package/dist/cli/commands/create.js +2 -2
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/generators/template-generator.d.ts.map +1 -1
- package/dist/generators/template-generator.js +14 -2
- package/dist/generators/template-generator.js.map +1 -1
- package/dist/templates/web/ui-auth/template/.claude +21 -0
- package/dist/templates/web/ui-auth/template/context.md +105 -0
- package/dist/templates/web/ui-auth/template/src/app/dev-setup/page.tsx +801 -0
- package/dist/templates/web/ui-auth/template/src/app/setup/page.tsx +403 -0
- package/dist/templates/web/ui-auth-payments/template/src/app/dev-setup/page.tsx +801 -0
- package/dist/templates/web/ui-auth-payments/template/src/app/setup/page.tsx +507 -0
- package/dist/templates/web/ui-auth-payments/template/src/components/shared/header.tsx +127 -32
- package/dist/templates/web/ui-auth-payments-ai/template/.claude +21 -0
- package/dist/templates/web/ui-auth-payments-ai/template/.env.example +15 -0
- package/dist/templates/web/ui-auth-payments-ai/template/README.md +207 -0
- package/dist/templates/web/ui-auth-payments-ai/template/context.md +169 -0
- package/dist/templates/web/ui-auth-payments-ai/template/middleware.ts +68 -0
- package/dist/templates/web/ui-auth-payments-ai/template/next.config.js +12 -0
- package/dist/templates/web/ui-auth-payments-ai/template/package-lock.json +12241 -0
- package/dist/templates/web/ui-auth-payments-ai/template/package.json +55 -0
- package/dist/templates/web/ui-auth-payments-ai/template/postcss.config.js +7 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/ai/page.tsx +310 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/api/ai/audio/route.ts +56 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/api/ai/chat/route.ts +49 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/api/ai/text/route.ts +64 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/api/ai/video/route.ts +73 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/auth/callback/route.ts +12 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/billing/page.tsx +211 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/checkout/page.tsx +142 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/dashboard/layout.tsx +22 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/dashboard/page.tsx +183 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/dev-setup/page.tsx +801 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/error.tsx +67 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/globals.css +43 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/layout.tsx +35 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/loading.tsx +20 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/login/page.tsx +6 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/page.tsx +380 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/page.tsx.backup +391 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/page.tsx.bak +391 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/setup/page.tsx +640 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/app/signup/page.tsx +6 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/__tests__/example.test.tsx +49 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/auth-status.tsx +52 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/login-form.tsx +144 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/client/signup-form.tsx +185 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/providers/app-providers.tsx +36 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/providers/theme-provider.tsx +96 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/shared/footer.tsx +36 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/shared/header.tsx +246 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/ui/badge.tsx +36 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/components/ui/theme-toggle.tsx +34 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/lib/actions/auth.ts +246 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/lib/actions/index.ts +14 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/lib/auth-server.ts +177 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/lib/env.ts +49 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/lib/utils.ts +140 -0
- package/dist/templates/web/ui-auth-payments-ai/template/src/test/setup.ts +79 -0
- package/dist/templates/web/ui-auth-payments-ai/template/tailwind.config.js +77 -0
- package/dist/templates/web/ui-auth-payments-ai/template/tsconfig.json +33 -0
- package/dist/templates/web/ui-auth-payments-ai/template/tsconfig.tsbuildinfo +1 -0
- package/dist/templates/web/ui-auth-payments-ai/template/vitest.config.ts +17 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/page.tsx +28 -20
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/page.tsx.backup +391 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/page.tsx.bak +391 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/app/setup/page.tsx +345 -0
- package/dist/templates/web/ui-auth-payments-audio/template/src/components/shared/header.tsx +122 -37
- package/dist/templates/web/ui-auth-payments-video/template/src/app/setup/page.tsx +351 -0
- package/dist/templates/web/ui-auth-payments-video/template/src/components/shared/header.tsx +122 -37
- package/package.json +1 -1
- package/src/templates/web/ui-auth/template/.claude +21 -0
- package/src/templates/web/ui-auth/template/context.md +105 -0
- package/src/templates/web/ui-auth/template/src/app/dev-setup/page.tsx +801 -0
- package/src/templates/web/ui-auth/template/src/app/setup/page.tsx +403 -0
- package/src/templates/web/ui-auth-payments/template/src/app/dev-setup/page.tsx +801 -0
- package/src/templates/web/ui-auth-payments/template/src/app/setup/page.tsx +507 -0
- package/src/templates/web/ui-auth-payments/template/src/components/shared/header.tsx +127 -32
- package/src/templates/web/ui-auth-payments-ai/template/.claude +21 -0
- package/src/templates/web/ui-auth-payments-ai/template/.env.example +15 -0
- package/src/templates/web/ui-auth-payments-ai/template/README.md +207 -0
- package/src/templates/web/ui-auth-payments-ai/template/context.md +169 -0
- package/src/templates/web/ui-auth-payments-ai/template/middleware.ts +68 -0
- package/src/templates/web/ui-auth-payments-ai/template/next.config.js +12 -0
- package/src/templates/web/ui-auth-payments-ai/template/package-lock.json +12241 -0
- package/src/templates/web/ui-auth-payments-ai/template/package.json +55 -0
- package/src/templates/web/ui-auth-payments-ai/template/postcss.config.js +7 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/ai/page.tsx +310 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/api/ai/audio/route.ts +56 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/api/ai/chat/route.ts +49 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/api/ai/text/route.ts +64 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/api/ai/video/route.ts +73 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/auth/callback/route.ts +12 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/billing/page.tsx +211 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/checkout/page.tsx +142 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/dashboard/layout.tsx +22 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/dashboard/page.tsx +183 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/dev-setup/page.tsx +801 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/error.tsx +67 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/globals.css +43 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/layout.tsx +35 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/loading.tsx +20 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/login/page.tsx +6 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/page.tsx +380 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/page.tsx.backup +391 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/page.tsx.bak +391 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/setup/page.tsx +640 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/app/signup/page.tsx +6 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/__tests__/example.test.tsx +49 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/client/auth-status.tsx +52 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/client/login-form.tsx +144 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/client/signup-form.tsx +185 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/providers/app-providers.tsx +36 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/providers/theme-provider.tsx +96 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/shared/footer.tsx +36 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/shared/header.tsx +246 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/ui/badge.tsx +36 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/components/ui/theme-toggle.tsx +34 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/lib/actions/auth.ts +246 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/lib/actions/index.ts +14 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/lib/auth-server.ts +177 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/lib/env.ts +49 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/lib/utils.ts +140 -0
- package/src/templates/web/ui-auth-payments-ai/template/src/test/setup.ts +79 -0
- package/src/templates/web/ui-auth-payments-ai/template/tailwind.config.js +77 -0
- package/src/templates/web/ui-auth-payments-ai/template/tsconfig.json +33 -0
- package/src/templates/web/ui-auth-payments-ai/template/tsconfig.tsbuildinfo +1 -0
- package/src/templates/web/ui-auth-payments-ai/template/vitest.config.ts +17 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/app/page.tsx +28 -20
- package/src/templates/web/ui-auth-payments-audio/template/src/app/page.tsx.backup +391 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/app/page.tsx.bak +391 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/app/setup/page.tsx +345 -0
- package/src/templates/web/ui-auth-payments-audio/template/src/components/shared/header.tsx +122 -37
- package/src/templates/web/ui-auth-payments-video/template/src/app/setup/page.tsx +351 -0
- package/src/templates/web/ui-auth-payments-video/template/src/components/shared/header.tsx +122 -37
- package/dist/cli/commands/add.d.ts +0 -6
- package/dist/cli/commands/add.d.ts.map +0 -1
- package/dist/cli/commands/add.js +0 -39
- package/dist/cli/commands/add.js.map +0 -1
- package/dist/cli/commands/index.d.ts +0 -4
- package/dist/cli/commands/index.d.ts.map +0 -1
- package/dist/cli/commands/index.js +0 -20
- package/dist/cli/commands/index.js.map +0 -1
- package/dist/cli/commands/update.d.ts +0 -6
- package/dist/cli/commands/update.d.ts.map +0 -1
- package/dist/cli/commands/update.js +0 -68
- package/dist/cli/commands/update.js.map +0 -1
- package/dist/cli/index.d.ts +0 -4
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -61
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/prompts/index.d.ts +0 -2
- package/dist/cli/prompts/index.d.ts.map +0 -1
- package/dist/cli/prompts/index.js +0 -18
- package/dist/cli/prompts/index.js.map +0 -1
- package/dist/cli/prompts/project-setup.d.ts +0 -5
- package/dist/cli/prompts/project-setup.d.ts.map +0 -1
- package/dist/cli/prompts/project-setup.js +0 -251
- package/dist/cli/prompts/project-setup.js.map +0 -1
- package/dist/cli/utils/git.d.ts +0 -9
- package/dist/cli/utils/git.d.ts.map +0 -1
- package/dist/cli/utils/git.js +0 -77
- package/dist/cli/utils/git.js.map +0 -1
- package/dist/cli/utils/index.d.ts +0 -5
- package/dist/cli/utils/index.d.ts.map +0 -1
- package/dist/cli/utils/index.js +0 -21
- package/dist/cli/utils/index.js.map +0 -1
- package/dist/cli/utils/logger.d.ts +0 -16
- package/dist/cli/utils/logger.d.ts.map +0 -1
- package/dist/cli/utils/logger.js +0 -55
- package/dist/cli/utils/logger.js.map +0 -1
- package/dist/cli/utils/package-manager.d.ts +0 -8
- package/dist/cli/utils/package-manager.d.ts.map +0 -1
- package/dist/cli/utils/package-manager.js +0 -92
- package/dist/cli/utils/package-manager.js.map +0 -1
- package/dist/cli/utils/spinner.d.ts +0 -7
- package/dist/cli/utils/spinner.d.ts.map +0 -1
- package/dist/cli/utils/spinner.js +0 -48
- package/dist/cli/utils/spinner.js.map +0 -1
- package/dist/cli/validators/dependencies.d.ts +0 -15
- package/dist/cli/validators/dependencies.d.ts.map +0 -1
- package/dist/cli/validators/dependencies.js +0 -108
- package/dist/cli/validators/dependencies.js.map +0 -1
- package/dist/cli/validators/index.d.ts +0 -3
- package/dist/cli/validators/index.d.ts.map +0 -1
- package/dist/cli/validators/index.js +0 -19
- package/dist/cli/validators/index.js.map +0 -1
- package/dist/cli/validators/project-name.d.ts +0 -5
- package/dist/cli/validators/project-name.d.ts.map +0 -1
- package/dist/cli/validators/project-name.js +0 -151
- package/dist/cli/validators/project-name.js.map +0 -1
- package/dist/generators/file-processor.d.ts +0 -28
- package/dist/generators/file-processor.d.ts.map +0 -1
- package/dist/generators/file-processor.js +0 -224
- package/dist/generators/file-processor.js.map +0 -1
- package/dist/generators/index.d.ts +0 -4
- package/dist/generators/index.d.ts.map +0 -1
- package/dist/generators/index.js +0 -20
- package/dist/generators/index.js.map +0 -1
- package/dist/generators/package-installer.d.ts +0 -29
- package/dist/generators/package-installer.d.ts.map +0 -1
- package/dist/generators/package-installer.js +0 -167
- package/dist/generators/package-installer.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
4
|
import Link from 'next/link';
|
|
5
|
-
import { LogOut, CreditCard, User, Settings, Home } from 'lucide-react';
|
|
5
|
+
import { LogOut, CreditCard, User, Settings, Home, Menu, X, Info } from 'lucide-react';
|
|
6
6
|
import { useAuth } from '@digilogiclabs/saas-factory-auth';
|
|
7
7
|
import {
|
|
8
8
|
ResponsiveHeader,
|
|
@@ -17,22 +17,10 @@ export function Header() {
|
|
|
17
17
|
const { user, signOut } = useAuth();
|
|
18
18
|
const networkInfo = useNetworkInfo();
|
|
19
19
|
const isOnline = useOfflineState();
|
|
20
|
+
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
|
|
20
21
|
|
|
21
22
|
const projectName = "{{titleCaseName}}";
|
|
22
23
|
|
|
23
|
-
const headerConfig = {
|
|
24
|
-
logo: {
|
|
25
|
-
text: projectName,
|
|
26
|
-
href: '/',
|
|
27
|
-
className: 'text-2xl font-bold'
|
|
28
|
-
},
|
|
29
|
-
networkStatus: {
|
|
30
|
-
isOnline,
|
|
31
|
-
connectionType: networkInfo?.effectiveType,
|
|
32
|
-
showIndicator: true
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
24
|
const handleSignOut = async () => {
|
|
37
25
|
try {
|
|
38
26
|
await signOut();
|
|
@@ -66,6 +54,12 @@ export function Header() {
|
|
|
66
54
|
icon: CreditCard,
|
|
67
55
|
protected: false
|
|
68
56
|
},
|
|
57
|
+
{
|
|
58
|
+
label: 'Setup Guide',
|
|
59
|
+
href: '/setup',
|
|
60
|
+
icon: Info,
|
|
61
|
+
protected: false
|
|
62
|
+
},
|
|
69
63
|
{
|
|
70
64
|
label: 'Settings',
|
|
71
65
|
href: '/settings',
|
|
@@ -94,6 +88,9 @@ export function Header() {
|
|
|
94
88
|
}
|
|
95
89
|
];
|
|
96
90
|
|
|
91
|
+
// Filter navigation items based on user authentication
|
|
92
|
+
const visibleNavItems = navigationItems.filter(item => !item.protected || user);
|
|
93
|
+
|
|
97
94
|
return (
|
|
98
95
|
<>
|
|
99
96
|
{/* Network Status Banner */}
|
|
@@ -112,23 +109,121 @@ export function Header() {
|
|
|
112
109
|
</div>
|
|
113
110
|
)}
|
|
114
111
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
className="
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
112
|
+
{/* Responsive Header */}
|
|
113
|
+
<header className="bg-white dark:bg-gray-800 shadow-md border-b">
|
|
114
|
+
<div className="container mx-auto px-4">
|
|
115
|
+
<div className="flex justify-between items-center h-16">
|
|
116
|
+
{/* Logo */}
|
|
117
|
+
<Link href="/" className="text-2xl font-bold text-gray-900 dark:text-white">
|
|
118
|
+
{projectName}
|
|
119
|
+
</Link>
|
|
120
|
+
|
|
121
|
+
{/* Desktop Navigation */}
|
|
122
|
+
<nav className="hidden md:flex items-center gap-6">
|
|
123
|
+
{visibleNavItems.map((item) => (
|
|
124
|
+
<Link
|
|
125
|
+
key={item.href}
|
|
126
|
+
href={item.href}
|
|
127
|
+
className="flex items-center gap-2 text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white transition-colors"
|
|
128
|
+
>
|
|
129
|
+
<item.icon className="w-4 h-4" />
|
|
130
|
+
{item.label}
|
|
131
|
+
</Link>
|
|
132
|
+
))}
|
|
133
|
+
|
|
134
|
+
{/* Auth Actions */}
|
|
135
|
+
<div className="flex items-center gap-2 ml-4 pl-4 border-l border-gray-200 dark:border-gray-600">
|
|
136
|
+
<ThemeToggle />
|
|
137
|
+
{user ? (
|
|
138
|
+
<button
|
|
139
|
+
onClick={handleSignOut}
|
|
140
|
+
className="flex items-center gap-2 px-3 py-2 text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white transition-colors"
|
|
141
|
+
>
|
|
142
|
+
<LogOut className="w-4 h-4" />
|
|
143
|
+
Sign Out
|
|
144
|
+
</button>
|
|
145
|
+
) : (
|
|
146
|
+
<div className="flex items-center gap-2">
|
|
147
|
+
<Link
|
|
148
|
+
href="/login"
|
|
149
|
+
className="text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white transition-colors"
|
|
150
|
+
>
|
|
151
|
+
Login
|
|
152
|
+
</Link>
|
|
153
|
+
<Link
|
|
154
|
+
href="/signup"
|
|
155
|
+
className="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors"
|
|
156
|
+
>
|
|
157
|
+
Sign Up
|
|
158
|
+
</Link>
|
|
159
|
+
</div>
|
|
160
|
+
)}
|
|
161
|
+
</div>
|
|
162
|
+
</nav>
|
|
163
|
+
|
|
164
|
+
{/* Mobile Menu Button */}
|
|
165
|
+
<button
|
|
166
|
+
onClick={() => setMobileMenuOpen(!mobileMenuOpen)}
|
|
167
|
+
className="md:hidden p-2 text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white"
|
|
168
|
+
>
|
|
169
|
+
{mobileMenuOpen ? <X className="w-6 h-6" /> : <Menu className="w-6 h-6" />}
|
|
170
|
+
</button>
|
|
171
|
+
</div>
|
|
172
|
+
|
|
173
|
+
{/* Mobile Menu */}
|
|
174
|
+
{mobileMenuOpen && (
|
|
175
|
+
<div className="md:hidden border-t border-gray-200 dark:border-gray-600 py-4">
|
|
176
|
+
<nav className="flex flex-col space-y-3">
|
|
177
|
+
{visibleNavItems.map((item) => (
|
|
178
|
+
<Link
|
|
179
|
+
key={item.href}
|
|
180
|
+
href={item.href}
|
|
181
|
+
onClick={() => setMobileMenuOpen(false)}
|
|
182
|
+
className="flex items-center gap-3 px-3 py-2 text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 rounded transition-colors"
|
|
183
|
+
>
|
|
184
|
+
<item.icon className="w-4 h-4" />
|
|
185
|
+
{item.label}
|
|
186
|
+
</Link>
|
|
187
|
+
))}
|
|
188
|
+
|
|
189
|
+
{/* Mobile Auth Actions */}
|
|
190
|
+
<div className="flex items-center gap-3 px-3 pt-3 border-t border-gray-200 dark:border-gray-600">
|
|
191
|
+
<ThemeToggle />
|
|
192
|
+
{user ? (
|
|
193
|
+
<button
|
|
194
|
+
onClick={() => {
|
|
195
|
+
handleSignOut();
|
|
196
|
+
setMobileMenuOpen(false);
|
|
197
|
+
}}
|
|
198
|
+
className="flex items-center gap-2 px-3 py-2 text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 rounded transition-colors"
|
|
199
|
+
>
|
|
200
|
+
<LogOut className="w-4 h-4" />
|
|
201
|
+
Sign Out
|
|
202
|
+
</button>
|
|
203
|
+
) : (
|
|
204
|
+
<div className="flex flex-col gap-2 w-full">
|
|
205
|
+
<Link
|
|
206
|
+
href="/login"
|
|
207
|
+
onClick={() => setMobileMenuOpen(false)}
|
|
208
|
+
className="text-center py-2 text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 rounded transition-colors"
|
|
209
|
+
>
|
|
210
|
+
Login
|
|
211
|
+
</Link>
|
|
212
|
+
<Link
|
|
213
|
+
href="/signup"
|
|
214
|
+
onClick={() => setMobileMenuOpen(false)}
|
|
215
|
+
className="text-center py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors"
|
|
216
|
+
>
|
|
217
|
+
Sign Up
|
|
218
|
+
</Link>
|
|
219
|
+
</div>
|
|
220
|
+
)}
|
|
221
|
+
</div>
|
|
222
|
+
</nav>
|
|
223
|
+
</div>
|
|
224
|
+
)}
|
|
225
|
+
</div>
|
|
226
|
+
</header>
|
|
132
227
|
</>
|
|
133
228
|
);
|
|
134
229
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{projectName}}",
|
|
3
|
+
"description": "{{description}} - Full-Stack AI Platform built with Digi Logic Labs packages",
|
|
4
|
+
"include": [
|
|
5
|
+
"src/**/*",
|
|
6
|
+
"*.md",
|
|
7
|
+
"*.json",
|
|
8
|
+
"*.js",
|
|
9
|
+
"*.ts",
|
|
10
|
+
".env.example"
|
|
11
|
+
],
|
|
12
|
+
"exclude": [
|
|
13
|
+
"node_modules/**/*",
|
|
14
|
+
".next/**/*",
|
|
15
|
+
"dist/**/*",
|
|
16
|
+
"build/**/*",
|
|
17
|
+
"*.log",
|
|
18
|
+
".claude"
|
|
19
|
+
],
|
|
20
|
+
"instructions": "You are helping develop a Full-Stack AI Platform using Next.js 15, TypeScript, and Digi Logic Labs packages.\n\n## Project Architecture\n- **Framework**: Next.js 15.3 with App Router\n- **Database**: Supabase (PostgreSQL with real-time features)\n- **Styling**: Tailwind CSS v4 with glassmorphism design system\n- **Authentication**: Supabase Auth with @digilogiclabs/saas-factory-auth\n- **Payments**: Stripe integration with @digilogiclabs/saas-factory-payments\n- **AI Platform**: Multi-modal AI with @digilogiclabs/saas-factory-ai\n\n## Key Packages\n- **@digilogiclabs/saas-factory-auth**: Authentication components and hooks with Supabase integration\n- **@digilogiclabs/saas-factory-ui**: Modern UI components with glassmorphism and responsive design\n- **@digilogiclabs/saas-factory-payments**: Stripe integration for subscriptions and payments\n- **@digilogiclabs/saas-factory-ai**: AI platform with text, audio, and video generation capabilities\n- **@digilogiclabs/saas-factory-ai-types**: TypeScript types and interfaces for AI operations\n\n## Development Guidelines\n1. Follow Next.js 15 best practices with Server Components by default\n2. Use TypeScript strictly - all components should be typed\n3. Implement proper error boundaries and loading states\n4. Follow the glassmorphism design system from saas-factory-ui\n5. Use Server Actions for mutations and API routes for complex logic\n6. Always check authentication state with useAuth hook\n7. Handle payment states and subscription status properly\n8. Implement proper AI generation state management and error handling\n\n## File Organization\n- Components in /src/components with feature-based folders\n- Server actions in /src/server/actions\n- API routes in /src/app/api\n- Database queries in /src/server/queries\n- Types in /src/types\n\n## Testing\n- Use Vitest for unit tests\n- Test business logic and error states\n- Mock external services (Supabase, Stripe, AI providers)\n\nRemember to consult the context.md file for detailed package documentation and examples."
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Auth Configuration
|
|
2
|
+
NEXT_PUBLIC_AUTH_PROVIDER=supabase|firebase
|
|
3
|
+
|
|
4
|
+
# Supabase
|
|
5
|
+
NEXT_PUBLIC_SUPABASE_URL=
|
|
6
|
+
NEXT_PUBLIC_SUPABASE_ANON_KEY=
|
|
7
|
+
|
|
8
|
+
# Firebase
|
|
9
|
+
NEXT_PUBLIC_FIREBASE_API_KEY=
|
|
10
|
+
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=
|
|
11
|
+
NEXT_PUBLIC_FIREBASE_PROJECT_ID=
|
|
12
|
+
|
|
13
|
+
# Payments
|
|
14
|
+
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=
|
|
15
|
+
STRIPE_SECRET_KEY=
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# {{titleCaseName}}
|
|
2
|
+
|
|
3
|
+
{{description}}
|
|
4
|
+
|
|
5
|
+
This is a Next.js 15 project created with the **Audio Player App** template from `@digilogiclabs/create-saas-app`. It includes:
|
|
6
|
+
|
|
7
|
+
- 🎵 **Audio Player** - Advanced audio streaming capabilities
|
|
8
|
+
- 🎨 **UI Components** - @digilogiclabs/saas-factory-ui v0.16.0 with audio player
|
|
9
|
+
- 🔐 **Authentication** - @digilogiclabs/saas-factory-auth v0.4.4
|
|
10
|
+
- 💳 **Payments** - @digilogiclabs/saas-factory-payments v0.3.0
|
|
11
|
+
- ⚡ **Next.js 15** - Latest React framework
|
|
12
|
+
- 🎯 **TypeScript** - Full type safety
|
|
13
|
+
- 🎨 **Tailwind CSS** - Utility-first styling
|
|
14
|
+
- 🌙 **Dark Mode** - Built-in theme support
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
### Audio Player
|
|
19
|
+
- Full-featured audio player with playlist support
|
|
20
|
+
- Play/pause, skip, shuffle, repeat controls
|
|
21
|
+
- Volume control and mute functionality
|
|
22
|
+
- Progress bar with seeking capability
|
|
23
|
+
- Track information display with cover art
|
|
24
|
+
- Cross-platform support (Web + React Native)
|
|
25
|
+
|
|
26
|
+
### Authentication
|
|
27
|
+
- User registration and login
|
|
28
|
+
- Protected routes
|
|
29
|
+
- Session management
|
|
30
|
+
- Sign out functionality
|
|
31
|
+
|
|
32
|
+
### Payments Integration
|
|
33
|
+
- Subscription plans display
|
|
34
|
+
- Payment form with Stripe integration
|
|
35
|
+
- Billing history
|
|
36
|
+
- Payment method management
|
|
37
|
+
- Subscription management
|
|
38
|
+
|
|
39
|
+
### UI Components
|
|
40
|
+
- Modern, accessible components including AudioPlayer
|
|
41
|
+
- Dark/light theme support
|
|
42
|
+
- Responsive design
|
|
43
|
+
- TypeScript definitions
|
|
44
|
+
|
|
45
|
+
## Getting Started
|
|
46
|
+
|
|
47
|
+
### Prerequisites
|
|
48
|
+
- Node.js 18+
|
|
49
|
+
- npm, yarn, or pnpm
|
|
50
|
+
|
|
51
|
+
### Installation
|
|
52
|
+
|
|
53
|
+
1. Install dependencies:
|
|
54
|
+
```bash
|
|
55
|
+
npm install
|
|
56
|
+
# or
|
|
57
|
+
yarn install
|
|
58
|
+
# or
|
|
59
|
+
pnpm install
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
2. Set up environment variables:
|
|
63
|
+
```bash
|
|
64
|
+
cp .env.example .env.local
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Edit `.env.local` with your configuration:
|
|
68
|
+
```env
|
|
69
|
+
# Authentication (choose one)
|
|
70
|
+
NEXT_PUBLIC_FIREBASE_API_KEY=your_firebase_api_key
|
|
71
|
+
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
|
|
72
|
+
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
|
|
73
|
+
|
|
74
|
+
# OR
|
|
75
|
+
|
|
76
|
+
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
|
|
77
|
+
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
|
|
78
|
+
|
|
79
|
+
# Payments
|
|
80
|
+
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=your_stripe_publishable_key
|
|
81
|
+
STRIPE_SECRET_KEY=your_stripe_secret_key
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
3. Run the development server:
|
|
85
|
+
```bash
|
|
86
|
+
npm run dev
|
|
87
|
+
# or
|
|
88
|
+
yarn dev
|
|
89
|
+
# or
|
|
90
|
+
pnpm dev
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
|
94
|
+
|
|
95
|
+
## Available Pages
|
|
96
|
+
|
|
97
|
+
- `/` - Home page with feature showcase
|
|
98
|
+
- `/login` - User authentication
|
|
99
|
+
- `/signup` - User registration
|
|
100
|
+
- `/checkout` - Subscription plans and payment
|
|
101
|
+
- `/billing` - Subscription and billing management
|
|
102
|
+
|
|
103
|
+
## Package Integration
|
|
104
|
+
|
|
105
|
+
### UI Package (@digilogiclabs/saas-factory-ui)
|
|
106
|
+
```tsx
|
|
107
|
+
import { Button, Card, AudioPlayer } from '@digilogiclabs/saas-factory-ui'
|
|
108
|
+
|
|
109
|
+
<Button variant="primary">Click me</Button>
|
|
110
|
+
<Card>Content here</Card>
|
|
111
|
+
<AudioPlayer
|
|
112
|
+
tracks={[
|
|
113
|
+
{
|
|
114
|
+
id: '1',
|
|
115
|
+
title: 'Song Title',
|
|
116
|
+
artist: 'Artist Name',
|
|
117
|
+
album: 'Album Name',
|
|
118
|
+
duration: 180,
|
|
119
|
+
src: '/path/to/audio.mp3',
|
|
120
|
+
coverArt: '/path/to/cover.jpg'
|
|
121
|
+
}
|
|
122
|
+
]}
|
|
123
|
+
/>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Auth Package (@digilogiclabs/saas-factory-auth)
|
|
127
|
+
```tsx
|
|
128
|
+
import { useAuth } from '@digilogiclabs/saas-factory-auth'
|
|
129
|
+
|
|
130
|
+
const { user, signIn, signOut, loading } = useAuth()
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Payments Package (@digilogiclabs/saas-factory-payments)
|
|
134
|
+
```tsx
|
|
135
|
+
import {
|
|
136
|
+
PaymentForm,
|
|
137
|
+
SubscriptionPlans,
|
|
138
|
+
SubscriptionManager
|
|
139
|
+
} from '@digilogiclabs/saas-factory-payments'
|
|
140
|
+
|
|
141
|
+
<SubscriptionPlans onPlanSelect={handlePlanSelect} />
|
|
142
|
+
<PaymentForm onSuccess={handleSuccess} onError={handleError} />
|
|
143
|
+
<SubscriptionManager onSubscriptionChange={handleChange} />
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Project Structure
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
src/
|
|
150
|
+
├── app/ # Next.js 15 app directory
|
|
151
|
+
│ ├── billing/ # Billing and subscription management
|
|
152
|
+
│ ├── checkout/ # Payment and subscription selection
|
|
153
|
+
│ ├── login/ # Authentication pages
|
|
154
|
+
│ ├── signup/
|
|
155
|
+
│ └── layout.tsx # Root layout with providers
|
|
156
|
+
├── components/
|
|
157
|
+
│ ├── providers/ # App-wide providers (Auth, Payments, Theme)
|
|
158
|
+
│ ├── shared/ # Shared components (Header, etc.)
|
|
159
|
+
│ └── ui/ # UI components
|
|
160
|
+
└── lib/ # Utilities and configurations
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Deployment
|
|
164
|
+
|
|
165
|
+
### Vercel (Recommended)
|
|
166
|
+
1. Push your code to GitHub
|
|
167
|
+
2. Connect your repository to Vercel
|
|
168
|
+
3. Add environment variables in Vercel dashboard
|
|
169
|
+
4. Deploy
|
|
170
|
+
|
|
171
|
+
### Other Platforms
|
|
172
|
+
This is a standard Next.js application and can be deployed to any platform that supports Node.js.
|
|
173
|
+
|
|
174
|
+
## Learn More
|
|
175
|
+
|
|
176
|
+
- [Next.js Documentation](https://nextjs.org/docs)
|
|
177
|
+
- [Digi Logic Labs Documentation](https://docs.digilogiclabs.com)
|
|
178
|
+
- [SaaS Factory UI Components](https://ui.digilogiclabs.com)
|
|
179
|
+
- [SaaS Factory Auth Guide](https://auth.digilogiclabs.com)
|
|
180
|
+
- [SaaS Factory Payments Guide](https://payments.digilogiclabs.com)
|
|
181
|
+
|
|
182
|
+
## Troubleshooting
|
|
183
|
+
|
|
184
|
+
### Component Import Errors
|
|
185
|
+
If you encounter errors like "Cannot read properties of undefined" or component import issues:
|
|
186
|
+
|
|
187
|
+
1. Clear npm cache and reinstall:
|
|
188
|
+
```bash
|
|
189
|
+
rm -rf node_modules package-lock.json
|
|
190
|
+
npm cache clean --force
|
|
191
|
+
npm install
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
2. Ensure you're using the latest UI package version (v0.16.0+):
|
|
195
|
+
```bash
|
|
196
|
+
npm list @digilogiclabs/saas-factory-ui
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Audio Component Issues
|
|
200
|
+
For audio-related component errors, make sure your environment supports audio APIs and you have proper HTTPS setup in production.
|
|
201
|
+
|
|
202
|
+
## Support
|
|
203
|
+
|
|
204
|
+
- 📚 [Documentation](https://docs.digilogiclabs.com)
|
|
205
|
+
- 💬 [Discord Community](https://discord.gg/digilogiclabs)
|
|
206
|
+
- 🐛 [Report Issues](https://github.com/DigiLogicLabs/create-saas-app/issues)
|
|
207
|
+
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# {{projectName}} - Development Context
|
|
2
|
+
|
|
3
|
+
This project is a Full-Stack AI Platform built with modern technologies and Digi Logic Labs packages.
|
|
4
|
+
|
|
5
|
+
## Architecture Overview
|
|
6
|
+
|
|
7
|
+
### Core Technologies
|
|
8
|
+
- **Next.js 15.3**: App Router, Server Components, Server Actions
|
|
9
|
+
- **TypeScript**: Strict typing throughout
|
|
10
|
+
- **Tailwind CSS v4**: Design tokens, glassmorphism system
|
|
11
|
+
- **Supabase**: Database, authentication, real-time features
|
|
12
|
+
|
|
13
|
+
### Package Integration
|
|
14
|
+
|
|
15
|
+
#### @digilogiclabs/saas-factory-auth
|
|
16
|
+
Authentication components and hooks with Supabase integration
|
|
17
|
+
|
|
18
|
+
**Key Exports**: useAuth, AuthProvider, LoginForm, SignupForm
|
|
19
|
+
**Documentation**: https://docs.digilogiclabs.com/packages/auth
|
|
20
|
+
|
|
21
|
+
#### @digilogiclabs/saas-factory-ui
|
|
22
|
+
Modern UI components with glassmorphism and responsive design
|
|
23
|
+
|
|
24
|
+
**Key Exports**: Button, Card, MobileContainer, PageTransition, ResponsiveGrid
|
|
25
|
+
**Documentation**: https://docs.digilogiclabs.com/packages/ui
|
|
26
|
+
|
|
27
|
+
#### @digilogiclabs/saas-factory-payments
|
|
28
|
+
Stripe integration for subscriptions and payments
|
|
29
|
+
|
|
30
|
+
**Key Exports**: useStripe, PaymentForm, SubscriptionManager, BillingPortal
|
|
31
|
+
**Documentation**: https://docs.digilogiclabs.com/packages/payments
|
|
32
|
+
|
|
33
|
+
#### @digilogiclabs/saas-factory-ai
|
|
34
|
+
AI platform with text, audio, and video generation capabilities
|
|
35
|
+
|
|
36
|
+
**Key Exports**: AIProvider, AITextGenerator, AIAudioGenerator, AIVideoGenerator, AIChat
|
|
37
|
+
**Documentation**: https://docs.digilogiclabs.com/packages/ai
|
|
38
|
+
|
|
39
|
+
#### @digilogiclabs/saas-factory-ai-types
|
|
40
|
+
TypeScript types and interfaces for AI operations
|
|
41
|
+
|
|
42
|
+
**Key Exports**: AIConfig, TextGenerationRequest, AudioGenerationRequest, VideoGenerationRequest
|
|
43
|
+
**Documentation**: https://docs.digilogiclabs.com/packages/ai-types
|
|
44
|
+
|
|
45
|
+
## Environment Configuration
|
|
46
|
+
|
|
47
|
+
Required environment variables:
|
|
48
|
+
```bash
|
|
49
|
+
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
|
|
50
|
+
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
|
|
51
|
+
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=your_stripe_publishable_key
|
|
52
|
+
STRIPE_SECRET_KEY=your_stripe_secret_key
|
|
53
|
+
OPENAI_API_KEY=your_openai_api_key
|
|
54
|
+
ELEVENLABS_API_KEY=your_elevenlabs_api_key
|
|
55
|
+
REPLICATE_API_TOKEN=your_replicate_token
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Database Schema
|
|
59
|
+
|
|
60
|
+
Key tables:
|
|
61
|
+
- **profiles**: User profile information
|
|
62
|
+
- **subscriptions**: Stripe subscription management
|
|
63
|
+
- **ai_conversations**: AI interaction history
|
|
64
|
+
|
|
65
|
+
## Common Patterns
|
|
66
|
+
|
|
67
|
+
### Authentication Flow
|
|
68
|
+
```typescript
|
|
69
|
+
import { useAuth } from '@digilogiclabs/saas-factory-auth'
|
|
70
|
+
|
|
71
|
+
export function ProtectedComponent() {
|
|
72
|
+
const { user, loading } = useAuth()
|
|
73
|
+
|
|
74
|
+
if (loading) return <LoadingSpinner />
|
|
75
|
+
if (!user) return <LoginPrompt />
|
|
76
|
+
|
|
77
|
+
return <UserContent user={user} />
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### UI Components
|
|
82
|
+
```typescript
|
|
83
|
+
import {
|
|
84
|
+
Card,
|
|
85
|
+
Button,
|
|
86
|
+
PageTransition,
|
|
87
|
+
useGlassmorphism
|
|
88
|
+
} from '@digilogiclabs/saas-factory-ui'
|
|
89
|
+
|
|
90
|
+
export function ExampleComponent() {
|
|
91
|
+
const glass = useGlassmorphism()
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<PageTransition type="fade">
|
|
95
|
+
<Card className={`${glass.card} ${glass.border}`}>
|
|
96
|
+
<Button variant="default">Action</Button>
|
|
97
|
+
</Card>
|
|
98
|
+
</PageTransition>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Payment Integration
|
|
104
|
+
```typescript
|
|
105
|
+
import { useStripe, PaymentForm } from '@digilogiclabs/saas-factory-payments'
|
|
106
|
+
|
|
107
|
+
export function CheckoutPage() {
|
|
108
|
+
const { createCheckoutSession, loading } = useStripe()
|
|
109
|
+
|
|
110
|
+
const handlePayment = async (priceId: string) => {
|
|
111
|
+
const { url } = await createCheckoutSession({ priceId })
|
|
112
|
+
window.location.href = url
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return <PaymentForm onSubmit={handlePayment} />
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### AI Integration
|
|
120
|
+
```typescript
|
|
121
|
+
import { AIProvider, AITextGenerator } from '@digilogiclabs/saas-factory-ai'
|
|
122
|
+
|
|
123
|
+
export function AIDemo() {
|
|
124
|
+
const aiConfig = {
|
|
125
|
+
apiKey: process.env.OPENAI_API_KEY,
|
|
126
|
+
provider: 'openai',
|
|
127
|
+
model: 'gpt-4'
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<AIProvider config={aiConfig}>
|
|
132
|
+
<AITextGenerator
|
|
133
|
+
placeholder="Generate content..."
|
|
134
|
+
maxLength={2000}
|
|
135
|
+
/>
|
|
136
|
+
</AIProvider>
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Development Workflow
|
|
142
|
+
|
|
143
|
+
1. **Setup**: Run setup guide at /setup
|
|
144
|
+
2. **Development**: `npm run dev` with hot reload
|
|
145
|
+
3. **Testing**: `npm run test` with Vitest
|
|
146
|
+
4. **Building**: `npm run build` for production
|
|
147
|
+
5. **Deployment**: See deployment guide at /dev-setup
|
|
148
|
+
|
|
149
|
+
## Troubleshooting
|
|
150
|
+
|
|
151
|
+
### Common Issues
|
|
152
|
+
- **Environment Variables**: Check .env.local file exists and variables are correct
|
|
153
|
+
- **Database Connection**: Verify Supabase project settings and RLS policies
|
|
154
|
+
- **Stripe Issues**: Check webhook endpoints and API keys match
|
|
155
|
+
- **AI Generation Failures**: Verify API keys and rate limits
|
|
156
|
+
|
|
157
|
+
### Debug Commands
|
|
158
|
+
```bash
|
|
159
|
+
npm run type-check # TypeScript validation
|
|
160
|
+
npm run lint # ESLint validation
|
|
161
|
+
npm run test # Run test suite
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Resources
|
|
165
|
+
|
|
166
|
+
- **Package Documentation**: https://docs.digilogiclabs.com
|
|
167
|
+
- **Support Discord**: https://discord.gg/digilogiclabs
|
|
168
|
+
- **Example Projects**: https://github.com/digilogiclabs/examples
|
|
169
|
+
- **Setup Guide**: /setup page in this application
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from 'next/server'
|
|
2
|
+
import { env } from './src/lib/env'
|
|
3
|
+
|
|
4
|
+
export async function middleware(request: NextRequest) {
|
|
5
|
+
// Get auth token from cookies
|
|
6
|
+
const authToken = request.cookies.get('saas-factory-auth-token')?.value
|
|
7
|
+
const user = request.cookies.get('saas-factory-auth-user')?.value
|
|
8
|
+
|
|
9
|
+
const isAuthenticated = !!(authToken && user)
|
|
10
|
+
const { pathname } = request.nextUrl
|
|
11
|
+
|
|
12
|
+
// Define protected routes
|
|
13
|
+
const protectedRoutes = ['/dashboard', '/profile', '/settings']
|
|
14
|
+
const authRoutes = ['/login', '/signup']
|
|
15
|
+
|
|
16
|
+
// Check if the current path is protected
|
|
17
|
+
const isProtectedRoute = protectedRoutes.some(route =>
|
|
18
|
+
pathname.startsWith(route)
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
// Check if the current path is an auth route
|
|
22
|
+
const isAuthRoute = authRoutes.some(route =>
|
|
23
|
+
pathname.startsWith(route)
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
// Redirect unauthenticated users from protected routes
|
|
27
|
+
if (isProtectedRoute && !isAuthenticated) {
|
|
28
|
+
const loginUrl = new URL('/login', request.url)
|
|
29
|
+
loginUrl.searchParams.set('from', pathname)
|
|
30
|
+
return NextResponse.redirect(loginUrl)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Redirect authenticated users from auth routes
|
|
34
|
+
if (isAuthRoute && isAuthenticated) {
|
|
35
|
+
const redirectUrl = request.nextUrl.searchParams.get('from') || '/'
|
|
36
|
+
return NextResponse.redirect(new URL(redirectUrl, request.url))
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Add security headers
|
|
40
|
+
const response = NextResponse.next()
|
|
41
|
+
|
|
42
|
+
// Add CSRF protection headers
|
|
43
|
+
response.headers.set('X-Frame-Options', 'DENY')
|
|
44
|
+
response.headers.set('X-Content-Type-Options', 'nosniff')
|
|
45
|
+
response.headers.set('Referrer-Policy', 'origin-when-cross-origin')
|
|
46
|
+
|
|
47
|
+
// Add CSP header for additional security
|
|
48
|
+
if (env.NODE_ENV === 'production') {
|
|
49
|
+
response.headers.set(
|
|
50
|
+
'Content-Security-Policy',
|
|
51
|
+
"default-src 'self'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://js.stripe.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https:; connect-src 'self' https://api.stripe.com"
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return response
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const config = {
|
|
59
|
+
matcher: [
|
|
60
|
+
// Match all request paths except for the ones starting with:
|
|
61
|
+
// - api (API routes)
|
|
62
|
+
// - _next/static (static files)
|
|
63
|
+
// - _next/image (image optimization files)
|
|
64
|
+
// - favicon.ico (favicon file)
|
|
65
|
+
// - public folder files
|
|
66
|
+
'/((?!api|_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)',
|
|
67
|
+
],
|
|
68
|
+
}
|