Rebuild the hub on Bun: Elysia API, Better Auth, Drizzle, Next.js website
CI / test (push) Successful in 30s
CI / test (push) Successful in 30s
The hub becomes a Bun monorepo: apps/api (Elysia, Better Auth for accounts, roles, bans, proxy device sign-in and JWT keys; tagline linking, presence and the console as before), packages/db (Drizzle; Postgres in production, PGlite in development and tests), and the Next.js website from apps/web. Self-hostable with docker compose; the website deploys to Vercel-style hosts, the API to any that runs Bun or containers. The first version, in Go, is removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
64c552330b
commit
7a06ba49c3
59 files changed
+2640
-3523
No files matched your search
@@ -0,0 +1,126 @@
|
||||
CREATE TABLE "account" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"account_id" text NOT NULL,
|
||||
"provider_id" text NOT NULL,
|
||||
"user_id" text NOT NULL,
|
||||
"access_token" text,
|
||||
"refresh_token" text,
|
||||
"id_token" text,
|
||||
"access_token_expires_at" timestamp with time zone,
|
||||
"refresh_token_expires_at" timestamp with time zone,
|
||||
"scope" text,
|
||||
"password" text,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "audit" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"actor_id" text,
|
||||
"action" text NOT NULL,
|
||||
"target" text DEFAULT '' NOT NULL,
|
||||
"detail" jsonb DEFAULT '{}'::jsonb NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "device_code" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"device_code" text NOT NULL,
|
||||
"user_code" text NOT NULL,
|
||||
"user_id" text,
|
||||
"expires_at" timestamp with time zone NOT NULL,
|
||||
"status" text NOT NULL,
|
||||
"last_polled_at" timestamp with time zone,
|
||||
"polling_interval" integer,
|
||||
"client_id" text,
|
||||
"scope" text,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "imvu_link" (
|
||||
"imvu_id" bigint PRIMARY KEY NOT NULL,
|
||||
"user_id" text NOT NULL,
|
||||
"pairwise_id" text NOT NULL,
|
||||
"username" text NOT NULL,
|
||||
"linked_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"age_verified" boolean DEFAULT false NOT NULL,
|
||||
"access_pass" boolean DEFAULT false NOT NULL,
|
||||
"checked_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"show_badge" boolean DEFAULT false NOT NULL,
|
||||
"show_presence" boolean DEFAULT false NOT NULL,
|
||||
CONSTRAINT "imvu_link_pairwise_id_unique" UNIQUE("pairwise_id")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "jwks" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"public_key" text NOT NULL,
|
||||
"private_key" text NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"expires_at" timestamp with time zone,
|
||||
"alg" text,
|
||||
"crv" text
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "link_challenge" (
|
||||
"user_id" text NOT NULL,
|
||||
"imvu_id" bigint NOT NULL,
|
||||
"username" text NOT NULL,
|
||||
"code" text NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "link_challenge_user_id_imvu_id_pk" PRIMARY KEY("user_id","imvu_id")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "session" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"expires_at" timestamp with time zone NOT NULL,
|
||||
"token" text NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"ip_address" text,
|
||||
"user_agent" text,
|
||||
"user_id" text NOT NULL,
|
||||
"impersonated_by" text,
|
||||
CONSTRAINT "session_token_unique" UNIQUE("token")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "user" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"email" text NOT NULL,
|
||||
"email_verified" boolean DEFAULT false NOT NULL,
|
||||
"image" text,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"username" text,
|
||||
"display_username" text,
|
||||
"role" text DEFAULT 'user' NOT NULL,
|
||||
"banned" boolean DEFAULT false,
|
||||
"ban_reason" text,
|
||||
"ban_expires" timestamp with time zone,
|
||||
"link_cap" integer DEFAULT 10 NOT NULL,
|
||||
CONSTRAINT "user_email_unique" UNIQUE("email"),
|
||||
CONSTRAINT "user_username_unique" UNIQUE("username")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "verification" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"identifier" text NOT NULL,
|
||||
"value" text NOT NULL,
|
||||
"expires_at" timestamp with time zone NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "account" ADD CONSTRAINT "account_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "audit" ADD CONSTRAINT "audit_actor_id_user_id_fk" FOREIGN KEY ("actor_id") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "device_code" ADD CONSTRAINT "device_code_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "imvu_link" ADD CONSTRAINT "imvu_link_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "link_challenge" ADD CONSTRAINT "link_challenge_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "session" ADD CONSTRAINT "session_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE INDEX "account_user" ON "account" USING btree ("user_id");--> statement-breakpoint
|
||||
CREATE INDEX "audit_at" ON "audit" USING btree ("at");--> statement-breakpoint
|
||||
CREATE INDEX "imvu_link_user" ON "imvu_link" USING btree ("user_id");--> statement-breakpoint
|
||||
CREATE INDEX "session_user" ON "session" USING btree ("user_id");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "user_username_lower" ON "user" USING btree (lower("username"));--> statement-breakpoint
|
||||
CREATE INDEX "verification_identifier" ON "verification" USING btree ("identifier");
|
||||
Reference in new issue
Block a user