@nextsparkjs/theme-default 0.1.0-beta.28 → 0.1.0-beta.30

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 NextSpark
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -91,78 +91,51 @@ export const APP_CONFIG_OVERRIDES = {
91
91
  // =============================================================================
92
92
  // DOCUMENTATION CONFIGURATION
93
93
  // =============================================================================
94
+ /**
95
+ * Documentation system configuration
96
+ *
97
+ * Structure:
98
+ * - public: User-facing documentation at /docs
99
+ * - superadmin: Admin documentation at /superadmin/docs
100
+ *
101
+ * NOTE: Plugin docs are NOT in the registry - they are for developer reference only (IDE/LLM).
102
+ */
94
103
  docs: {
95
- /**
96
- * Enable/disable documentation system
97
- */
104
+ /** Enable/disable documentation system */
98
105
  enabled: true,
99
106
 
100
- /**
101
- * Public access to documentation
102
- * - true: Documentation accessible without authentication
103
- * - false: Requires user to be logged in
104
- */
105
- public: true,
107
+ /** Make public documentation accessible without authentication */
108
+ publicAccess: true,
106
109
 
107
- /**
108
- * Enable search functionality in documentation
109
- */
110
+ /** Enable search functionality in documentation */
110
111
  searchEnabled: true,
111
112
 
112
- /**
113
- * Show breadcrumbs in documentation pages
114
- */
113
+ /** Show breadcrumbs in documentation pages */
115
114
  breadcrumbs: true,
116
115
 
117
116
  /**
118
- * Theme Documentation Configuration
119
- * Controls how theme-level documentation appears in the sidebar
117
+ * Public Documentation Configuration
118
+ * Controls public-facing documentation at /docs routes
120
119
  */
121
- theme: {
122
- /** Show/hide theme documentation category */
120
+ public: {
121
+ /** Show/hide public documentation */
123
122
  enabled: true,
124
- /** Expand theme category by default on page load */
123
+ /** Expand sections by default on page load */
125
124
  open: true,
126
- /** Custom label displayed in sidebar for theme category */
127
- label: "Default Theme",
125
+ /** Custom label displayed in sidebar */
126
+ label: "Documentation",
128
127
  },
129
128
 
130
129
  /**
131
- * Plugins Documentation Configuration
132
- * Controls how plugin documentation appears in the sidebar
130
+ * Superadmin Documentation Configuration
131
+ * Controls admin documentation at /superadmin/docs routes
133
132
  */
134
- plugins: {
135
- /** Show/hide plugin documentation category */
133
+ superadmin: {
134
+ /** Show/hide superadmin documentation */
136
135
  enabled: true,
137
- /** Expand plugins category by default on page load */
138
- open: false,
139
- /** Custom label displayed in sidebar for plugins category */
140
- label: "Plugins",
136
+ /** Custom label displayed in sidebar */
137
+ label: "Admin Docs",
141
138
  },
142
-
143
- /**
144
- * Core Documentation Configuration
145
- * Controls how core framework documentation appears in the sidebar
146
- */
147
- core: {
148
- /** Show/hide core documentation category */
149
- enabled: true,
150
- /** Expand core category by default on page load */
151
- open: true,
152
- /** Custom label displayed in sidebar for core category */
153
- label: "Core",
154
- },
155
-
156
- /**
157
- * Additional environment-based check for plugin docs in production
158
- * Plugin docs will only show if BOTH conditions are met:
159
- * 1. plugins.enabled is true
160
- * 2. Either in development OR showPluginsDocsInProd is true
161
- *
162
- * @deprecated Prefer using plugins.enabled for simpler control
163
- * By default plugins documentation is not available in prod environments
164
- */
165
- showPluginsDocsInProd: false,
166
139
  },
167
140
 
168
141
  // =============================================================================
@@ -1,3 +1,8 @@
1
+ ---
2
+ title: Introduction
3
+ description: Overview of the Default Theme and its key features for NextSpark applications.
4
+ ---
5
+
1
6
  # Default Theme Introduction
2
7
 
3
8
  ## Overview
@@ -1,3 +1,8 @@
1
+ ---
2
+ title: Customization
3
+ description: Learn how to customize colors, typography, components, and functionality in the default theme.
4
+ ---
5
+
1
6
  # Theme Customization
2
7
 
3
8
  ## Introduction
@@ -1,3 +1,8 @@
1
+ ---
2
+ title: Tasks Entity
3
+ description: Complete guide to the Tasks entity implementation with CRUD operations, metadata, and API access.
4
+ ---
5
+
1
6
  # Tasks Entity
2
7
 
3
8
  ## Introduction
@@ -1,3 +1,8 @@
1
+ ---
2
+ title: AI Assistant Overview
3
+ description: Learn about the AI-powered assistant features and multi-agent architecture.
4
+ ---
5
+
1
6
  # AI Assistant - Overview
2
7
 
3
8
  This theme includes an AI-powered assistant that helps users manage tasks, customers, and pages through natural language.
@@ -1,3 +1,8 @@
1
+ ---
2
+ title: AI Customization
3
+ description: Guide to customizing and extending the AI assistant with custom tools and handlers.
4
+ ---
5
+
1
6
  # AI Assistant - Customization
2
7
 
3
8
  This guide covers how to customize and extend the AI assistant for your specific needs.
@@ -0,0 +1,79 @@
1
+ ---
2
+ title: Configuration
3
+ description: Environment variables and configuration options for NextSpark applications.
4
+ ---
5
+
6
+ # Configuration Guide
7
+
8
+ This guide covers the configuration options available to administrators for setting up and customizing your NextSpark application.
9
+
10
+ ## Environment Variables
11
+
12
+ ### Required Variables
13
+
14
+ ```bash
15
+ # Database
16
+ DATABASE_URL="postgresql://user:password@localhost:5432/dbname"
17
+
18
+ # Authentication
19
+ BETTER_AUTH_SECRET="your-secret-key"
20
+
21
+ # Application
22
+ NEXT_PUBLIC_APP_URL="https://your-domain.com"
23
+ ```
24
+
25
+ ### Optional Variables
26
+
27
+ ```bash
28
+ # Email (for notifications)
29
+ SMTP_HOST="smtp.example.com"
30
+ SMTP_PORT="587"
31
+ SMTP_USER="user@example.com"
32
+ SMTP_PASSWORD="password"
33
+
34
+ # Billing (Stripe)
35
+ STRIPE_SECRET_KEY="sk_..."
36
+ STRIPE_WEBHOOK_SECRET="whsec_..."
37
+ NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_..."
38
+ ```
39
+
40
+ ## Configuration Files
41
+
42
+ ### app.config.ts
43
+
44
+ The main application configuration file located at `config/app.config.ts`:
45
+
46
+ ```typescript
47
+ export const APP_CONFIG_OVERRIDES = {
48
+ app: {
49
+ name: 'Your App Name',
50
+ version: '1.0.0',
51
+ },
52
+ teams: {
53
+ mode: 'multi-tenant', // or 'single-tenant', 'single-user'
54
+ },
55
+ i18n: {
56
+ supportedLocales: ['en', 'es'],
57
+ defaultLocale: 'en',
58
+ },
59
+ }
60
+ ```
61
+
62
+ ### permissions.config.ts
63
+
64
+ Define roles and permissions in `config/permissions.config.ts`:
65
+
66
+ ```typescript
67
+ export const PERMISSIONS_CONFIG = {
68
+ roles: {
69
+ additionalRoles: ['editor'],
70
+ hierarchy: { editor: 5 },
71
+ },
72
+ // ... permissions
73
+ }
74
+ ```
75
+
76
+ ## Next Steps
77
+
78
+ - [Deployment Guide](./02-deployment.md)
79
+ - [User Management](../02-management/01-users.md)
@@ -0,0 +1,82 @@
1
+ ---
2
+ title: Deployment
3
+ description: Guide to deploying NextSpark applications to Vercel, Docker, and other platforms.
4
+ ---
5
+
6
+ # Deployment Guide
7
+
8
+ This guide covers deploying your NextSpark application to production environments.
9
+
10
+ ## Prerequisites
11
+
12
+ - Node.js 18+ installed
13
+ - PostgreSQL database provisioned
14
+ - Domain configured with SSL
15
+
16
+ ## Vercel Deployment
17
+
18
+ ### 1. Connect Repository
19
+
20
+ 1. Go to [Vercel Dashboard](https://vercel.com/dashboard)
21
+ 2. Click "Add New Project"
22
+ 3. Import your Git repository
23
+
24
+ ### 2. Configure Environment Variables
25
+
26
+ Add all required environment variables in Vercel project settings:
27
+
28
+ ```
29
+ DATABASE_URL=postgresql://...
30
+ BETTER_AUTH_SECRET=...
31
+ NEXT_PUBLIC_APP_URL=https://your-domain.com
32
+ ```
33
+
34
+ ### 3. Deploy
35
+
36
+ Vercel will automatically build and deploy your application.
37
+
38
+ ## Docker Deployment
39
+
40
+ ### Build Image
41
+
42
+ ```bash
43
+ docker build -t nextspark-app .
44
+ ```
45
+
46
+ ### Run Container
47
+
48
+ ```bash
49
+ docker run -p 3000:3000 \
50
+ -e DATABASE_URL="postgresql://..." \
51
+ -e BETTER_AUTH_SECRET="..." \
52
+ nextspark-app
53
+ ```
54
+
55
+ ## Database Migrations
56
+
57
+ Run migrations before starting the application:
58
+
59
+ ```bash
60
+ pnpm db:migrate
61
+ ```
62
+
63
+ ## Health Checks
64
+
65
+ The application exposes health check endpoints:
66
+
67
+ - `/api/health` - Basic health check
68
+ - `/api/health/db` - Database connectivity check
69
+
70
+ ## Monitoring
71
+
72
+ Configure monitoring and alerting for:
73
+
74
+ - Application errors
75
+ - Database connection issues
76
+ - API response times
77
+ - Memory and CPU usage
78
+
79
+ ## Next Steps
80
+
81
+ - [Configuration Guide](./01-configuration.md)
82
+ - [User Management](../02-management/01-users.md)
@@ -0,0 +1,83 @@
1
+ ---
2
+ title: User Management
3
+ description: Managing users, teams, and roles in your NextSpark application.
4
+ ---
5
+
6
+ # User Management
7
+
8
+ This guide covers managing users and teams in your NextSpark application.
9
+
10
+ ## User Roles
11
+
12
+ ### System Roles
13
+
14
+ | Role | Description |
15
+ |------|-------------|
16
+ | `superadmin` | Full system access, can manage all users and teams |
17
+ | `developer` | Access to developer tools and debugging features |
18
+ | `member` | Standard user role |
19
+
20
+ ### Team Roles
21
+
22
+ | Role | Description |
23
+ |------|-------------|
24
+ | `owner` | Team creator, full team management |
25
+ | `admin` | Can manage team settings and members |
26
+ | `member` | Standard team member |
27
+ | `viewer` | Read-only access |
28
+
29
+ ## Managing Users
30
+
31
+ ### View All Users
32
+
33
+ Access the user management panel at `/superadmin/users`:
34
+
35
+ 1. Navigate to Superadmin Dashboard
36
+ 2. Click on "Users" in the sidebar
37
+ 3. Use filters to search by name, email, or role
38
+
39
+ ### Update User Role
40
+
41
+ 1. Find the user in the list
42
+ 2. Click on the user row to open details
43
+ 3. Select new role from dropdown
44
+ 4. Click "Save Changes"
45
+
46
+ ### Deactivate User
47
+
48
+ 1. Open user details
49
+ 2. Click "Deactivate Account"
50
+ 3. Confirm the action
51
+
52
+ ## Managing Teams
53
+
54
+ ### View All Teams
55
+
56
+ Access team management at `/superadmin/teams`:
57
+
58
+ - See all teams across the platform
59
+ - View team member counts
60
+ - Monitor team activity
61
+
62
+ ### Team Impersonation
63
+
64
+ Superadmins can view the application as any team member:
65
+
66
+ 1. Navigate to team details
67
+ 2. Click "Impersonate" on a team member
68
+ 3. You'll see the app from their perspective
69
+ 4. Click "Exit Impersonation" when done
70
+
71
+ ## Audit Logs
72
+
73
+ All administrative actions are logged. View logs at `/superadmin/logs`:
74
+
75
+ - User creation/deletion
76
+ - Role changes
77
+ - Team modifications
78
+ - Login attempts
79
+
80
+ ## Next Steps
81
+
82
+ - [Configuration Guide](../01-setup/01-configuration.md)
83
+ - [Deployment Guide](../01-setup/02-deployment.md)
@@ -0,0 +1,139 @@
1
+ ---
2
+ title: Langchain Integration
3
+ description: Configure and manage the AI-powered Langchain plugin for your application.
4
+ ---
5
+
6
+ # Langchain Integration
7
+
8
+ The Langchain plugin provides AI-powered capabilities to your application, including conversational agents, document processing, and intelligent automation.
9
+
10
+ ## Overview
11
+
12
+ Langchain is integrated as a plugin that can be enabled per-theme. It provides:
13
+
14
+ - **Conversational AI**: Build chat interfaces with context-aware responses
15
+ - **Memory Management**: Persistent conversation history with PostgreSQL storage
16
+ - **Tool Integration**: Connect AI to your application's data and actions
17
+ - **Streaming Responses**: Real-time AI responses for better UX
18
+
19
+ ## Configuration
20
+
21
+ ### Environment Variables
22
+
23
+ Add the following to your `.env` file:
24
+
25
+ ```bash
26
+ # OpenAI API Key (required)
27
+ OPENAI_API_KEY=sk-your-api-key-here
28
+
29
+ # Optional: Model configuration
30
+ LANGCHAIN_MODEL=gpt-4o-mini
31
+ LANGCHAIN_TEMPERATURE=0.7
32
+ LANGCHAIN_MAX_TOKENS=2000
33
+ ```
34
+
35
+ ### Plugin Activation
36
+
37
+ Enable the plugin in your theme configuration:
38
+
39
+ ```typescript
40
+ // themes/{theme}/config/theme.config.ts
41
+ export const themeConfig = {
42
+ plugins: ['langchain'],
43
+ // ...
44
+ }
45
+ ```
46
+
47
+ ## Database Setup
48
+
49
+ The plugin requires a memory table for conversation persistence. Run the migration:
50
+
51
+ ```bash
52
+ pnpm db:migrate
53
+ ```
54
+
55
+ This creates the `langchain_memory` table with the following schema:
56
+
57
+ | Column | Type | Description |
58
+ |--------|------|-------------|
59
+ | id | uuid | Primary key |
60
+ | sessionId | varchar | Conversation session identifier |
61
+ | messages | jsonb | Array of message objects |
62
+ | metadata | jsonb | Additional context data |
63
+ | createdAt | timestamp | Creation timestamp |
64
+ | updatedAt | timestamp | Last update timestamp |
65
+
66
+ ## Usage
67
+
68
+ ### Basic Chat Endpoint
69
+
70
+ The plugin exposes an API endpoint for chat interactions:
71
+
72
+ ```typescript
73
+ // POST /api/v1/ai/chat
74
+ {
75
+ "message": "Hello, how can you help me?",
76
+ "sessionId": "user-123-session-456"
77
+ }
78
+ ```
79
+
80
+ Response:
81
+
82
+ ```typescript
83
+ {
84
+ "success": true,
85
+ "data": {
86
+ "response": "Hello! I'm here to help you with...",
87
+ "sessionId": "user-123-session-456"
88
+ }
89
+ }
90
+ ```
91
+
92
+ ### Streaming Responses
93
+
94
+ For real-time streaming:
95
+
96
+ ```typescript
97
+ // POST /api/v1/ai/chat/stream
98
+ {
99
+ "message": "Explain quantum computing",
100
+ "sessionId": "user-123-session-456",
101
+ "stream": true
102
+ }
103
+ ```
104
+
105
+ ## Security Considerations
106
+
107
+ - **API Key Protection**: Never expose your OpenAI API key in client-side code
108
+ - **Rate Limiting**: Consider implementing rate limits per user/team
109
+ - **Content Filtering**: The plugin includes basic content moderation
110
+ - **Session Isolation**: Conversations are isolated by sessionId
111
+
112
+ ## Monitoring
113
+
114
+ View AI usage statistics in the Superadmin dashboard:
115
+
116
+ 1. Navigate to **Superadmin > Analytics** (coming soon)
117
+ 2. Select the **AI Usage** tab
118
+ 3. Monitor token usage, response times, and error rates
119
+
120
+ ## Troubleshooting
121
+
122
+ ### Common Issues
123
+
124
+ **"OPENAI_API_KEY not configured"**
125
+ - Ensure the environment variable is set
126
+ - Restart the development server after adding the key
127
+
128
+ **"Rate limit exceeded"**
129
+ - OpenAI has per-minute and per-day limits
130
+ - Consider implementing request queuing
131
+
132
+ **"Memory not persisting"**
133
+ - Verify the database migration ran successfully
134
+ - Check that `sessionId` is being passed consistently
135
+
136
+ ## Related Documentation
137
+
138
+ - [Plugin System](/docs/plugins/overview)
139
+ - [API Authentication](/docs/api/authentication)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextsparkjs/theme-default",
3
- "version": "0.1.0-beta.28",
3
+ "version": "0.1.0-beta.30",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./config/theme.config.ts",
@@ -9,7 +9,6 @@
9
9
  ],
10
10
  "dependencies": {},
11
11
  "peerDependencies": {
12
- "@nextsparkjs/core": "0.1.0-beta.24",
13
12
  "@tanstack/react-query": "^5.0.0",
14
13
  "lucide-react": "^0.539.0",
15
14
  "next": "^15.0.0",
@@ -17,10 +16,11 @@
17
16
  "react": "^19.0.0",
18
17
  "react-dom": "^19.0.0",
19
18
  "react-markdown": "^10.1.0",
20
- "zod": "^4.0.0"
19
+ "zod": "^4.0.0",
20
+ "@nextsparkjs/core": "0.1.0-beta.30"
21
21
  },
22
22
  "nextspark": {
23
23
  "type": "theme",
24
24
  "name": "default"
25
25
  }
26
- }
26
+ }
@@ -2,17 +2,17 @@
2
2
  * Cypress Configuration for Default Theme
3
3
  *
4
4
  * This config works in both monorepo and npm mode.
5
- * Run with: NEXT_PUBLIC_ACTIVE_THEME=default pnpm cy:open
5
+ * Run with: pnpm cy:open or pnpm cy:run
6
+ *
7
+ * Filter by tags: pnpm cy:tags "@smoke" or pnpm cy:run --env grepTags="@smoke"
6
8
  */
7
9
 
8
10
  import { defineConfig } from 'cypress'
9
11
  import path from 'path'
10
12
  import fs from 'fs'
11
- import { fileURLToPath } from 'url'
12
13
 
13
- // ESM-compatible __dirname
14
- const __filename = fileURLToPath(import.meta.url)
15
- const __dirname = path.dirname(__filename)
14
+ // __dirname is available because ts-node processes this file as CommonJS
15
+ // (Next.js projects don't use "type": "module" in package.json)
16
16
 
17
17
  // Paths relative to this config file
18
18
  const themeRoot = path.resolve(__dirname, '..')