create-saasicat-admin 0.2.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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # create-saasicat-admin
2
+
3
+ Scaffolding CLI for SuperAdmin frontend projects. Generates a runnable
4
+ Vue 3 + Quasar + Vite project that builds on `@saasicat/ui-vue` and ships
5
+ all standard pages.
6
+
7
+ ## Usage
8
+
9
+ ```bash
10
+ pnpm create saasicat-admin <dir> \
11
+ --project-key notesapp \
12
+ --brand-name NotesApp \
13
+ --logo-text NA \
14
+ --api-base /api/v1/admin
15
+ ```
16
+
17
+ Generates this directory structure:
18
+
19
+ ```
20
+ <dir>/
21
+ ├── package.json
22
+ ├── vite.config.ts
23
+ ├── index.html
24
+ ├── tsconfig.json
25
+ ├── src/
26
+ │ ├── main.ts (calls createSuperAdminApp)
27
+ │ ├── App.vue (<router-view />)
28
+ │ ├── services/http.ts (HTTP client + adminLogin stub)
29
+ │ ├── router/routes.ts (all standard pages)
30
+ │ └── styles/theme.scss
31
+ └── README.md
32
+ ```
33
+
34
+ Afterwards:
35
+
36
+ ```bash
37
+ cd <dir>
38
+ pnpm install
39
+ pnpm dev # http://localhost:9100/admin/login
40
+ ```
41
+
42
+ ## Options
43
+
44
+ | Flag | Default | Purpose |
45
+ | ---------------- | --------------- | -------------------------------------------------- |
46
+ | `--project-key` | `app` | used as prefix in storage keys + tokens |
47
+ | `--brand-name` | `App` | shown in the AdminLayout header |
48
+ | `--logo-text` | `AP` | two-letter badge in the logo |
49
+ | `--api-base` | `/api/v1/admin` | backend endpoint prefix |
50
+ | `--dev-port` | `9100` | Vite dev server port |
51
+ | `--backend-port` | `3000` | backend port for the Vite proxy |
52
+ | `--no-install` | false | only generate files, skip the final `pnpm install` |
53
+
54
+ ## What is left to do afterwards
55
+
56
+ 1. `src/services/http.ts` → adapt `adminLogin()` to your auth flow.
57
+ 2. Check the platform dependency versions in `package.json` — the templates
58
+ reference the `@saasicat/*` packages via semver from npm.
59
+ 3. Adapt the Vite proxy in `vite.config.ts` to your backend port.
60
+
61
+ Everything else comes from `@saasicat/ui-vue`.
package/bin/create.js ADDED
@@ -0,0 +1,179 @@
1
+ #!/usr/bin/env node
2
+ // `pnpm create saasicat-admin <dir>` — scaffold.
3
+ //
4
+ // Reads all `*.tpl` files from `../templates/`, replaces `__KEY__` tokens, writes
5
+ // into `<dir>/`. Tokens come from argv flags + defaults.
6
+ //
7
+ // Spec: handoff/superadmin/QUICKSTART_SIMPLIFICATIONS.md §P6.
8
+
9
+ import { fileURLToPath } from 'node:url';
10
+ import { dirname, join, resolve, relative } from 'node:path';
11
+ import { existsSync, readFileSync } from 'node:fs';
12
+ import { mkdir, readdir, readFile, writeFile, stat } from 'node:fs/promises';
13
+
14
+ // The scaffolded project must depend on the platform packages that match this
15
+ // scaffolder. All packages are released in lockstep, so our own version is the
16
+ // correct range — deriving it here keeps the template from drifting out of
17
+ // date on every release (a hardcoded `^0.1.0` would not match `0.2.0`, because
18
+ // caret pins the minor for 0.x versions).
19
+ const OWN_VERSION = JSON.parse(
20
+ readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
21
+ ).version;
22
+
23
+ export const DEFAULT_TOKENS = {
24
+ PROJECT_KEY: 'app',
25
+ BRAND_NAME: 'App',
26
+ LOGO_TEXT: 'AP',
27
+ API_BASE: '/api/v1/admin',
28
+ DEV_PORT: '9100',
29
+ BACKEND_PORT: '3000',
30
+ PLATFORM_VERSION: `^${OWN_VERSION}`,
31
+ };
32
+
33
+ const TOKEN_FLAGS = {
34
+ 'project-key': 'PROJECT_KEY',
35
+ 'brand-name': 'BRAND_NAME',
36
+ 'logo-text': 'LOGO_TEXT',
37
+ 'api-base': 'API_BASE',
38
+ 'dev-port': 'DEV_PORT',
39
+ 'backend-port': 'BACKEND_PORT',
40
+ };
41
+
42
+ export function parseArgs(argv) {
43
+ const positionals = [];
44
+ const flags = { dryRun: false, noInstall: false };
45
+ const tokens = { ...DEFAULT_TOKENS };
46
+ for (const arg of argv) {
47
+ if (arg === '--dry-run') {
48
+ flags.dryRun = true;
49
+ continue;
50
+ }
51
+ if (arg === '--no-install') {
52
+ flags.noInstall = true;
53
+ continue;
54
+ }
55
+ if (arg.startsWith('--')) {
56
+ const [key, value] = arg.slice(2).split('=');
57
+ if (TOKEN_FLAGS[key]) {
58
+ tokens[TOKEN_FLAGS[key]] = value ?? '';
59
+ }
60
+ continue;
61
+ }
62
+ positionals.push(arg);
63
+ }
64
+ return { positionals, flags, tokens };
65
+ }
66
+
67
+ export function applyTokens(content, tokens) {
68
+ return content.replace(/__([A-Z_]+)__/g, (full, key) => {
69
+ const value = tokens[key];
70
+ return value === undefined ? full : value;
71
+ });
72
+ }
73
+
74
+ export async function walkTemplates(root) {
75
+ const out = [];
76
+ async function recurse(dir) {
77
+ const entries = await readdir(dir);
78
+ for (const entry of entries) {
79
+ const full = join(dir, entry);
80
+ const st = await stat(full);
81
+ if (st.isDirectory()) {
82
+ await recurse(full);
83
+ } else if (entry.endsWith('.tpl')) {
84
+ const rel = relative(root, full).replace(/\.tpl$/, '');
85
+ out.push({ relPath: rel, absPath: full });
86
+ }
87
+ }
88
+ }
89
+ await recurse(root);
90
+ return out.sort((a, b) => a.relPath.localeCompare(b.relPath));
91
+ }
92
+
93
+ export async function scaffold({ targetDir, templatesDir, tokens, dryRun = false }) {
94
+ const files = await walkTemplates(templatesDir);
95
+ // Merge over the defaults so intrinsic tokens (PLATFORM_VERSION) are always
96
+ // present — a caller passing only the user-facing tokens must not end up
97
+ // with an unsubstituted dependency range in the generated package.json.
98
+ const effectiveTokens = { ...DEFAULT_TOKENS, ...tokens };
99
+ const writes = [];
100
+ for (const { relPath, absPath } of files) {
101
+ const raw = await readFile(absPath, 'utf8');
102
+ const rendered = applyTokens(raw, effectiveTokens);
103
+ const dest = join(targetDir, relPath);
104
+ writes.push({ relPath, dest, rendered });
105
+ }
106
+ if (dryRun) return writes;
107
+ await mkdir(targetDir, { recursive: true });
108
+ for (const w of writes) {
109
+ await mkdir(dirname(w.dest), { recursive: true });
110
+ await writeFile(w.dest, w.rendered, 'utf8');
111
+ }
112
+ return writes;
113
+ }
114
+
115
+ async function main() {
116
+ const argv = process.argv.slice(2);
117
+ const { positionals, flags, tokens } = parseArgs(argv);
118
+
119
+ if (positionals.length === 0 || positionals[0] === '--help' || positionals[0] === '-h') {
120
+ console.log('Usage: pnpm create saasicat-admin <dir> [flags]');
121
+ console.log('');
122
+ console.log('Flags:');
123
+ console.log(' --project-key=app storage key prefix');
124
+ console.log(' --brand-name=App brand name in the header');
125
+ console.log(' --logo-text=AP two-letter badge');
126
+ console.log(' --api-base=/api/v1/admin backend prefix');
127
+ console.log(' --dev-port=9100 Vite port');
128
+ console.log(' --backend-port=3000 backend port (Vite proxy)');
129
+ console.log(' --dry-run only list what would be created');
130
+ console.log(' --no-install stop after generating, skip pnpm install');
131
+ process.exit(0);
132
+ }
133
+
134
+ const targetDir = resolve(positionals[0]);
135
+ if (existsSync(targetDir) && !flags.dryRun) {
136
+ const contents = await readdir(targetDir).catch(() => []);
137
+ if (contents.length > 0) {
138
+ console.error(`✗ Target directory ${targetDir} is not empty. Aborting.`);
139
+ process.exit(1);
140
+ }
141
+ }
142
+
143
+ const templatesDir = resolve(dirname(fileURLToPath(import.meta.url)), '..', 'templates');
144
+ if (!existsSync(templatesDir)) {
145
+ console.error(`✗ Templates not found: ${templatesDir}`);
146
+ process.exit(99);
147
+ }
148
+
149
+ const writes = await scaffold({
150
+ targetDir,
151
+ templatesDir,
152
+ tokens,
153
+ dryRun: flags.dryRun,
154
+ });
155
+
156
+ if (flags.dryRun) {
157
+ console.log(`(--dry-run) Would create in ${targetDir}:`);
158
+ for (const w of writes) console.log(` ${w.relPath}`);
159
+ return;
160
+ }
161
+
162
+ console.log(`✓ Created ${writes.length} file(s) in ${targetDir}`);
163
+ for (const w of writes) console.log(` ${w.relPath}`);
164
+
165
+ console.log('');
166
+ console.log('Next steps:');
167
+ console.log(` cd ${relative(process.cwd(), targetDir) || '.'}`);
168
+ console.log(' pnpm install');
169
+ console.log(' pnpm dev');
170
+ console.log('');
171
+ console.log(`Adapt the login adapter (\`src/services/http.ts#adminLogin\`) to your backend.`);
172
+ }
173
+
174
+ if (import.meta.url === `file://${process.argv[1]}`) {
175
+ main().catch((err) => {
176
+ console.error('✗ ' + (err?.message ?? String(err)));
177
+ process.exit(99);
178
+ });
179
+ }
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "create-saasicat-admin",
3
+ "version": "0.2.0",
4
+ "description": "Scaffolding CLI for SuperAdmin frontend projects (Vue 3 + Quasar + Vite). Generates a minimal working admin app built on @saasicat/ui-vue. Usage: `pnpm create saasicat-admin <dir>`.",
5
+ "type": "module",
6
+ "bin": {
7
+ "create-saasicat-admin": "./bin/create.js"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "templates"
12
+ ],
13
+ "devDependencies": {
14
+ "@types/node": "^25.6.0"
15
+ },
16
+ "license": "Apache-2.0",
17
+ "author": "Taci Uelker",
18
+ "homepage": "https://github.com/uelker70/saasicat",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/uelker70/saasicat.git",
22
+ "directory": "packages/create-saasicat-admin"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/uelker70/saasicat/issues"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "scripts": {
31
+ "test": "node --test tests/**/*.test.js"
32
+ }
33
+ }
@@ -0,0 +1,24 @@
1
+ # __BRAND_NAME__ Admin
2
+
3
+ SuperAdmin frontend for __BRAND_NAME__, generated with
4
+ `create-saasicat-admin`.
5
+
6
+ ## Setup
7
+
8
+ ```bash
9
+ pnpm install
10
+ pnpm dev
11
+ ```
12
+
13
+ Reachable at `http://localhost:__DEV_PORT__/admin/login`.
14
+
15
+ The backend must listen on `http://localhost:__BACKEND_PORT__` and
16
+ serve `__API_BASE__/manifest`.
17
+
18
+ ## TODO
19
+
20
+ - Adapt `src/services/http.ts#adminLogin` to your backend auth.
21
+ - Add your own project pages in `src/router/routes.ts` (with
22
+ `createProjectPageHostRoute()` as a catch-all).
23
+ - Register KPI cards, tenant actions and project pages in your backend
24
+ manifest (see `docs/saas-platform.md §6.6` in the saasicat repo).
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+ <html lang="de">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>__BRAND_NAME__ SuperAdmin</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="/src/main.ts"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "__PROJECT_KEY__-admin",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vue-tsc -b && vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "@quasar/extras": "^1.16.0",
13
+ "@saasicat/types": "__PLATFORM_VERSION__",
14
+ "@saasicat/ui-vue": "__PLATFORM_VERSION__",
15
+ "axios": "^1.15.0",
16
+ "pinia": "^3.0.0",
17
+ "quasar": "^2.18.0",
18
+ "vue": "^3.5.0",
19
+ "vue-router": "^4.5.0"
20
+ },
21
+ "devDependencies": {
22
+ "@quasar/vite-plugin": "^1.10.0",
23
+ "@vitejs/plugin-vue": "^6.0.0",
24
+ "sass": "^1.83.0",
25
+ "typescript": "^5.7.0",
26
+ "vite": "^7.0.0",
27
+ "vue-tsc": "^2.2.0"
28
+ }
29
+ }
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <router-view />
3
+ </template>
@@ -0,0 +1,28 @@
1
+ // Bootstrap. createSuperAdminApp erledigt Quasar+Pinia+Router+Guards.
2
+
3
+ import 'quasar/src/css/index.sass';
4
+ import '@quasar/extras/material-icons/material-icons.css';
5
+
6
+ import { createSuperAdminApp } from '@saasicat/ui-vue';
7
+ import App from './App.vue';
8
+ import { appRoutes } from './router/routes';
9
+ import { adminLogin, isAuthenticated } from './services/http';
10
+
11
+ const handle = createSuperAdminApp({
12
+ rootComponent: App,
13
+ brand: { logoText: '__LOGO_TEXT__', name: '__BRAND_NAME__' },
14
+ endpoints: { apiBase: '__API_BASE__' },
15
+ appRoutes,
16
+ loginAdapter: { login: adminLogin },
17
+ authGuard: {
18
+ isAuthenticated,
19
+ onUnauthenticated: () => '/login',
20
+ },
21
+ manifestGuard: {
22
+ errorRoute: '/admin-error',
23
+ },
24
+ actions: {},
25
+ extensions: {},
26
+ });
27
+
28
+ handle.mount('#app');
@@ -0,0 +1,31 @@
1
+ import type { RouteRecordRaw } from 'vue-router';
2
+ import SuperAdminLoginPage from '@saasicat/ui-vue/pages/SuperAdminLoginPage.vue';
3
+ import AdminLayout from '@saasicat/ui-vue/pages/AdminLayout.vue';
4
+ import AdminManifestErrorPage from '@saasicat/ui-vue/pages/AdminManifestErrorPage.vue';
5
+ import DashboardPage from '@saasicat/ui-vue/pages/DashboardPage.vue';
6
+ import TenantsPage from '@saasicat/ui-vue/pages/TenantsPage.vue';
7
+ import PlansPage from '@saasicat/ui-vue/pages/PlansPage.vue';
8
+ import DiscoveryPage from '@saasicat/ui-vue/pages/DiscoveryPage.vue';
9
+
10
+ // Standard platform pages. Your own project pages are mounted via
11
+ // `createProjectPageHostRoute()` as a catch-all at the end.
12
+
13
+ export const appRoutes: RouteRecordRaw[] = [
14
+ { path: '/login', component: SuperAdminLoginPage, meta: { public: true } },
15
+ {
16
+ path: '/admin-error',
17
+ component: AdminManifestErrorPage,
18
+ meta: { public: true },
19
+ },
20
+ {
21
+ path: '/admin',
22
+ component: AdminLayout,
23
+ children: [
24
+ { path: '', redirect: '/admin/dashboard' },
25
+ { path: 'dashboard', component: DashboardPage },
26
+ { path: 'tenants', component: TenantsPage },
27
+ { path: 'plans', component: PlansPage },
28
+ { path: 'discovery', component: DiscoveryPage },
29
+ ],
30
+ },
31
+ ];
@@ -0,0 +1,59 @@
1
+ // HTTP client + login adapter for `createSuperAdminApp`.
2
+ //
3
+ // TODO: adapt `adminLogin` to your backend auth — POST body and token
4
+ // storage are app-specific.
5
+
6
+ import axios from 'axios';
7
+ import type { HttpClient, HttpResponse } from '@saasicat/ui-vue';
8
+
9
+ const TOKEN_KEY = '__PROJECT_KEY__-admin-token';
10
+
11
+ export const api = axios.create({ baseURL: '/api/v1' });
12
+ api.interceptors.request.use((cfg) => {
13
+ const t = localStorage.getItem(TOKEN_KEY);
14
+ if (t) cfg.headers.Authorization = `Bearer ${t}`;
15
+ return cfg;
16
+ });
17
+
18
+ export const platformHttp: HttpClient = async (url, init) => {
19
+ const stripped = url.startsWith('/api/v1') ? url.slice(7) : url;
20
+ const r = await api.request({
21
+ url: stripped,
22
+ method: (init?.method ?? 'GET') as 'GET' | 'POST',
23
+ headers: init?.headers,
24
+ data: init?.body,
25
+ validateStatus: (s) => s < 500,
26
+ });
27
+ const res: HttpResponse = {
28
+ status: r.status,
29
+ headers: {
30
+ get: (n) => {
31
+ const v = r.headers[n.toLowerCase()];
32
+ return v == null ? null : String(v);
33
+ },
34
+ },
35
+ json: async () => r.data,
36
+ text: async () =>
37
+ typeof r.data === 'string' ? r.data : JSON.stringify(r.data),
38
+ };
39
+ return res;
40
+ };
41
+
42
+ export async function adminLogin(email: string, password: string) {
43
+ try {
44
+ // TODO: replace the endpoint with your auth backend.
45
+ const r = await api.post('/auth/admin-login', { email, password });
46
+ localStorage.setItem(TOKEN_KEY, r.data.token);
47
+ return { ok: true as const };
48
+ } catch (e) {
49
+ const status = (e as { response?: { status?: number } })?.response?.status;
50
+ return {
51
+ ok: false as const,
52
+ code: status === 401 ? 'BAD_CREDENTIALS' : 'unknown',
53
+ };
54
+ }
55
+ }
56
+
57
+ export function isAuthenticated(): boolean {
58
+ return !!localStorage.getItem(TOKEN_KEY);
59
+ }
@@ -0,0 +1,8 @@
1
+ // Quasar theme variables — override your branding here.
2
+ $primary: #1e40af;
3
+ $secondary: #475569;
4
+ $accent: #0ea5e9;
5
+
6
+ $positive: #16a34a;
7
+ $negative: #dc2626;
8
+ $warning: #d97706;
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "lib": ["ES2023", "DOM"],
8
+ "types": ["vite/client"],
9
+ "skipLibCheck": true,
10
+ "jsx": "preserve",
11
+ "esModuleInterop": true,
12
+ "isolatedModules": true,
13
+ "noEmit": true,
14
+ "useDefineForClassFields": true
15
+ },
16
+ "include": ["src"]
17
+ }
@@ -0,0 +1,17 @@
1
+ import { defineConfig } from 'vite';
2
+ import vue from '@vitejs/plugin-vue';
3
+ import { quasar } from '@quasar/vite-plugin';
4
+
5
+ export default defineConfig({
6
+ base: '/admin/',
7
+ plugins: [vue(), quasar({ sassVariables: 'src/styles/theme.scss' })],
8
+ server: {
9
+ port: __DEV_PORT__,
10
+ proxy: {
11
+ '/api': {
12
+ target: 'http://localhost:__BACKEND_PORT__',
13
+ changeOrigin: true,
14
+ },
15
+ },
16
+ },
17
+ });