create-better-t-stack 1.0.10 → 1.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.
Files changed (29) hide show
  1. package/README.md +7 -0
  2. package/dist/index.js +74 -60
  3. package/package.json +1 -3
  4. package/template/base/apps/server/package.json +1 -9
  5. package/template/base/apps/server/tsconfig.json +1 -1
  6. package/template/with-auth/apps/client/src/components/sign-in-form.tsx +1 -1
  7. package/template/with-auth/apps/client/src/components/sign-up-form.tsx +142 -142
  8. package/template/{with-prisma-sqlite/apps/server/src/with-auth-lib/context.ts → with-auth/apps/server/src/lib/with-elysia-context.ts} +4 -4
  9. package/template/{with-drizzle-sqlite/apps/server/src/with-auth-lib/context.ts → with-auth/apps/server/src/lib/with-hono-context.ts} +3 -3
  10. package/template/with-auth/apps/server/src/routers/index.ts +11 -13
  11. package/template/with-auth/apps/server/src/with-elysia-index.ts +38 -0
  12. package/template/with-auth/apps/server/src/with-hono-index.ts +39 -0
  13. package/template/with-elysia/apps/server/src/index.ts +27 -0
  14. package/template/with-elysia/apps/server/src/lib/context.ts +13 -0
  15. package/template/with-hono/apps/server/src/index.ts +33 -0
  16. package/template/{base → with-hono}/apps/server/src/lib/context.ts +2 -2
  17. package/template/base/apps/server/src/index.ts +0 -41
  18. package/template/with-auth/apps/server/src/index.ts +0 -46
  19. package/template/with-drizzle-postgres/apps/server/src/routers/todo.ts +0 -44
  20. package/template/with-drizzle-postgres/apps/server/src/with-auth-lib/context.ts +0 -18
  21. package/template/with-drizzle-postgres/apps/server/src/with-auth-lib/trpc.ts +0 -24
  22. package/template/with-drizzle-sqlite/apps/server/src/with-auth-lib/trpc.ts +0 -24
  23. package/template/with-prisma-postgres/apps/server/src/with-auth-lib/context.ts +0 -18
  24. package/template/with-prisma-postgres/apps/server/src/with-auth-lib/trpc.ts +0 -24
  25. package/template/with-prisma-sqlite/apps/server/src/with-auth-lib/trpc.ts +0 -24
  26. package/template/{with-drizzle-postgres/apps/server/src/with-auth-lib → with-auth/apps/server/src/with-drizzle-postgres-lib}/auth.ts +1 -1
  27. /package/template/{with-drizzle-sqlite/apps/server/src/with-auth-lib → with-auth/apps/server/src/with-drizzle-sqlite-lib}/auth.ts +0 -0
  28. /package/template/{with-prisma-postgres/apps/server/src/with-auth-lib → with-auth/apps/server/src/with-prisma-postgres-lib}/auth.ts +0 -0
  29. /package/template/{with-prisma-sqlite/apps/server/src/with-auth-lib → with-auth/apps/server/src/with-prisma-sqlite-lib}/auth.ts +0 -0
@@ -1,18 +0,0 @@
1
- import type { Context as HonoContext } from "hono";
2
- import { auth } from "./auth";
3
-
4
- export type CreateContextOptions = {
5
- hono: HonoContext;
6
- };
7
-
8
- export async function createContext({ hono }: CreateContextOptions) {
9
- const session = await auth.api.getSession({
10
- headers: hono.req.raw.headers,
11
- });
12
-
13
- return {
14
- session,
15
- };
16
- }
17
-
18
- export type Context = Awaited<ReturnType<typeof createContext>>;
@@ -1,24 +0,0 @@
1
- import { initTRPC, TRPCError } from "@trpc/server";
2
- import type { Context } from "./context";
3
-
4
- export const t = initTRPC.context<Context>().create();
5
-
6
- export const router = t.router;
7
-
8
- export const publicProcedure = t.procedure;
9
-
10
- export const protectedProcedure = t.procedure.use(({ ctx, next }) => {
11
- if (!ctx.session) {
12
- throw new TRPCError({
13
- code: "UNAUTHORIZED",
14
- message: "Authentication required",
15
- cause: "No session",
16
- });
17
- }
18
- return next({
19
- ctx: {
20
- ...ctx,
21
- session: ctx.session,
22
- },
23
- });
24
- });
@@ -1,24 +0,0 @@
1
- import { initTRPC, TRPCError } from "@trpc/server";
2
- import type { Context } from "./context";
3
-
4
- export const t = initTRPC.context<Context>().create();
5
-
6
- export const router = t.router;
7
-
8
- export const publicProcedure = t.procedure;
9
-
10
- export const protectedProcedure = t.procedure.use(({ ctx, next }) => {
11
- if (!ctx.session) {
12
- throw new TRPCError({
13
- code: "UNAUTHORIZED",
14
- message: "Authentication required",
15
- cause: "No session",
16
- });
17
- }
18
- return next({
19
- ctx: {
20
- ...ctx,
21
- session: ctx.session,
22
- },
23
- });
24
- });
@@ -1,18 +0,0 @@
1
- import type { Context as HonoContext } from "hono";
2
- import { auth } from "./auth";
3
-
4
- export type CreateContextOptions = {
5
- hono: HonoContext;
6
- };
7
-
8
- export async function createContext({ hono }: CreateContextOptions) {
9
- const session = await auth.api.getSession({
10
- headers: hono.req.raw.headers,
11
- });
12
-
13
- return {
14
- session,
15
- };
16
- }
17
-
18
- export type Context = Awaited<ReturnType<typeof createContext>>;
@@ -1,24 +0,0 @@
1
- import { initTRPC, TRPCError } from "@trpc/server";
2
- import type { Context } from "./context";
3
-
4
- export const t = initTRPC.context<Context>().create();
5
-
6
- export const router = t.router;
7
-
8
- export const publicProcedure = t.procedure;
9
-
10
- export const protectedProcedure = t.procedure.use(({ ctx, next }) => {
11
- if (!ctx.session) {
12
- throw new TRPCError({
13
- code: "UNAUTHORIZED",
14
- message: "Authentication required",
15
- cause: "No session",
16
- });
17
- }
18
- return next({
19
- ctx: {
20
- ...ctx,
21
- session: ctx.session,
22
- },
23
- });
24
- });
@@ -1,24 +0,0 @@
1
- import { initTRPC, TRPCError } from "@trpc/server";
2
- import type { Context } from "./context";
3
-
4
- export const t = initTRPC.context<Context>().create();
5
-
6
- export const router = t.router;
7
-
8
- export const publicProcedure = t.procedure;
9
-
10
- export const protectedProcedure = t.procedure.use(({ ctx, next }) => {
11
- if (!ctx.session) {
12
- throw new TRPCError({
13
- code: "UNAUTHORIZED",
14
- message: "Authentication required",
15
- cause: "No session",
16
- });
17
- }
18
- return next({
19
- ctx: {
20
- ...ctx,
21
- session: ctx.session,
22
- },
23
- });
24
- });
@@ -1,7 +1,7 @@
1
1
  import { betterAuth } from "better-auth";
2
2
  import { drizzleAdapter } from "better-auth/adapters/drizzle";
3
- import * as schema from "../db/schema/auth";
4
3
  import { db } from "../db";
4
+ import * as schema from "../db/schema/auth";
5
5
 
6
6
  export const auth = betterAuth({
7
7
  database: drizzleAdapter(db, {