@glinr/create-theauth-app 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # @glinr/create-theauth-app
2
2
 
3
- Scaffold a TheAuth app in one command.
3
+ [npm](https://www.npmjs.com/package/@glinr/create-theauth-app) · [Source](https://github.com/glincker/theauth/tree/main/packages/create-theauth-app) · [Docs](https://docs.theauth.dev/quickstart) · [All packages](https://github.com/glincker/theauth#packages)
4
+
5
+ Scaffold a theAuth app in one command.
4
6
 
5
7
  ```bash
6
8
  npm create theauth-app@latest
@@ -14,11 +16,13 @@ bunx @glinr/create-theauth-app
14
16
 
15
17
  You'll be asked for a project directory, a template, and a database driver. The CLI then writes the project, installs deps, and prints the next commands to run.
16
18
 
19
+ Part of [theAuth](https://theauth.dev), open-source auth for AI agents and humans. Docs: [docs.theauth.dev](https://docs.theauth.dev).
20
+
17
21
  ## Templates
18
22
 
19
23
  | Template | Status | Stack |
20
24
  | --- | --- | --- |
21
- | `next-saas` | available | Next.js App Router · Drizzle · TheAuth auth |
25
+ | `next-saas` | available | Next.js App Router · Drizzle · theAuth auth |
22
26
  | `hono-mcp` | available | Hono server · MCP OAuth 2.1 |
23
27
  | `expo-mobile` | coming soon | Expo Router · React Native |
24
28
 
@@ -31,7 +35,7 @@ You'll be asked for a project directory, a template, and a database driver. The
31
35
 
32
36
  A working Next.js app with:
33
37
 
34
- - `createKavach` already wired in `lib/auth.ts`
38
+ - `createTheAuth` already wired in `lib/auth.ts`
35
39
  - Drizzle schema and migrations for the auth tables
36
40
  - Sign-in / sign-up routes using the prebuilt React components
37
41
  - `.env.example` with the secrets you need to fill in
@@ -48,8 +52,14 @@ pnpm dev
48
52
 
49
53
  ## Links
50
54
 
51
- - TheAuth repo: <https://github.com/glincker/theauth>
52
- - Docs: <https://docs.theauth.com>
55
+ - theAuth repo: <https://github.com/glincker/theauth>
56
+ - Docs: <https://docs.theauth.dev>
57
+
58
+ ## Community
59
+
60
+ [![Discord](https://img.shields.io/discord/829168897080557579?style=flat-square&logo=discord&logoColor=white&label=discord&color=5865F2)](https://discord.gg/Ar5pcaZB99)
61
+
62
+ Questions and help in the `#theauth` forum on the [GLINR Discord](https://discord.gg/Ar5pcaZB99).
53
63
 
54
64
  ## License
55
65
 
package/dist/bin.js CHANGED
@@ -2,7 +2,7 @@
2
2
  #!/usr/bin/env node
3
3
  import {
4
4
  main
5
- } from "./chunk-Z6TQPZQK.js";
5
+ } from "./chunk-XHCNQ3QD.js";
6
6
 
7
7
  // src/bin.ts
8
8
  main().catch((err) => {
@@ -59,7 +59,7 @@ function detectPackageManager() {
59
59
  return "npm";
60
60
  }
61
61
  function defaultDbUrl(driver) {
62
- if (driver === "better-sqlite3") return "file:./kavach.db";
62
+ if (driver === "better-sqlite3") return "file:./theauth.db";
63
63
  return "";
64
64
  }
65
65
  function printBanner() {
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  main
4
- } from "./chunk-Z6TQPZQK.js";
4
+ } from "./chunk-XHCNQ3QD.js";
5
5
  export {
6
6
  main
7
7
  };
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@glinr/create-theauth-app",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Scaffold a TheAuth-powered app in seconds",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/glincker/theauth.git",
9
+ "url": "git+https://github.com/glincker/theauth.git",
10
10
  "directory": "packages/create-theauth-app"
11
11
  },
12
- "homepage": "https://theauth.com",
12
+ "homepage": "https://docs.theauth.dev/quickstart",
13
13
  "keywords": [
14
14
  "theauth",
15
15
  "auth",
@@ -38,6 +38,9 @@
38
38
  "typescript": "^6.0.3",
39
39
  "vitest": "^3.0.0"
40
40
  },
41
+ "bugs": {
42
+ "url": "https://github.com/glincker/theauth/issues"
43
+ },
41
44
  "scripts": {
42
45
  "build": "tsup src/index.ts src/bin.ts --format esm --dts --clean",
43
46
  "dev": "tsup src/index.ts src/bin.ts --format esm --watch",
@@ -9,7 +9,7 @@ MCP_SIGNING_SECRET=change-me-to-a-real-secret-at-least-32-chars
9
9
  DB_PROVIDER=sqlite
10
10
 
11
11
  # Database URL. Defaults match DB_PROVIDER.
12
- # SQLite: file:./kavach.db
12
+ # SQLite: file:./theauth.db
13
13
  # Postgres: postgres://user:pass@host:5432/dbname
14
14
  DATABASE_URL=__DB_URL__
15
15
 
@@ -1,11 +1,11 @@
1
1
  # __APP_NAME__
2
2
 
3
- A Hono server scaffolded with [TheAuth](https://theauth.com). Runs as an MCP OAuth 2.1 authorization server and a resource server in one process.
3
+ A Hono server scaffolded with [theAuth](https://theauth.dev). Runs as an MCP OAuth 2.1 authorization server and a resource server in one process.
4
4
 
5
5
  ## What's included
6
6
 
7
7
  - **Hono 4** on Node.js
8
- - **TheAuth** for agent identity, session management, and the MCP OAuth 2.1 stack
8
+ - **theAuth** for agent identity, session management, and the MCP OAuth 2.1 stack
9
9
  - **Drizzle ORM** with __DB_DRIVER__ backing the auth schema
10
10
  - `GET /tools/list` and `POST /tools/call/:name` protected with `withMcpAuth`
11
11
  - `.well-known` discovery documents for MCP clients, served at the root
@@ -20,7 +20,7 @@ pnpm install
20
20
  pnpm run dev
21
21
  ```
22
22
 
23
- TheAuth creates the auth tables on first boot, no separate migration step for SQLite or Postgres.
23
+ theAuth creates the auth tables on first boot, no separate migration step for SQLite or Postgres.
24
24
 
25
25
  The server listens on `http://localhost:3001`. Visit the root URL to see the MCP discovery links and the list of tools.
26
26
 
@@ -49,7 +49,7 @@ curl http://localhost:3001/tools/list \
49
49
  | Variable | Required | Notes |
50
50
  |-------------------|----------|----------------------------------------------------------------------------|
51
51
  | `THEAUTH_SECRET` | Yes | Long random string. Signs sessions and access tokens. |
52
- | `DATABASE_URL` | Yes | SQLite: `file:./kavach.db`. Postgres: `postgres://user:pass@host:5432/db`. |
52
+ | `DATABASE_URL` | Yes | SQLite: `file:./theauth.db`. Postgres: `postgres://user:pass@host:5432/db`. |
53
53
  | `BASE_URL` | No | Public URL this server is reachable at. Defaults to `http://localhost:3001`. Set it before deploying so the `.well-known` documents and access-token audience match what clients use. |
54
54
  | `PORT` | No | Port to bind. Defaults to `3001`. |
55
55
 
@@ -60,14 +60,14 @@ src/
60
60
  server.ts Hono app, MCP mount, protected tool routes
61
61
  tools.ts Example MCP tool list
62
62
  lib/
63
- kavach.ts Lazy createKavach singleton
63
+ theauth.ts Lazy createTheAuth singleton
64
64
  ```
65
65
 
66
66
  ## Deploying
67
67
 
68
68
  Any Node runtime works. Set `BASE_URL` to your public URL before boot so MCP clients find the right endpoints, and set a real `THEAUTH_SECRET` out of band.
69
69
 
70
- If you switch to Postgres, set `DB_PROVIDER=postgres` and point `DATABASE_URL` at your connection string. TheAuth creates the tables on boot.
70
+ If you switch to Postgres, set `DB_PROVIDER=postgres` and point `DATABASE_URL` at your connection string. theAuth creates the tables on boot.
71
71
 
72
72
  ## Next
73
73
 
@@ -1,17 +1,17 @@
1
- import { createKavach } from "@glinr/theauth";
1
+ import { createTheAuth } from "@glinr/theauth";
2
2
 
3
3
  // Lazy singleton so imports do not open a DB connection before config is
4
- // loaded. createKavach auto-creates the auth tables on first boot, no
4
+ // loaded. createTheAuth auto-creates the auth tables on first boot, no
5
5
  // migration step required for development.
6
- let instance: Awaited<ReturnType<typeof createKavach>> | null = null;
6
+ let instance: Awaited<ReturnType<typeof createTheAuth>> | null = null;
7
7
 
8
- export async function getKavach() {
8
+ export async function getTheAuth() {
9
9
  if (!instance) {
10
10
  const provider = process.env["DB_PROVIDER"] === "postgres" ? "postgres" : "sqlite";
11
- instance = await createKavach({
11
+ instance = await createTheAuth({
12
12
  database: {
13
13
  provider,
14
- url: process.env["DATABASE_URL"] ?? "file:./kavach.db",
14
+ url: process.env["DATABASE_URL"] ?? "file:./theauth.db",
15
15
  },
16
16
  secret: process.env["THEAUTH_SECRET"] ?? "dev-secret-change-me-in-prod",
17
17
  agents: {
@@ -16,13 +16,13 @@
16
16
  // curl http://localhost:3001/tools/list -H "Authorization: Bearer kv_..."
17
17
 
18
18
  import { serve } from "@hono/node-server";
19
- import { kavachHono } from "@glinr/theauth-hono";
19
+ import { theAuthHono } from "@glinr/theauth-hono";
20
20
  import { Hono } from "hono";
21
21
  import { users } from "@glinr/theauth";
22
22
  import type { McpAccessToken, McpAuthModule, McpAuthorizationCode, McpClient } from "@glinr/theauth/mcp";
23
23
  import { createMcpModule } from "@glinr/theauth/mcp";
24
24
 
25
- import { getKavach } from "./lib/kavach.js";
25
+ import { getTheAuth } from "./lib/theauth.js";
26
26
  import { MCP_TOOLS } from "./tools.js";
27
27
 
28
28
  const PORT = Number(process.env["PORT"] ?? 3001);
@@ -39,11 +39,11 @@ const tokens = new Map<string, McpAccessToken>();
39
39
  const refreshTokenIndex = new Map<string, string>();
40
40
 
41
41
  async function main(): Promise<void> {
42
- const kavach = await getKavach();
42
+ const theauth = await getTheAuth();
43
43
 
44
44
  // Seed a demo user so the /api/agents call in the smoke test has an owner.
45
45
  try {
46
- kavach.db
46
+ theauth.db
47
47
  .insert(users)
48
48
  .values({
49
49
  id: "user-1",
@@ -102,7 +102,7 @@ async function main(): Promise<void> {
102
102
 
103
103
  // Mount the full TheAuth API (agents, audit, delegation) plus the MCP
104
104
  // OAuth endpoints (.well-known, /mcp/register, /mcp/authorize, /mcp/token).
105
- app.route("/api", kavachHono(kavach, { mcp }));
105
+ app.route("/api", theAuthHono(theauth, { mcp }));
106
106
 
107
107
  // Protected tool list. Accepts either a kv_ agent token or an MCP JWT.
108
108
  app.get("/tools/list", async (c) => {
@@ -110,7 +110,7 @@ async function main(): Promise<void> {
110
110
  if (!token) return c.json({ error: "Missing Authorization header" }, 401);
111
111
 
112
112
  if (token.startsWith("kv_")) {
113
- const result = await kavach.authorizeByToken(token, {
113
+ const result = await theauth.authorizeByToken(token, {
114
114
  action: "read",
115
115
  resource: "mcp:tools:list",
116
116
  });
@@ -143,7 +143,7 @@ async function main(): Promise<void> {
143
143
  if (!tool) return c.json({ error: `Unknown tool: ${toolName}` }, 404);
144
144
 
145
145
  if (token.startsWith("kv_")) {
146
- const result = await kavach.authorizeByToken(token, {
146
+ const result = await theauth.authorizeByToken(token, {
147
147
  action: "execute",
148
148
  resource: `mcp:tools:${toolName}`,
149
149
  arguments: body.arguments,
@@ -1,13 +1,13 @@
1
1
  # __APP_NAME__
2
2
 
3
- A Next.js SaaS starter with [TheAuth](https://theauth.com) auth built in.
3
+ A Next.js SaaS starter with [theAuth](https://theauth.dev) auth built in.
4
4
 
5
5
  ## What's included
6
6
 
7
7
  - **Next.js 15** with App Router and TypeScript
8
- - **TheAuth** for agent identity, session management, and auth
8
+ - **theAuth** for agent identity, session management, and auth
9
9
  - **Drizzle ORM** with **__DB_DRIVER__**: schema-first, type-safe
10
- - Sign-in / sign-out flow wired to `/api/auth/[...kavach]`
10
+ - Sign-in / sign-out flow wired to `/api/auth/[...theauth]`
11
11
  - An agents list page at `/agents`
12
12
 
13
13
  ## Getting started
@@ -28,19 +28,19 @@ Open [http://localhost:3000](http://localhost:3000).
28
28
  | Variable | Required | Notes |
29
29
  |---|---|---|
30
30
  | `THEAUTH_SECRET` | Yes | Long random string, used to sign sessions |
31
- | `DATABASE_URL` | Yes | SQLite: `file:./kavach.db` · Postgres: connection string |
31
+ | `DATABASE_URL` | Yes | SQLite: `file:./theauth.db` · Postgres: connection string |
32
32
 
33
33
  ## Project structure
34
34
 
35
35
  ```
36
36
  src/
37
37
  app/
38
- api/auth/[...kavach]/route.ts : TheAuth HTTP handler
38
+ api/auth/[...theauth]/route.ts : TheAuth HTTP handler
39
39
  agents/page.tsx : agent list UI
40
- layout.tsx : KavachProvider wrapper
40
+ layout.tsx : TheAuthProvider wrapper
41
41
  page.tsx : home / landing
42
42
  lib/
43
- kavach.ts : singleton TheAuth instance
43
+ theauth.ts : singleton TheAuth instance
44
44
  ```
45
45
 
46
46
  ## Deploying
@@ -5,6 +5,6 @@ export default defineConfig({
5
5
  schema: "./src/lib/schema.ts",
6
6
  out: "./drizzle",
7
7
  dbCredentials: {
8
- url: process.env["DATABASE_URL"] ?? "file:./kavach.db",
8
+ url: process.env["DATABASE_URL"] ?? "file:./theauth.db",
9
9
  },
10
10
  });
@@ -0,0 +1,6 @@
1
+ import { theAuthNextjs } from "@glinr/theauth-nextjs";
2
+ import { getTheAuth } from "@/lib/theauth";
3
+
4
+ const { GET, POST } = theAuthNextjs(getTheAuth);
5
+
6
+ export { GET, POST };
@@ -1,4 +1,4 @@
1
- import { KavachProvider } from "@glinr/theauth-react";
1
+ import { TheAuthProvider } from "@glinr/theauth-react";
2
2
  import type { ReactNode } from "react";
3
3
  import "./globals.css";
4
4
 
@@ -11,7 +11,7 @@ export default function RootLayout({ children }: { children: ReactNode }) {
11
11
  return (
12
12
  <html lang="en">
13
13
  <body>
14
- <KavachProvider basePath="/api/auth">{children}</KavachProvider>
14
+ <TheAuthProvider basePath="/api/auth">{children}</TheAuthProvider>
15
15
  </body>
16
16
  </html>
17
17
  );
@@ -0,0 +1,18 @@
1
+ import { createTheAuth } from "@glinr/theauth";
2
+
3
+ // Initialised lazily so Next.js doesn't try to open a DB connection at build
4
+ // time. Import `getTheAuth()` from your server components or route handlers.
5
+ let instance: Awaited<ReturnType<typeof createTheAuth>> | null = null;
6
+
7
+ export async function getTheAuth() {
8
+ if (!instance) {
9
+ instance = await createTheAuth({
10
+ database: {
11
+ provider: "__DB_DRIVER__" === "pg" ? "postgres" : "sqlite",
12
+ url: process.env["DATABASE_URL"] ?? "file:./theauth.db",
13
+ },
14
+ secret: process.env["THEAUTH_SECRET"] ?? "dev-secret-change-me",
15
+ });
16
+ }
17
+ return instance;
18
+ }
@@ -1,6 +0,0 @@
1
- import { kavachNextjs } from "@glinr/theauth-nextjs";
2
- import { getKavach } from "@/lib/kavach";
3
-
4
- const { GET, POST } = kavachNextjs(getKavach);
5
-
6
- export { GET, POST };
@@ -1,18 +0,0 @@
1
- import { createKavach } from "@glinr/theauth";
2
-
3
- // Initialised lazily so Next.js doesn't try to open a DB connection at build
4
- // time. Import `getKavach()` from your server components or route handlers.
5
- let instance: Awaited<ReturnType<typeof createKavach>> | null = null;
6
-
7
- export async function getKavach() {
8
- if (!instance) {
9
- instance = await createKavach({
10
- database: {
11
- provider: "__DB_DRIVER__" === "pg" ? "postgres" : "sqlite",
12
- url: process.env["DATABASE_URL"] ?? "file:./kavach.db",
13
- },
14
- secret: process.env["THEAUTH_SECRET"] ?? "dev-secret-change-me",
15
- });
16
- }
17
- return instance;
18
- }