@colveor/create-admin 0.0.0-stage → 0.5.3

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.
Files changed (36) hide show
  1. package/LICENSE.md +106 -0
  2. package/README.md +183 -2
  3. package/index.js +105 -0
  4. package/look.js +68 -0
  5. package/package.json +25 -4
  6. package/template/README.md +19 -0
  7. package/template/TAILADMIN-LICENSE +21 -0
  8. package/template/TAILWINDADMIN-LICENSE +21 -0
  9. package/template/admin.config.ts +11 -0
  10. package/template/app/(admin)/(colveor)/audit/page.tsx +1 -0
  11. package/template/app/(admin)/(colveor)/ledger/page.tsx +1 -0
  12. package/template/app/(admin)/(colveor)/roles/page.tsx +1 -0
  13. package/template/app/(admin)/(colveor)/settings/page.tsx +1 -0
  14. package/template/app/(admin)/(colveor)/status/page.tsx +1 -0
  15. package/template/app/(admin)/(colveor)/support/page.tsx +1 -0
  16. package/template/app/(admin)/(colveor)/teams/page.tsx +1 -0
  17. package/template/app/(admin)/(colveor)/users/page.tsx +1 -0
  18. package/template/app/(admin)/(colveor)/webhooks/page.tsx +1 -0
  19. package/template/app/(admin)/(project)/.gitkeep +0 -0
  20. package/template/app/(admin)/account/page.tsx +1 -0
  21. package/template/app/(admin)/layout.tsx +7 -0
  22. package/template/app/(admin)/page.tsx +15 -0
  23. package/template/app/api/colveor/[...path]/route.ts +9 -0
  24. package/template/app/forgot-password/page.tsx +1 -0
  25. package/template/app/globals.css +283 -0
  26. package/template/app/layout.tsx +25 -0
  27. package/template/app/login/page.tsx +1 -0
  28. package/template/app/providers.tsx +14 -0
  29. package/template/components/frame.tsx +200 -0
  30. package/template/components/theme.tsx +41 -0
  31. package/template/env.example +2 -0
  32. package/template/gitignore +4 -0
  33. package/template/instrumentation.ts +9 -0
  34. package/template/package.json +24 -0
  35. package/template/postcss.config.mjs +1 -0
  36. package/template/tsconfig.json +26 -0
package/LICENSE.md ADDED
@@ -0,0 +1,106 @@
1
+ # Colveor Go — Proprietary Software License
2
+
3
+ **Copyright © 2026. All rights reserved.**
4
+
5
+ - **Software:** Colveor Go
6
+ - **License Type:** Proprietary
7
+ - **Usage:** Restricted — All rights reserved
8
+
9
+ ---
10
+
11
+ ## 1. Ownership and Intellectual Property
12
+
13
+ Colveor Go, including its source code, object code, architecture, algorithms, documentation, and associated materials, is proprietary software.
14
+
15
+ All rights, title, and interest in the software remain with the respective copyright owner, except for rights expressly granted in a separate written agreement.
16
+
17
+ No ownership, copyright, or intellectual property rights are transferred to any user, licensee, client, organization, or third party by accessing or using the software.
18
+
19
+ ## 2. Limited Permission to Use
20
+
21
+ The copyright owner may grant specific individuals, organizations, or projects permission to access and use Colveor Go for authorized purposes.
22
+
23
+ Unless otherwise agreed in a separate written license, such permission is:
24
+
25
+ - **Limited** to the authorized purpose.
26
+ - **Non-exclusive**, meaning the copyright owner may authorize others.
27
+ - **Non-transferable**, meaning the recipient cannot transfer the permission to another party.
28
+ - **Revocable**, subject to applicable law and contractual obligations.
29
+
30
+ Access to the repository does not automatically grant permission to use the software for unrelated projects or purposes outside the authorized scope.
31
+
32
+ ## 3. Restrictions
33
+
34
+ Unless expressly authorized in writing by the copyright owner, no recipient may:
35
+
36
+ - Redistribute, publish, sublicense, sell, rent, lease, or commercially exploit the software or substantial portions of it.
37
+ - Copy or incorporate the software into another product for distribution outside the authorized scope.
38
+ - Modify, adapt, reverse engineer, decompile, or disassemble the software, except to the extent such restrictions are prohibited by applicable law or expressly permitted in writing.
39
+ - Remove or alter copyright notices, ownership notices, or license terms.
40
+ - Claim authorship or ownership of the original software or its proprietary components.
41
+ - Share repository access, credentials, source code, or copies with unauthorized persons.
42
+ - Use protected confidential information or materials to create or distribute an unauthorized competing implementation.
43
+
44
+ ## 4. Client Projects and Third-Party Access
45
+
46
+ Permission to access or use Colveor Go for one project does not automatically authorize its use in other projects.
47
+
48
+ Any client, contractor, organization, or third party must obtain the appropriate authorization before accessing or using the software.
49
+
50
+ A separate written agreement may specify:
51
+
52
+ - Permitted projects and users.
53
+ - Authorized deployment environments.
54
+ - Modification and distribution rights.
55
+ - Commercial usage terms.
56
+ - Ownership of customizations and derivative works.
57
+
58
+ The copyright owner retains ownership of Colveor Go unless a separate written agreement expressly states otherwise.
59
+
60
+ ## 5. Contributions and Modifications
61
+
62
+ No contribution, modification, enhancement, or derivative work automatically transfers ownership of the original Colveor Go software.
63
+
64
+ Ownership of contributions and derivative works will be determined by applicable law and any relevant written agreements between the parties.
65
+
66
+ Recipients may not assume that permission to modify the software grants permission to distribute their modifications.
67
+
68
+ ## 6. Confidentiality
69
+
70
+ Where the software or related materials are disclosed as confidential information under an applicable agreement or law, recipients must protect that information and must not disclose or use it beyond the authorized purpose.
71
+
72
+ This section does not independently make information confidential where it is not otherwise protected by applicable law or agreement.
73
+
74
+ ## 7. Termination
75
+
76
+ Permission to use the software may be terminated in accordance with the applicable license agreement and law, including where a recipient materially breaches its terms.
77
+
78
+ Upon termination, the recipient must stop using the software and, where legally required or contractually agreed, return or securely delete unauthorized copies, subject to applicable legal retention obligations.
79
+
80
+ Termination does not extinguish rights or obligations that accrued before termination or provisions that are intended to survive termination.
81
+
82
+ ## 8. Disclaimer of Warranty
83
+
84
+ To the maximum extent permitted by applicable law, the software is provided **"AS IS"** and **"AS AVAILABLE,"** without warranties of any kind, whether express or implied, including warranties of merchantability, fitness for a particular purpose, and non-infringement.
85
+
86
+ ## 9. Limitation of Liability
87
+
88
+ To the maximum extent permitted by applicable law, the copyright owner shall not be liable for indirect, incidental, special, consequential, or punitive damages arising from the use of or inability to use the software.
89
+
90
+ Nothing in this license excludes or limits liability that cannot lawfully be excluded or limited.
91
+
92
+ ## 10. Reservation of Rights
93
+
94
+ All rights not expressly granted in writing are reserved by the copyright owner.
95
+
96
+ Nothing in this license grants a patent license, trademark license, or other intellectual property license except as expressly stated.
97
+
98
+ ## 11. Governing Law
99
+
100
+ The governing law and dispute-resolution arrangements shall be those specified in a separately executed written agreement. In the absence of such an agreement, applicable law will determine the governing law and competent forum.
101
+
102
+ ---
103
+
104
+ ## All Rights Reserved
105
+
106
+ Unauthorized use, copying, modification, or distribution may violate applicable intellectual property laws and contractual obligations.
package/README.md CHANGED
@@ -1,3 +1,184 @@
1
- # Temporary Holding Version
1
+ # @colveor/create-admin
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Creates the admin panel for an API built on **colveor-go**: a Next.js app
4
+ with sign-in, user and role management, settings, the audit log and the
5
+ rest of the framework's admin pages, ready to run, plus a place for your
6
+ own pages.
7
+
8
+ ```sh
9
+ npm create @colveor/admin@latest my-admin
10
+ cd my-admin
11
+ cp .env.example .env.local # set COLVEOR_API_URL
12
+ npm run dev # http://localhost:3000
13
+ ```
14
+
15
+ You need Node 20 or later and a running colveor-go API. Go is not needed:
16
+ the panel is a plain Node project, so a frontend team can own it.
17
+
18
+ ## What the command does
19
+
20
+ 1. Copies the template into `my-admin`. It stops if the folder exists and
21
+ isn't empty.
22
+ 2. Names the app after the folder: `acme` becomes `acme` in
23
+ `package.json` and "Acme Admin" in `admin.config.ts` and the README.
24
+ Change the name in `admin.config.ts`.
25
+ 3. Installs [`@colveor/admin`](https://www.npmjs.com/package/@colveor/admin)
26
+ at this command's release line (`~0.5.2` for create-admin 0.5.2), with
27
+ Next, React and Tailwind.
28
+ 4. Prints the next steps.
29
+
30
+ Options, after `--`:
31
+
32
+ | Option | What it does |
33
+ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
34
+ | `--no-install` | Copy and name only; run `npm install` yourself. |
35
+ | `--admin <path>` | Install a local `@colveor/admin` (a tarball from `npm pack`) instead of the published one. For testing a colveor-go change before it is released. |
36
+
37
+ ```sh
38
+ npm create @colveor/admin@latest my-admin -- --no-install
39
+ ```
40
+
41
+ ## Setting it up
42
+
43
+ **`.env.local`**
44
+
45
+ | Variable | |
46
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------- |
47
+ | `COLVEOR_API_URL` | The colveor-go API, such as `http://localhost:8080`. Read by the panel's server only; the browser never calls the API directly. |
48
+
49
+ **On the API**, add the panel server's address to `SERVER_TRUSTED_PROXIES`.
50
+ Every call reaches the API from the panel server, so without it every admin
51
+ shares one IP: one admin's failed sign-ins can then lock out the others,
52
+ and the audit log shows the server's IP instead of the admin's.
53
+
54
+ **Signing in:** any user of the API who holds an admin permission can sign
55
+ in. Pages are shown only to users holding their permission, so give your
56
+ admins a role with the permissions they need (the Roles page, once a super
57
+ admin is in).
58
+
59
+ ## What you get
60
+
61
+ ```
62
+ my-admin/
63
+ ├── admin.config.ts # the panel's name, logo and your menu items
64
+ ├── app/
65
+ │ ├── (admin)/ # every page inside the menu and header
66
+ │ │ ├── page.tsx # the home page
67
+ │ │ ├── account/ # the signed-in admin's own account
68
+ │ │ ├── (colveor)/ # the framework's pages: one-line re-exports
69
+ │ │ └── (project)/ # your pages
70
+ │ ├── api/colveor/[...path]/route.ts # the proxy to the API
71
+ │ ├── login/, forgot-password/ # sign-in pages
72
+ │ ├── layout.tsx # <html>, the font, globals.css
73
+ │ ├── providers.tsx # light and dark mode, and the admin shell
74
+ │ └── globals.css # the theme (brand colours, animations)
75
+ ├── instrumentation.ts # the banner at server start (remove for a quiet start)
76
+ ├── components/
77
+ │ ├── frame.tsx # the menu and header
78
+ │ └── theme.tsx # light and dark mode
79
+ └── .env.example
80
+ ```
81
+
82
+ The framework's pages: Users, Roles, Teams, Support access, Settings,
83
+ Audit log, Webhook events, System status and Ledger, with sign-in (password
84
+ or emailed code, then two-step verification), forgot password, and the
85
+ admin's own account (profile, password, two-step, devices, their data). A
86
+ page for an API module that is off is hidden.
87
+
88
+ ### Yours to change
89
+
90
+ Everything copied into your project is yours: the layout, `frame.tsx`
91
+ (menu and header), the theme in `globals.css`, the font, the home page and
92
+ `admin.config.ts`. These never get framework updates, so change them
93
+ freely.
94
+
95
+ ### Updated for you
96
+
97
+ Each file in `app/(admin)/(colveor)/` holds one line:
98
+
99
+ ```ts
100
+ export { default } from "@colveor/admin/pages/users";
101
+ ```
102
+
103
+ So `npm update @colveor/admin` brings fixes and new features to those
104
+ pages without touching your code. To replace one of our pages, replace that
105
+ one file.
106
+
107
+ ## Adding your own page
108
+
109
+ 1. Add `app/(admin)/(project)/invoices/page.tsx`, a normal Next page built
110
+ with `@colveor/admin`'s pieces, so it looks and behaves like ours:
111
+
112
+ ```tsx
113
+ "use client";
114
+
115
+ import { DataTable, PageHeader, RequirePermission, formatDate } from "@colveor/admin";
116
+
117
+ type Invoice = { id: string; number: string; total: number; created_at: string };
118
+
119
+ export default function InvoicesPage() {
120
+ return (
121
+ <RequirePermission keys={["invoices.read"]}>
122
+ <PageHeader title="Invoices" />
123
+ <DataTable<Invoice>
124
+ title="Invoices"
125
+ path="/v1/invoices"
126
+ download="invoices"
127
+ columns={[
128
+ { header: "Number", cell: (i) => i.number },
129
+ { header: "Total", cell: (i) => i.total },
130
+ { header: "Date", cell: (i) => formatDate(i.created_at) },
131
+ ]}
132
+ />
133
+ </RequirePermission>
134
+ );
135
+ }
136
+ ```
137
+
138
+ 2. Add it to the menu in `admin.config.ts`:
139
+
140
+ ```ts
141
+ export default defineConfig({
142
+ name: "Acme Admin",
143
+ logo: "/logo.svg",
144
+ nav: [
145
+ { label: "Invoices", href: "/invoices", permission: "invoices.read", group: "Sales" },
146
+ ],
147
+ });
148
+ ```
149
+
150
+ An item is shown only to admins holding its permission.
151
+
152
+ See [`@colveor/admin`](https://www.npmjs.com/package/@colveor/admin) for
153
+ every building block: the API client, tables, cards, dialogs, actions that
154
+ ask for a reason or re-authentication, and the generated API types.
155
+
156
+ ## Updating
157
+
158
+ ```sh
159
+ npm update @colveor/admin
160
+ ```
161
+
162
+ The panel follows colveor-go's versions: `@colveor/admin` 0.5.x works with
163
+ a colveor-go 0.5.x API. The System status page warns when they don't match.
164
+ To move to a new minor, install it with the API's version
165
+ (`npm install @colveor/admin@~0.6.0`) and read the changelog's **Breaking**
166
+ section for changes to your own pages.
167
+
168
+ ## Running in production
169
+
170
+ ```sh
171
+ npm run build
172
+ npm start
173
+ ```
174
+
175
+ Run **one** panel server, or route each admin's session to the same one.
176
+ The proxy keeps the API's tokens in `httpOnly` cookies and refreshes them
177
+ in the server's memory. A refresh token works once, so two servers
178
+ refreshing the same session would sign the admin out.
179
+
180
+ ## License
181
+
182
+ Proprietary: see `LICENSE.md`. The template's look comes from TailAdmin
183
+ and TailwindAdmin, both MIT (`TAILADMIN-LICENSE`, `TAILWINDADMIN-LICENSE`
184
+ in the created project).
package/index.js ADDED
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env node
2
+ // npm create @colveor/admin <dir>: a new admin panel from the template
3
+ // (the package @colveor/create-admin)
4
+ // (docs/admin.md in colveor-go, Creating a panel).
5
+ //
6
+ // --admin <path> use a local @colveor/admin (a colveor-go checkout's
7
+ // admin/packages/admin) instead of the published one
8
+ // --no-install copy only
9
+
10
+ import { spawnSync } from "node:child_process";
11
+ import { cpSync, existsSync, readdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
12
+ import { basename, dirname, join, relative, resolve } from "node:path";
13
+ import { fileURLToPath } from "node:url";
14
+ import { accent, banner, bold, cyan, dim, step } from "./look.js";
15
+
16
+ const here = dirname(fileURLToPath(import.meta.url));
17
+ const { version } = JSON.parse(readFileSync(join(here, "package.json"), "utf8"));
18
+
19
+ const args = process.argv.slice(2);
20
+ const flag = (name) => {
21
+ const i = args.indexOf(name);
22
+ return i === -1 ? undefined : (args.splice(i, name === "--admin" ? 2 : 1)[1] ?? "");
23
+ };
24
+ const localAdmin = flag("--admin");
25
+ const noInstall = flag("--no-install") !== undefined;
26
+ const [target] = args;
27
+
28
+ if (target === undefined || target.startsWith("-") || args.length > 1) {
29
+ step.fail(`usage: npm create @colveor/admin ${cyan("<dir>")} [-- --admin <path>] [--no-install]`);
30
+ process.exit(2);
31
+ }
32
+ const dir = resolve(target);
33
+ if (existsSync(dir) && readdirSync(dir).length > 0) {
34
+ step.fail(`${bold(target)} exists and is not empty: choose a new folder`);
35
+ process.exit(1);
36
+ }
37
+
38
+ console.log(`\n ${accent("◆")} ${bold("Creating a Colveor admin panel")} in ${cyan(target)}\n`);
39
+
40
+ cpSync(join(here, "template"), dir, { recursive: true });
41
+ // npm leaves these out of a published package under their real names.
42
+ renameSync(join(dir, "gitignore"), join(dir, ".gitignore"));
43
+ renameSync(join(dir, "env.example"), join(dir, ".env.example"));
44
+
45
+ const name = basename(dir)
46
+ .toLowerCase()
47
+ .replace(/[^a-z0-9-]+/g, "-");
48
+ const title = basename(dir)
49
+ .split(/[-_\s]+/)
50
+ .map((w) => w.charAt(0).toUpperCase() + w.slice(1))
51
+ .join(" ");
52
+ // The package of the same release as this command, or a local one.
53
+ const admin = localAdmin ? `file:${relative(dir, resolve(localAdmin))}` : `~${version}`;
54
+
55
+ for (const file of ["package.json", "admin.config.ts", "README.md"]) {
56
+ const path = join(dir, file);
57
+ writeFileSync(
58
+ path,
59
+ readFileSync(path, "utf8")
60
+ .replaceAll("__NAME__", name)
61
+ .replaceAll("__TITLE__", `${title} Admin`)
62
+ .replaceAll("__ADMIN__", admin),
63
+ );
64
+ }
65
+
66
+ step.done("Copied the template");
67
+ step.done(`Named it ${bold(`${title} Admin`)} ${dim("(admin.config.ts)")}`);
68
+
69
+ if (noInstall) {
70
+ step.done(`Left the install to you ${dim("(--no-install)")}`);
71
+ } else {
72
+ step.work(`Installing ${bold("@colveor/admin")} ${dim(admin)}, Next and React…\n`);
73
+ const npm = process.platform === "win32" ? "npm.cmd" : "npm";
74
+ const res = spawnSync(npm, ["install"], { cwd: dir, stdio: "inherit" });
75
+ if (res.status !== 0) {
76
+ step.fail(`npm install failed: run it again in ${bold(target)}`);
77
+ process.exit(1);
78
+ }
79
+ console.log();
80
+ step.done("Installed");
81
+ }
82
+
83
+ // The next commands, their notes lined up in a column.
84
+ const next = [
85
+ [`cd ${target}`, ""],
86
+ ...(noInstall ? [["npm install", ""]] : []),
87
+ ["cp .env.example .env.local", "set COLVEOR_API_URL"],
88
+ ["npm run dev", "http://localhost:3000"],
89
+ ];
90
+ const column = Math.max(...next.filter(([, n]) => n).map(([c]) => c.length)) + 2;
91
+ console.log(banner(version));
92
+ console.log(` ${bold("Ready.")} Next:\n`);
93
+ console.log(
94
+ next
95
+ .map(
96
+ ([cmd, note]) => ` ${accent("$")} ${note ? cmd.padEnd(column) + dim(`# ${note}`) : cmd}`,
97
+ )
98
+ .join("\n"),
99
+ );
100
+ console.log(
101
+ `\n ${dim("Your pages go in")} app/(admin)/(project)/${dim(", your menu in")} admin.config.ts${dim(".")}`,
102
+ );
103
+ console.log(
104
+ ` ${dim("Docs:")} README.md ${dim("·")} ${cyan("npmjs.com/package/@colveor/admin")}\n`,
105
+ );
package/look.js ADDED
@@ -0,0 +1,68 @@
1
+ // The command's look in the terminal: colours, step lines and the
2
+ // COLVEOR banner, in the panel's brand colours (the template's brand-500,
3
+ // #465FFF, into violet). No dependency: ANSI codes, off for NO_COLOR, a
4
+ // pipe or a CI log, and 16 colours where a terminal has no true colour.
5
+
6
+ const out = process.stdout;
7
+ const colour =
8
+ !("NO_COLOR" in process.env) &&
9
+ (("FORCE_COLOR" in process.env && process.env.FORCE_COLOR !== "0") ||
10
+ (out.isTTY === true && process.env.TERM !== "dumb"));
11
+ const truecolour = colour && /truecolor|24bit/i.test(process.env.COLORTERM ?? "");
12
+
13
+ const sgr = (open, close) => (s) => (colour ? `\x1b[${open}m${s}\x1b[${close}m` : s);
14
+
15
+ export const bold = sgr("1", "22");
16
+ export const dim = sgr("2", "22");
17
+ export const green = sgr("32", "39");
18
+ export const red = sgr("31", "39");
19
+ export const cyan = sgr("36", "39");
20
+
21
+ const BLUE = [70, 95, 255]; // brand-500
22
+ const VIOLET = [158, 119, 237];
23
+
24
+ /** The brand colour at t (0: blue, 1: violet). */
25
+ function brand(t, s) {
26
+ if (!colour) {
27
+ return s;
28
+ }
29
+ if (!truecolour) {
30
+ return `\x1b[${t < 0.5 ? 94 : 95}m${s}\x1b[39m`;
31
+ }
32
+ const [r, g, b] = BLUE.map((c, i) => Math.round(c + (VIOLET[i] - c) * t));
33
+ return `\x1b[38;2;${r};${g};${b}m${s}\x1b[39m`;
34
+ }
35
+
36
+ export const accent = (s) => brand(0, s);
37
+
38
+ /** A step: done (✔), working (◇), or failed (✖). */
39
+ export const step = {
40
+ done: (s) => console.log(` ${green("✔")} ${s}`),
41
+ work: (s) => console.log(` ${accent("◇")} ${s}`),
42
+ fail: (s) => console.error(` ${red("✖")} ${s}`),
43
+ };
44
+
45
+ // "ANSI Shadow", one letter at a time.
46
+ const LETTERS = {
47
+ C: [" ██████╗", "██╔════╝", "██║ ", "██║ ", "╚██████╗", " ╚═════╝"],
48
+ O: [" ██████╗ ", "██╔═══██╗", "██║ ██║", "██║ ██║", "╚██████╔╝", " ╚═════╝ "],
49
+ L: ["██╗ ", "██║ ", "██║ ", "██║ ", "███████╗", "╚══════╝"],
50
+ V: ["██╗ ██╗", "██║ ██║", "██║ ██║", "╚██╗ ██╔╝", " ╚████╔╝ ", " ╚═══╝ "],
51
+ E: ["███████╗", "██╔════╝", "█████╗ ", "██╔══╝ ", "███████╗", "╚══════╝"],
52
+ R: ["██████╗ ", "██╔══██╗", "██████╔╝", "██╔══██╗", "██║ ██║", "╚═╝ ╚═╝"],
53
+ };
54
+
55
+ /** COLVEOR in the brand gradient, with ADMIN and the version under it. */
56
+ export function banner(version) {
57
+ const rows = [0, 1, 2, 3, 4, 5].map((r) => [..."COLVEOR"].map((ch) => LETTERS[ch][r]).join(""));
58
+ const width = rows[0].length;
59
+ const lines = rows.map(
60
+ (row) =>
61
+ ` ${[...row].map((ch, i) => (ch === " " ? ch : brand(i / (width - 1), ch))).join("")}`,
62
+ );
63
+ const label = "A D M I N";
64
+ const tag = `v${version}`;
65
+ const gap = " ".repeat(Math.max(1, width - label.length - tag.length));
66
+ lines.push(` ${bold(brand(1, label))}${gap}${dim(tag)}`);
67
+ return `\n${lines.join("\n")}\n`;
68
+ }
package/package.json CHANGED
@@ -1,6 +1,27 @@
1
1
  {
2
2
  "name": "@colveor/create-admin",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.5.3",
4
+ "description": "Creates an admin panel for an app built on colveor-go.",
5
+ "license": "SEE LICENSE IN LICENSE.md",
6
+ "type": "module",
7
+ "bin": {
8
+ "create-admin": "index.js"
9
+ },
10
+ "files": [
11
+ "index.js",
12
+ "look.js",
13
+ "template",
14
+ "LICENSE.md"
15
+ ],
16
+ "scripts": {
17
+ "test": "node --test test/*.test.js",
18
+ "check": "npm test",
19
+ "e2e": "sh test/e2e.sh"
20
+ },
21
+ "engines": {
22
+ "node": ">=20"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public"
26
+ }
27
+ }
@@ -0,0 +1,19 @@
1
+ # **TITLE**
2
+
3
+ The admin panel of a colveor-go API, made with `npm create @colveor/admin`.
4
+
5
+ ```sh
6
+ cp .env.example .env.local # COLVEOR_API_URL: the API
7
+ npm run dev # http://localhost:3000
8
+ ```
9
+
10
+ - `admin.config.ts`: the panel's name, logo and your menu items.
11
+ - `app/(admin)/(project)/`: your own pages. They use the building blocks
12
+ of `@colveor/admin` (`api`, `useAction`, `DataTable`, `RequirePermission`).
13
+ - `app/(admin)/(colveor)/`: the framework's pages, each a one-line
14
+ re-export from `@colveor/admin`. `npm update @colveor/admin` updates them.
15
+ - `components/frame.tsx`: the menu and header. Yours to change.
16
+ - The API must trust this server's address in `SERVER_TRUSTED_PROXIES`, or
17
+ every admin shares one IP for its rate limits.
18
+
19
+ The look is TailAdmin's free Next.js template (MIT, `TAILADMIN-LICENSE`).
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 TailAdmin
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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tailwindadmin
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.
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from "@colveor/admin";
2
+
3
+ // The panel's name, logo and the project's own menu items, after the
4
+ // framework's (docs/admin.md in colveor-go). An item is shown only to users
5
+ // holding its permission.
6
+ export default defineConfig({
7
+ name: "__TITLE__",
8
+ nav: [
9
+ // { label: "Invoices", href: "/invoices", permission: "invoices.read" },
10
+ ],
11
+ });
@@ -0,0 +1 @@
1
+ export { default } from "@colveor/admin/pages/audit";
@@ -0,0 +1 @@
1
+ export { default } from "@colveor/admin/pages/ledger";
@@ -0,0 +1 @@
1
+ export { default } from "@colveor/admin/pages/roles";
@@ -0,0 +1 @@
1
+ export { default } from "@colveor/admin/pages/settings";
@@ -0,0 +1 @@
1
+ export { default } from "@colveor/admin/pages/status";
@@ -0,0 +1 @@
1
+ export { default } from "@colveor/admin/pages/support";
@@ -0,0 +1 @@
1
+ export { default } from "@colveor/admin/pages/teams";
@@ -0,0 +1 @@
1
+ export { default } from "@colveor/admin/pages/users";
@@ -0,0 +1 @@
1
+ export { default } from "@colveor/admin/pages/webhooks";
File without changes
@@ -0,0 +1 @@
1
+ export { default } from "@colveor/admin/pages/account";
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from "react";
2
+ import Frame from "../../components/frame";
3
+
4
+ // Every page but sign-in: the menu and the header around it.
5
+ export default function AdminLayout({ children }: { children: ReactNode }) {
6
+ return <Frame>{children}</Frame>;
7
+ }
@@ -0,0 +1,15 @@
1
+ "use client";
2
+
3
+ import { useAdmin } from "@colveor/admin";
4
+
5
+ export default function Home() {
6
+ const { config } = useAdmin();
7
+ return (
8
+ <div className="rounded-2xl border border-gray-200 bg-white p-6 dark:border-gray-800 dark:bg-white/[0.03]">
9
+ <h1 className="text-xl font-medium text-gray-800 dark:text-white/90">{config.name}</h1>
10
+ <p className="mt-2 text-sm text-gray-500 dark:text-gray-400">
11
+ Pick a page in the menu. Your own pages go in app/(admin)/(project)/.
12
+ </p>
13
+ </div>
14
+ );
15
+ }
@@ -0,0 +1,9 @@
1
+ // Every call from the panel to the API goes through here, with the
2
+ // tokens kept in httpOnly cookies (docs/admin.md in colveor-go).
3
+ export {
4
+ handler as DELETE,
5
+ handler as GET,
6
+ handler as PATCH,
7
+ handler as POST,
8
+ handler as PUT,
9
+ } from "@colveor/admin/proxy";
@@ -0,0 +1 @@
1
+ export { default } from "@colveor/admin/pages/forgot-password";
@@ -0,0 +1,283 @@
1
+ /* The theme of TailAdmin (free Next.js version, MIT: TAILADMIN-LICENSE),
2
+ from its src/app/globals.css: tokens, base styles and menu utilities.
3
+ The styles of charts, calendars and maps it doesn't use are left out. */
4
+ @import "tailwindcss";
5
+ @plugin "@tailwindcss/forms";
6
+
7
+ /* The @colveor/admin pages use these classes too. */
8
+ @source "../node_modules/@colveor/admin/dist";
9
+
10
+ @custom-variant dark (&:is(.dark *));
11
+
12
+ @theme {
13
+ --font-*: initial;
14
+ --font-rounded: "M PLUS Rounded 1c", sans-serif;
15
+
16
+ --breakpoint-*: initial;
17
+ --breakpoint-2xsm: 375px;
18
+ --breakpoint-xsm: 425px;
19
+ --breakpoint-3xl: 2000px;
20
+ --breakpoint-sm: 640px;
21
+ --breakpoint-md: 768px;
22
+ --breakpoint-lg: 1024px;
23
+ --breakpoint-xl: 1280px;
24
+ --breakpoint-2xl: 1536px;
25
+
26
+ --text-heading-one: 64px;
27
+ --text-heading-one--line-height: 80px;
28
+ --text-heading-two: 56px;
29
+ --text-heading-two--line-height: 72px;
30
+ --text-heading-three: 48px;
31
+ --text-heading-three--line-height: 60px;
32
+ --text-heading-four: 40px;
33
+ --text-heading-four--line-height: 48px;
34
+ --text-heading-five: 32px;
35
+ --text-heading-five--line-height: 40px;
36
+ --text-heading-six: 24px;
37
+ --text-heading-six--line-height: 32px;
38
+
39
+ --text-title-lg: 20px;
40
+ --text-title-lg--line-height: 30px;
41
+ --text-title-sm: 18px;
42
+ --text-title-sm--line-height: 28px;
43
+
44
+ --color-current: currentColor;
45
+ --color-transparent: transparent;
46
+ --color-white: #ffffff;
47
+ --color-black: #101828;
48
+
49
+ --color-brand-50: rgba(236, 243, 255, 1);
50
+ --color-brand-100: rgba(221, 233, 255, 1);
51
+ --color-brand-200: rgba(194, 214, 255, 1);
52
+ --color-brand-300: rgba(156, 185, 255, 1);
53
+ --color-brand-400: rgba(117, 146, 255, 1);
54
+ --color-brand-500: rgba(70, 95, 255, 1);
55
+ --color-brand-600: rgba(54, 65, 245, 1);
56
+ --color-brand-700: rgba(42, 49, 216, 1);
57
+ --color-brand-800: rgba(37, 45, 174, 1);
58
+ --color-brand-900: rgba(38, 46, 137, 1);
59
+ --color-brand-950: rgba(22, 25, 80, 1);
60
+
61
+ --shadow-theme-md:
62
+ 0px 4px 8px -2px rgba(16, 24, 40, 0.1), 0px 2px 4px -2px rgba(16, 24, 40, 0.06);
63
+ --shadow-theme-lg:
64
+ 0px 12px 16px -4px rgba(16, 24, 40, 0.08), 0px 4px 6px -2px rgba(16, 24, 40, 0.03);
65
+ --shadow-theme-sm: 0px 1px 3px 0px rgba(16, 24, 40, 0.1), 0px 1px 2px 0px rgba(16, 24, 40, 0.06);
66
+ --shadow-theme-xs: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
67
+ --shadow-theme-xl:
68
+ 0px 20px 24px -4px rgba(16, 24, 40, 0.08), 0px 8px 8px -4px rgba(16, 24, 40, 0.03);
69
+ --shadow-datepicker: -5px 0 0 #262d3c, 5px 0 0 #262d3c;
70
+ --shadow-focus-ring: 0px 0px 0px 4px rgba(70, 95, 255, 0.12);
71
+ --shadow-slider-navigation:
72
+ 0px 1px 2px 0px rgba(16, 24, 40, 0.1), 0px 1px 3px 0px rgba(16, 24, 40, 0.1);
73
+ --shadow-tooltip:
74
+ 0px 4px 6px -2px rgba(16, 24, 40, 0.05), -8px 0px 20px 8px rgba(16, 24, 40, 0.05);
75
+
76
+ --drop-shadow-4xl: 0 35px 35px rgba(0, 0, 0, 0.25), 0 45px 65px rgba(0, 0, 0, 0.15);
77
+
78
+ --z-index-1: 1;
79
+ --z-index-9: 9;
80
+ --z-index-99: 99;
81
+ --z-index-999: 999;
82
+ --z-index-9999: 9999;
83
+ --z-index-99999: 99999;
84
+ --z-index-999999: 999999;
85
+
86
+ --animate-caret-blink: caret-blink 1.25s ease-out infinite;
87
+
88
+ @keyframes caret-blink {
89
+ 0%,
90
+ 70%,
91
+ 100% {
92
+ opacity: 1;
93
+ }
94
+ 20%,
95
+ 50% {
96
+ opacity: 0;
97
+ }
98
+ }
99
+ }
100
+
101
+ /*
102
+ The default border color has changed to `currentColor` in Tailwind CSS v4,
103
+ so we've added these compatibility styles to make sure everything still
104
+ looks the same as it did with Tailwind CSS v3.
105
+
106
+ If we ever want to remove these styles, we need to add an explicit border
107
+ color utility to any element that depends on these defaults.
108
+ */
109
+ @layer base {
110
+ *,
111
+ ::after,
112
+ ::before,
113
+ ::backdrop,
114
+ ::file-selector-button {
115
+ border-color: var(--color-gray-200, currentColor);
116
+ }
117
+
118
+ button:not(:disabled),
119
+ [role="button"]:not(:disabled) {
120
+ cursor: pointer;
121
+ }
122
+
123
+ body {
124
+ @apply relative z-1 bg-gray-50 font-rounded font-normal;
125
+ }
126
+ }
127
+
128
+ @utility menu-item {
129
+ @apply relative flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium;
130
+ }
131
+
132
+ @utility menu-item-active {
133
+ @apply bg-brand-50 text-brand-500 dark:bg-brand-500/12 dark:text-brand-400;
134
+ }
135
+
136
+ @utility menu-item-inactive {
137
+ @apply text-gray-700 group-hover:text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-white/5 dark:hover:text-gray-300;
138
+ }
139
+
140
+ @utility menu-item-icon {
141
+ @apply text-gray-500 group-hover:text-gray-700 dark:text-gray-400;
142
+ }
143
+
144
+ @utility menu-item-icon-active {
145
+ @apply text-brand-500 dark:text-brand-400;
146
+ }
147
+
148
+ @utility menu-item-icon-inactive {
149
+ @apply text-gray-500 group-hover:text-gray-700 dark:text-gray-400 dark:group-hover:text-gray-300;
150
+ }
151
+
152
+ @utility menu-item-arrow {
153
+ @apply relative;
154
+ }
155
+
156
+ @utility menu-item-arrow-active {
157
+ @apply rotate-180 text-brand-500 dark:text-brand-400;
158
+ }
159
+
160
+ @utility menu-item-arrow-inactive {
161
+ @apply text-gray-500 group-hover:text-gray-700 dark:text-gray-400 dark:group-hover:text-gray-300;
162
+ }
163
+
164
+ @utility menu-dropdown-item {
165
+ @apply relative flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium;
166
+ }
167
+
168
+ @utility menu-dropdown-item-active {
169
+ @apply bg-brand-50 text-brand-500 dark:bg-brand-500/12 dark:text-brand-400;
170
+ }
171
+
172
+ @utility menu-dropdown-item-inactive {
173
+ @apply text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-white/5;
174
+ }
175
+
176
+ @utility menu-dropdown-badge {
177
+ @apply block rounded-full px-2.5 py-0.5 text-xs font-medium text-green-600 uppercase dark:text-green-500;
178
+ }
179
+
180
+ @utility menu-dropdown-badge-active {
181
+ @apply bg-green-100 dark:bg-green-500/20;
182
+ }
183
+
184
+ @utility menu-dropdown-badge-inactive {
185
+ @apply bg-green-50 group-hover:bg-green-100 dark:bg-green-500/15 dark:group-hover:bg-green-500/20;
186
+ }
187
+
188
+ @utility menu-dropdown-badge-pro {
189
+ @apply block rounded-full px-2.5 py-0.5 text-xs font-medium text-brand-600 uppercase dark:text-brand-500;
190
+ }
191
+
192
+ @utility menu-dropdown-badge-pro-active {
193
+ @apply bg-brand-100 dark:bg-brand-500/20;
194
+ }
195
+
196
+ @utility menu-dropdown-badge-pro-inactive {
197
+ @apply bg-brand-50 group-hover:bg-brand-100 dark:bg-brand-500/15 dark:group-hover:bg-brand-500/20;
198
+ }
199
+
200
+ @utility no-scrollbar {
201
+ /* Chrome, Safari and Opera */
202
+ &::-webkit-scrollbar {
203
+ display: none;
204
+ }
205
+
206
+ -ms-overflow-style: none; /* IE and Edge */
207
+ scrollbar-width: none; /* Firefox */
208
+ }
209
+
210
+ @utility custom-scrollbar {
211
+ &::-webkit-scrollbar {
212
+ @apply size-1.5;
213
+ }
214
+
215
+ &::-webkit-scrollbar-track {
216
+ @apply rounded-full;
217
+ }
218
+
219
+ &::-webkit-scrollbar-thumb {
220
+ @apply rounded-full bg-gray-200 dark:bg-gray-700;
221
+ }
222
+ }
223
+
224
+ .dark .custom-scrollbar::-webkit-scrollbar-thumb {
225
+ @apply bg-gray-700;
226
+ }
227
+
228
+ /* Motion for the panel and @colveor/admin: dropdowns, dialogs, menus. A
229
+ panel made before these existed simply doesn't animate. */
230
+ @theme {
231
+ --animate-fade-in: fade-in 150ms ease-out;
232
+ --animate-pop-in: pop-in 160ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
233
+ --animate-slide-down: slide-down 200ms ease-out;
234
+ --animate-slide-in: slide-in 220ms ease-out;
235
+
236
+ @keyframes fade-in {
237
+ from {
238
+ opacity: 0;
239
+ }
240
+ to {
241
+ opacity: 1;
242
+ }
243
+ }
244
+ @keyframes pop-in {
245
+ from {
246
+ opacity: 0;
247
+ transform: translateY(-6px) scale(0.97);
248
+ }
249
+ to {
250
+ opacity: 1;
251
+ transform: none;
252
+ }
253
+ }
254
+ @keyframes slide-down {
255
+ from {
256
+ opacity: 0;
257
+ transform: translateY(-4px);
258
+ }
259
+ to {
260
+ opacity: 1;
261
+ transform: none;
262
+ }
263
+ }
264
+ @keyframes slide-in {
265
+ from {
266
+ opacity: 0;
267
+ transform: translateX(12px);
268
+ }
269
+ to {
270
+ opacity: 1;
271
+ transform: none;
272
+ }
273
+ }
274
+ }
275
+
276
+ @media (prefers-reduced-motion: reduce) {
277
+ *,
278
+ ::before,
279
+ ::after {
280
+ animation-duration: 1ms !important;
281
+ transition-duration: 1ms !important;
282
+ }
283
+ }
@@ -0,0 +1,25 @@
1
+ import type { Metadata } from "next";
2
+ import { M_PLUS_Rounded_1c } from "next/font/google";
3
+ import type { ReactNode } from "react";
4
+ import config from "../admin.config";
5
+ import Providers from "./providers";
6
+ import "./globals.css";
7
+
8
+ // Not a variable font: each weight used is listed. It has no 600, so the
9
+ // panel uses font-medium where it would use font-semibold.
10
+ const font = M_PLUS_Rounded_1c({
11
+ subsets: ["latin"],
12
+ weight: ["400", "500", "700", "800"],
13
+ });
14
+
15
+ export const metadata: Metadata = { title: config.name };
16
+
17
+ export default function RootLayout({ children }: { children: ReactNode }) {
18
+ return (
19
+ <html lang="en" suppressHydrationWarning>
20
+ <body className={`${font.className} dark:bg-gray-900`}>
21
+ <Providers>{children}</Providers>
22
+ </body>
23
+ </html>
24
+ );
25
+ }
@@ -0,0 +1 @@
1
+ export { default } from "@colveor/admin/pages/sign-in";
@@ -0,0 +1,14 @@
1
+ "use client";
2
+
3
+ import { NextAdmin } from "@colveor/admin/next";
4
+ import type { ReactNode } from "react";
5
+ import config from "../admin.config";
6
+ import { ThemeProvider } from "../components/theme";
7
+
8
+ export default function Providers({ children }: { children: ReactNode }) {
9
+ return (
10
+ <ThemeProvider>
11
+ <NextAdmin config={config}>{children}</NextAdmin>
12
+ </ThemeProvider>
13
+ );
14
+ }
@@ -0,0 +1,200 @@
1
+ "use client";
2
+
3
+ // The menu and the header, in the look of TailAdmin and TailwindAdmin (both
4
+ // MIT: TAILADMIN-LICENSE, TAILWINDADMIN-LICENSE).
5
+ // The menu is useNav(): the framework's pages, then admin.config.ts's
6
+ // items, each shown only to users holding its permission. On large screens
7
+ // it collapses to icons (and opens while hovered); on small ones it slides
8
+ // in over the page. This file is the project's: change it freely.
9
+
10
+ import {
11
+ iconButton,
12
+ NavSearch,
13
+ NotificationsMenu,
14
+ UserMenu,
15
+ useAdmin,
16
+ useNav,
17
+ } from "@colveor/admin";
18
+ import { type ReactNode, useEffect, useState } from "react";
19
+ import { useTheme } from "./theme";
20
+
21
+ export default function Frame({ children }: { children: ReactNode }) {
22
+ const { config, router } = useAdmin();
23
+ const nav = useNav();
24
+ const { theme, toggleTheme } = useTheme();
25
+ const [collapsed, setCollapsed] = useState(false);
26
+ const [hovered, setHovered] = useState(false);
27
+ const [mobileOpen, setMobileOpen] = useState(false);
28
+ const [scrolled, setScrolled] = useState(false);
29
+
30
+ // The header gains a shadow once the page scrolls under it.
31
+ useEffect(() => {
32
+ const onScroll = () => setScrolled(window.scrollY > 10);
33
+ window.addEventListener("scroll", onScroll, { passive: true });
34
+ return () => window.removeEventListener("scroll", onScroll);
35
+ }, []);
36
+ const { Link } = router;
37
+ const wide = !collapsed || hovered || mobileOpen;
38
+
39
+ // A page picked on a phone closes the menu.
40
+ useEffect(() => setMobileOpen(false), [router.pathname]);
41
+
42
+ const toggle = () => {
43
+ if (window.matchMedia("(min-width: 1280px)").matches) {
44
+ setCollapsed(!collapsed);
45
+ } else {
46
+ setMobileOpen(!mobileOpen);
47
+ }
48
+ };
49
+
50
+ return (
51
+ <div className="min-h-screen xl:flex">
52
+ {mobileOpen && (
53
+ <button
54
+ type="button"
55
+ aria-label="Close the menu"
56
+ onClick={() => setMobileOpen(false)}
57
+ className="fixed inset-0 z-40 animate-fade-in bg-gray-900/50 xl:hidden"
58
+ />
59
+ )}
60
+ <aside
61
+ onMouseEnter={() => setHovered(true)}
62
+ onMouseLeave={() => setHovered(false)}
63
+ className={`fixed top-0 left-0 z-50 flex h-screen flex-col border-r border-gray-200 bg-white px-5 transition-all duration-300 ease-in-out dark:border-gray-800 dark:bg-gray-900 ${
64
+ wide ? "w-72.5" : "w-22.5"
65
+ } ${mobileOpen ? "translate-x-0" : "-translate-x-full"} xl:translate-x-0`}
66
+ >
67
+ <div className={`flex items-center gap-3 py-8 ${wide ? "" : "justify-center"}`}>
68
+ {config.logo !== undefined ? (
69
+ <img src={config.logo} alt="" className="h-8" />
70
+ ) : (
71
+ <span className="flex size-8 shrink-0 items-center justify-center rounded-lg bg-brand-500 text-sm font-bold text-white">
72
+ {config.name.charAt(0)}
73
+ </span>
74
+ )}
75
+ {wide && (
76
+ <span className="animate-fade-in truncate text-title-sm font-medium text-gray-800 dark:text-white/90">
77
+ {config.name}
78
+ </span>
79
+ )}
80
+ </div>
81
+ <nav className="no-scrollbar flex flex-col gap-1 overflow-y-auto pb-6">
82
+ {nav.map((item, i) => {
83
+ const active =
84
+ router.pathname === item.href || router.pathname.startsWith(`${item.href}/`);
85
+ const heading = item.group !== undefined && item.group !== nav[i - 1]?.group;
86
+ return (
87
+ <div key={item.href}>
88
+ {heading && (
89
+ <h2
90
+ className={`mt-5 mb-2 text-xs font-bold text-gray-400 uppercase first:mt-0 ${
91
+ wide ? "px-3" : "text-center"
92
+ }`}
93
+ >
94
+ {wide ? item.group : "•••"}
95
+ </h2>
96
+ )}
97
+ <Link
98
+ href={item.href}
99
+ className={`group flex items-center gap-3 rounded-full px-3 py-2.5 text-sm font-medium transition-all duration-300 ease-in-out ${
100
+ active
101
+ ? "bg-brand-500 text-white shadow-sm"
102
+ : "text-gray-600 hover:translate-x-1 hover:bg-brand-50 hover:text-brand-500 dark:text-gray-300 dark:hover:bg-brand-500/10"
103
+ } ${wide ? "" : "justify-center hover:translate-x-0"}`}
104
+ >
105
+ <span className="shrink-0 transition-transform duration-300 group-hover:scale-110">
106
+ {item.icon ?? <Dot />}
107
+ </span>
108
+ {wide && <span className="animate-fade-in truncate">{item.label}</span>}
109
+ </Link>
110
+ </div>
111
+ );
112
+ })}
113
+ </nav>
114
+ </aside>
115
+
116
+ <div
117
+ className={`flex-1 transition-all duration-300 ease-in-out ${
118
+ collapsed ? "xl:ml-22.5" : "xl:ml-72.5"
119
+ }`}
120
+ >
121
+ <header
122
+ className={`sticky top-0 z-30 flex w-full items-center gap-4 bg-white/90 px-4 py-3 backdrop-blur transition-shadow duration-300 dark:bg-gray-900/90 xl:px-6 xl:py-4 ${
123
+ scrolled
124
+ ? "shadow-md dark:shadow-black/30"
125
+ : "border-b border-gray-200 dark:border-gray-800"
126
+ }`}
127
+ >
128
+ <button
129
+ type="button"
130
+ aria-label="Menu"
131
+ onClick={toggle}
132
+ className="flex size-11 items-center justify-center rounded-lg border border-gray-200 text-gray-500 transition-colors hover:bg-gray-100 dark:border-gray-800 dark:text-gray-400 dark:hover:bg-gray-800"
133
+ >
134
+ <svg width={20} height={20} viewBox="0 0 24 24" fill="none" aria-hidden="true">
135
+ <path
136
+ d="M4 6h16M4 12h10M4 18h16"
137
+ stroke="currentColor"
138
+ strokeWidth={1.8}
139
+ strokeLinecap="round"
140
+ />
141
+ </svg>
142
+ </button>
143
+ <NavSearch />
144
+ <div className="ml-auto flex items-center gap-2 sm:gap-4">
145
+ <button
146
+ type="button"
147
+ aria-label="Light or dark"
148
+ onClick={toggleTheme}
149
+ className={iconButton}
150
+ >
151
+ <span key={theme} className="animate-pop-in">
152
+ {theme === "dark" ? <SunIcon /> : <MoonIcon />}
153
+ </span>
154
+ </button>
155
+ <NotificationsMenu />
156
+ <UserMenu />
157
+ </div>
158
+ </header>
159
+ <main
160
+ key={router.pathname}
161
+ className="mx-auto max-w-(--breakpoint-2xl) animate-fade-in p-4 md:p-6"
162
+ >
163
+ {children}
164
+ </main>
165
+ </div>
166
+ </div>
167
+ );
168
+ }
169
+
170
+ function Dot() {
171
+ return <span className="mx-2 block size-1.5 rounded-full bg-current" />;
172
+ }
173
+
174
+ function MoonIcon() {
175
+ return (
176
+ <svg width={20} height={20} viewBox="0 0 20 20" fill="none" aria-hidden="true">
177
+ <path
178
+ d="M6.247 6.668a6.668 6.668 0 0011.207 4.885A7.708 7.708 0 118.03 2.129a6.645 6.645 0 00-1.783 4.54z"
179
+ stroke="currentColor"
180
+ strokeWidth={1.5}
181
+ strokeLinecap="round"
182
+ strokeLinejoin="round"
183
+ />
184
+ </svg>
185
+ );
186
+ }
187
+
188
+ function SunIcon() {
189
+ return (
190
+ <svg width={16} height={16} viewBox="0 0 24 24" fill="none" aria-hidden="true">
191
+ <circle cx={12} cy={12} r={4} stroke="currentColor" strokeWidth={1.5} />
192
+ <path
193
+ d="M12 2v2m0 16v2M4.22 4.22l1.42 1.42m12.72 12.72l1.42 1.42M2 12h2m16 0h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"
194
+ stroke="currentColor"
195
+ strokeWidth={1.5}
196
+ strokeLinecap="round"
197
+ />
198
+ </svg>
199
+ );
200
+ }
@@ -0,0 +1,41 @@
1
+ "use client";
2
+
3
+ // Light and dark mode, kept in localStorage (from TailAdmin's
4
+ // context/theme-context.tsx, MIT: TAILADMIN-LICENSE).
5
+
6
+ import { createContext, type ReactNode, useContext, useEffect, useState } from "react";
7
+
8
+ type Theme = "light" | "dark";
9
+
10
+ const ThemeContext = createContext<{ theme: Theme; toggleTheme(): void } | null>(null);
11
+
12
+ export function ThemeProvider({ children }: { children: ReactNode }) {
13
+ const [theme, setTheme] = useState<Theme | null>(null);
14
+
15
+ useEffect(() => {
16
+ setTheme(localStorage.getItem("theme") === "dark" ? "dark" : "light");
17
+ }, []);
18
+
19
+ useEffect(() => {
20
+ if (theme !== null) {
21
+ localStorage.setItem("theme", theme);
22
+ document.documentElement.classList.toggle("dark", theme === "dark");
23
+ }
24
+ }, [theme]);
25
+
26
+ const toggleTheme = () => setTheme((t) => (t === "dark" ? "light" : "dark"));
27
+
28
+ return (
29
+ <ThemeContext.Provider value={{ theme: theme ?? "light", toggleTheme }}>
30
+ {children}
31
+ </ThemeContext.Provider>
32
+ );
33
+ }
34
+
35
+ export function useTheme() {
36
+ const theme = useContext(ThemeContext);
37
+ if (theme === null) {
38
+ throw new Error("useTheme is used outside <ThemeProvider>");
39
+ }
40
+ return theme;
41
+ }
@@ -0,0 +1,2 @@
1
+ # The colveor-go API this panel talks to (copy to .env.local).
2
+ COLVEOR_API_URL=http://localhost:8080
@@ -0,0 +1,4 @@
1
+ node_modules/
2
+ .next/
3
+ next-env.d.ts
4
+ .env.local
@@ -0,0 +1,9 @@
1
+ // Runs once as the panel's server starts (npm run dev, npm start): the
2
+ // COLVEOR ADMIN banner, with the API it talks to. Remove it for a quiet
3
+ // start.
4
+ export async function register() {
5
+ if (process.env.NEXT_RUNTIME === "nodejs") {
6
+ const { printBanner } = await import("@colveor/admin/banner");
7
+ printBanner();
8
+ }
9
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "__NAME__",
3
+ "private": true,
4
+ "scripts": {
5
+ "dev": "next dev",
6
+ "build": "next build",
7
+ "start": "next start"
8
+ },
9
+ "dependencies": {
10
+ "@colveor/admin": "__ADMIN__",
11
+ "next": "^16.0.0",
12
+ "react": "^19.0.0",
13
+ "react-dom": "^19.0.0"
14
+ },
15
+ "devDependencies": {
16
+ "@tailwindcss/forms": "^0.5.11",
17
+ "@tailwindcss/postcss": "^4.1.0",
18
+ "@types/node": "^24.0.0",
19
+ "@types/react": "^19.0.0",
20
+ "@types/react-dom": "^19.0.0",
21
+ "tailwindcss": "^4.1.0",
22
+ "typescript": "^5.9.0"
23
+ }
24
+ }
@@ -0,0 +1 @@
1
+ export default { plugins: { "@tailwindcss/postcss": {} } };
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "allowJs": false,
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "noEmit": true,
9
+ "esModuleInterop": true,
10
+ "module": "esnext",
11
+ "moduleResolution": "bundler",
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "jsx": "react-jsx",
15
+ "incremental": true,
16
+ "plugins": [{ "name": "next" }]
17
+ },
18
+ "include": [
19
+ "next-env.d.ts",
20
+ "**/*.ts",
21
+ "**/*.tsx",
22
+ ".next/types/**/*.ts",
23
+ ".next/dev/types/**/*.ts"
24
+ ],
25
+ "exclude": ["node_modules"]
26
+ }