authverse 1.0.4

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 (34) hide show
  1. package/README.md +90 -0
  2. package/dist/index.cjs +827 -0
  3. package/dist/index.d.cts +1 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +799 -0
  6. package/dist/template/api/route.ts +4 -0
  7. package/dist/template/app-auth-uiDesign/forget/page.tsx +7 -0
  8. package/dist/template/app-auth-uiDesign/layout.tsx +9 -0
  9. package/dist/template/app-auth-uiDesign/login/page.tsx +7 -0
  10. package/dist/template/app-auth-uiDesign/reset-password/page.tsx +7 -0
  11. package/dist/template/app-auth-uiDesign/signup/page.tsx +7 -0
  12. package/dist/template/components/ForgetComponent.tsx +121 -0
  13. package/dist/template/components/GithubProviders.tsx +21 -0
  14. package/dist/template/components/GoogleProviders.tsx +21 -0
  15. package/dist/template/components/LoginComponent.tsx +145 -0
  16. package/dist/template/components/Logout.tsx +21 -0
  17. package/dist/template/components/ResetComponent.tsx +150 -0
  18. package/dist/template/components/SingUpComponent.tsx +173 -0
  19. package/dist/template/config/drizzle.config.ts +13 -0
  20. package/dist/template/config/prisma.config.ts +12 -0
  21. package/dist/template/db/drizzle.ts +6 -0
  22. package/dist/template/db/schema.ts +68 -0
  23. package/dist/template/email/reset-password.tsx +132 -0
  24. package/dist/template/lib/Mongodb/auth.ts +20 -0
  25. package/dist/template/lib/Mysql/auth.ts +27 -0
  26. package/dist/template/lib/Postgresql/auth.ts +20 -0
  27. package/dist/template/lib/auth-client.ts +5 -0
  28. package/dist/template/lib/auth-drizzle.ts +16 -0
  29. package/dist/template/prisma/mongodb/schema.prisma +70 -0
  30. package/dist/template/prisma/mysql/schema.prisma +68 -0
  31. package/dist/template/prisma/postgresql/schema.prisma +68 -0
  32. package/dist/template/proxy/proxy.ts +15 -0
  33. package/dist/template/server/user.ts +49 -0
  34. package/package.json +62 -0
@@ -0,0 +1,68 @@
1
+ generator client {
2
+ provider = "prisma-client"
3
+ output = "/generated/prisma"
4
+ }
5
+
6
+ datasource db {
7
+ provider = "postgresql"
8
+ }
9
+
10
+ model User {
11
+ id String @id
12
+ name String
13
+ email String
14
+ emailVerified Boolean
15
+ image String?
16
+ createdAt DateTime
17
+ updatedAt DateTime
18
+ sessions Session[]
19
+ accounts Account[]
20
+
21
+ @@unique([email])
22
+ @@map("user")
23
+ }
24
+
25
+ model Session {
26
+ id String @id
27
+ expiresAt DateTime
28
+ token String
29
+ createdAt DateTime
30
+ updatedAt DateTime
31
+ ipAddress String?
32
+ userAgent String?
33
+ userId String
34
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
35
+
36
+ @@unique([token])
37
+ @@map("session")
38
+ }
39
+
40
+ model Account {
41
+ id String @id
42
+ accountId String
43
+ providerId String
44
+ userId String
45
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
46
+ accessToken String?
47
+ refreshToken String?
48
+ idToken String?
49
+ accessTokenExpiresAt DateTime?
50
+ refreshTokenExpiresAt DateTime?
51
+ scope String?
52
+ password String?
53
+ createdAt DateTime
54
+ updatedAt DateTime
55
+
56
+ @@map("account")
57
+ }
58
+
59
+ model Verification {
60
+ id String @id
61
+ identifier String
62
+ value String
63
+ expiresAt DateTime
64
+ createdAt DateTime?
65
+ updatedAt DateTime?
66
+
67
+ @@map("verification")
68
+ }
@@ -0,0 +1,15 @@
1
+ import { NextRequest, NextResponse } from "next/server";
2
+ import { getSessionCookie } from "better-auth/cookies";
3
+
4
+ export async function proxy(request: NextRequest) {
5
+ const sessionCookie = getSessionCookie(request);
6
+ if (!sessionCookie) {
7
+ return NextResponse.redirect(new URL("/", request.url));
8
+ }
9
+
10
+ return NextResponse.next();
11
+ }
12
+
13
+ export const config = {
14
+ matcher: ["/dashboard"],
15
+ };
@@ -0,0 +1,49 @@
1
+ "use server";
2
+ import { auth } from "@/lib/auth";
3
+
4
+ export const signIn = async (email: string, password: string) => {
5
+ try {
6
+ await auth.api.signInEmail({
7
+ body: {
8
+ email,
9
+ password,
10
+ },
11
+ });
12
+
13
+ return {
14
+ success: true,
15
+ message: "Login successfully.",
16
+ };
17
+ } catch (error) {
18
+ const e = error as Error;
19
+
20
+ return {
21
+ success: false,
22
+ message: e.message || "An unknown error occurred.",
23
+ };
24
+ }
25
+ };
26
+
27
+ export const signUp = async (name: string, email: string, password: string) => {
28
+ try {
29
+ await auth.api.signUpEmail({
30
+ body: {
31
+ name,
32
+ email,
33
+ password,
34
+ },
35
+ });
36
+
37
+ return {
38
+ success: true,
39
+ message: "Signed up successfully.",
40
+ };
41
+ } catch (error) {
42
+ const e = error as Error;
43
+
44
+ return {
45
+ success: false,
46
+ message: e.message || "An unknown error occurred.",
47
+ };
48
+ }
49
+ };
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "authverse",
3
+ "version": "1.0.4",
4
+ "description": "Authverse Fast modern CLI to generate full auth systems with OAuth Prisma Drizzle better auth and ready-to-use ShadCN UI screens",
5
+ "repository": {
6
+ "url": "git+https://github.com/abdirahmanmahamoud/authverse.git"
7
+ },
8
+ "homepage": "https://authverse.dev",
9
+ "license": "MIT",
10
+ "author": {
11
+ "name": "Abdirahman Mohamoud",
12
+ "email": "me@abdirahmandev.com",
13
+ "url": "https://abdirahmandev.com"
14
+ },
15
+ "type": "module",
16
+ "bin": {
17
+ "authverse": "dist/index.js"
18
+ },
19
+ "scripts": {
20
+ "build": "tsup ./index.ts --format esm,cjs --dts --out-dir dist && cp -r ../template ./dist/template",
21
+ "build:windows": "tsup ./index.ts --format esm,cjs --dts --out-dir dist && xcopy ..\\template dist\\template /E /I /Y && npm link",
22
+ "dev": "tsup ./index.ts --watch --onSuccess \"node dist/index.js\"",
23
+ "semantic-release": "semantic-release"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "engines": {
29
+ "node": ">=18"
30
+ },
31
+ "files": [
32
+ "dist",
33
+ "README.md"
34
+ ],
35
+ "keywords": [
36
+ "auth",
37
+ "authverse",
38
+ "auth-ui",
39
+ "auth-ui-templates",
40
+ "better-auth",
41
+ "nextjs",
42
+ "shadcn"
43
+ ],
44
+ "dependencies": {
45
+ "chalk": "^5.6.2",
46
+ "commander": "^14.0.2",
47
+ "inquirer": "^12.10.0"
48
+ },
49
+ "devDependencies": {
50
+ "@semantic-release/changelog": "^6.0.3",
51
+ "@semantic-release/commit-analyzer": "^13.0.1",
52
+ "@semantic-release/git": "^10.0.1",
53
+ "@semantic-release/github": "^12.0.2",
54
+ "@semantic-release/npm": "^13.1.2",
55
+ "@semantic-release/release-notes-generator": "^14.1.0",
56
+ "@types/node": "^25.0.1",
57
+ "conventional-changelog-conventionalcommits": "^9.1.0",
58
+ "semantic-release": "^25.0.2",
59
+ "tsup": "^8.5.0",
60
+ "typescript": "^5.9.3"
61
+ }
62
+ }