Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
b6804e9
install better-auth package
henrikvtcodes Jan 13, 2026
9123bfc
basic betterAuth server/client setup
henrikvtcodes Jan 14, 2026
7d0ffd5
better auth handler function
henrikvtcodes Jan 14, 2026
09cc153
auth database schema with generation command
henrikvtcodes Jan 14, 2026
26c1373
react email
henrikvtcodes Jan 16, 2026
f681e0a
organize some env stuff
henrikvtcodes Jan 16, 2026
f810f1e
more email stuff
henrikvtcodes Jan 16, 2026
bf16e1a
plugins with email stuff
henrikvtcodes Jan 16, 2026
9eedd00
rich permissions
henrikvtcodes Jan 16, 2026
3d72ab0
auth client plugins
henrikvtcodes Jan 16, 2026
749239d
rework how database client is exported
henrikvtcodes Jan 16, 2026
7dfcf0e
fix auth types
henrikvtcodes Jan 16, 2026
16ecc8e
no more old auth
henrikvtcodes Jan 16, 2026
a8b98d7
more old stuff
henrikvtcodes Jan 16, 2026
aef9207
increase db connection pool
henrikvtcodes Jan 16, 2026
7e7f3f8
auth:db migrate script
henrikvtcodes Jan 16, 2026
12aab09
document how to generate the auth schema
henrikvtcodes Jan 16, 2026
665b0d9
remove unused/outdated environment variables
henrikvtcodes Jan 16, 2026
45bd149
error page
henrikvtcodes Jan 17, 2026
eca16a0
basic auth ui
henrikvtcodes Jan 17, 2026
bc72f06
remove default mono font
henrikvtcodes Jan 17, 2026
1ed3407
add uvm netid auth
henrikvtcodes Jan 17, 2026
bd95c30
more badge options
henrikvtcodes Jan 17, 2026
84e59d3
better auth client stuff
henrikvtcodes Jan 17, 2026
8b32c7d
migrations
henrikvtcodes Jan 17, 2026
a7b5046
fix signin
henrikvtcodes Jan 17, 2026
f5608a9
error box component
henrikvtcodes Jan 17, 2026
c62ab61
utility pkg
henrikvtcodes Jan 17, 2026
3c1732b
add confirmation for email send
henrikvtcodes Jan 17, 2026
2e598b6
move posthog reset
henrikvtcodes Jan 17, 2026
f9bec06
make smtp from address a public env var
henrikvtcodes Jan 17, 2026
a6b0583
move account page
henrikvtcodes Jan 17, 2026
d9c6380
better typing for auth api context stuff
henrikvtcodes Jan 19, 2026
f3bb774
custom useSession hook with tanstack query for caching
henrikvtcodes Jan 19, 2026
26d645a
rename auth client file to fix reactivity
henrikvtcodes Jan 19, 2026
18e4d4a
base account page
henrikvtcodes Jan 19, 2026
fe2dca6
add better-auth username plugin
henrikvtcodes Jan 19, 2026
f06dfa2
don't destructure auth client stuff bc that breaks svelte reactivity
henrikvtcodes Jan 19, 2026
96b24b0
boop
henrikvtcodes Jan 19, 2026
071199a
clean up account page stuff
henrikvtcodes Jan 19, 2026
5b4603f
custom profile mapping for UVM Entra OIDC
henrikvtcodes Jan 19, 2026
f4b0d69
update some packages
henrikvtcodes Jan 19, 2026
793efb0
move user data preload to route group
henrikvtcodes Jan 19, 2026
f2bebc6
semicursed permissions checker function
henrikvtcodes Jan 20, 2026
b35ece1
fix some weird auth + orpc bug
henrikvtcodes Jan 20, 2026
82c01d2
fixup auth in orpc middleware
henrikvtcodes Jan 20, 2026
59a398b
fix auth check in layout server load fn
henrikvtcodes Jan 20, 2026
95605c5
fix orpc url thing
henrikvtcodes Jan 20, 2026
a1d3128
more permissions utilities and tests
henrikvtcodes Jan 20, 2026
0e90ddd
update role utility function impl
henrikvtcodes Jan 20, 2026
1bd115b
util function to clear query data on sign out
henrikvtcodes Jan 20, 2026
d71a814
add bun types
henrikvtcodes Jan 20, 2026
a5027ca
profile verification
henrikvtcodes Jan 20, 2026
e4346b7
style fixes
henrikvtcodes Jan 20, 2026
2828674
base welcome page
henrikvtcodes Jan 20, 2026
3665e6d
temp schema updates
henrikvtcodes Jan 28, 2026
53db6e8
hacky request logger
henrikvtcodes Jan 28, 2026
b60969c
Account linking for UVM NetID and GitHub (rough outline)
henrikvtcodes Jan 29, 2026
3806de3
gate github linking behind profile verification
henrikvtcodes Jan 29, 2026
e138c2a
shared query options
henrikvtcodes Jan 30, 2026
8fcdad7
comment stuff out in github webhook handler
henrikvtcodes Jan 30, 2026
97c3912
new envs
henrikvtcodes Jan 30, 2026
7c09396
directly inject secret and base url into auth config
henrikvtcodes Jan 30, 2026
4893877
better auth error page
henrikvtcodes Jan 30, 2026
55cf888
update env docs
henrikvtcodes Jan 30, 2026
914b7f8
make the account linking buttons actually do something
henrikvtcodes Jan 30, 2026
26daf9f
fixups for uvm netid auth
henrikvtcodes Jan 30, 2026
5e41473
update account linking settings and github app permissions in the docs
henrikvtcodes Jan 30, 2026
4be802d
even fancier auth errors for account linking
henrikvtcodes Jan 30, 2026
058796a
context authed utility type
henrikvtcodes Jan 30, 2026
91c467f
stupid logging
henrikvtcodes Jan 30, 2026
d63c7a5
lots of procedures
henrikvtcodes Jan 30, 2026
f783733
github linking fully works!!
henrikvtcodes Jan 30, 2026
9fd32c5
change account tabs default tab
henrikvtcodes Jan 30, 2026
8ee1ae3
add server prefix to auth server file to prevent client imports
henrikvtcodes Jan 30, 2026
ae46dc1
delete old users table view in admin dash
henrikvtcodes Jan 30, 2026
c060b75
move 2025 stuff to `old` folder so routes don't conflict
henrikvtcodes Jan 30, 2026
4e84494
refactor UserDropdown to new auth stuff
henrikvtcodes Jan 30, 2026
45eda74
scaffold new auth section
henrikvtcodes Jan 30, 2026
048fb37
Merge branch 'main' into better-auth
henrikvtcodes Jan 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
# Local DB Connect String
# Based on the docker compose database template
# --- Postgres Database Connection URL ---
# The provided example corresponds to the docker compose database
DATABASE_URL=postgres://cscrew:database@localhost:32700/hackhelp

# Organization to test on
AUTH_SECRET=
BASE_URL=

# --- GitHub App Configuration
# Organization for HackHelp to integrate with. It is a single tenant app and is not designed to work across multiple orgs at once.
PUBLIC_GITHUB_ORGNAME=UVMHacks2026

GITHUB_APP_ID=
GITHUB_APP_INSTALL_ID=
# Client ID for OAuth
GITHUB_APP_CLIENT_ID=
# Client Secret for OAuth
GITHUB_APP_CLIENT_SECRET=
# App Private Key
GITHUB_APP_PRIVATE_KEY=

# Signing webhooks
GITHUB_WEBHOOK_SECRET=

PUBLIC_SHOW_CHALLENGES=
# --- UVM NetID OIDC Configuration ---
# Allows UVM faculty and students to sign in with their NetIDs via Microsoft Entra
UVM_NETID_OIDC_CLIENT_ID=
UVM_NETID_OIDC_CLIENT_SECRET=
UVM_NETID_OIDC_DISCOVERY_URL=

WHITELIST_ENDPOINT_TOKEN=
# --- SMTP Connection URL for sending emails ---
# This example URL applies to servers that use STARTTLS on port 587. ?pool=true enables connection pooling.
SMTP_URL="smtp://user:pass@smtp.example.com:587/?pool=true"
# Email account to send from
PUBLIC_SMTP_FROM="user@example.com"
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,26 @@ The connection string with the credentials as set in the repo is `postgres://csc

#### Set up environment variables

| Env Var | Description |
| -------------------------- | ------------------------------------------------------- |
| `DATABASE_URL` | The url of your PostgreSQL database |
| `GITHUB_APP_ID` | |
| `GITHUB_APP_PRIVATE_KEY` | |
| `GITHUB_APP_CLIENT_ID` | OAuth Client ID of the Github App |
| `GITHUB_APP_CLIENT_SECRET` | OAuth Client Secret of the Github App |
| `PUBLIC_GITHUB_ORGNAME` | The slug of the GitHub Org that HackHelp should control |
See `.env.example` for all required environment variables

#### GitHub App Credentials

##### Permissions

**Repository permissions**

- Administration: Read & Write
- Contents: Read
- Issues: Read & Write

**Organization permissions**

- Administration: Read & Write
- Members: Read & Write

**Account permissions**

- Email addresses: Read

### Get Started

Expand Down
943 changes: 855 additions & 88 deletions bun.lock

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions drizzle/0000_silky_the_hood.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
CREATE TABLE "configuration" (
"key" text PRIMARY KEY NOT NULL,
"value" json
);
--> statement-breakpoint
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,
"refresh_token_expires_at" timestamp,
"scope" text,
"password" text,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp NOT NULL
);
--> statement-breakpoint
CREATE TABLE "passkey" (
"id" text PRIMARY KEY NOT NULL,
"name" text,
"public_key" text NOT NULL,
"user_id" text NOT NULL,
"credential_id" text NOT NULL,
"counter" integer NOT NULL,
"device_type" text NOT NULL,
"backed_up" boolean NOT NULL,
"transports" text,
"created_at" timestamp,
"aaguid" text
);
--> statement-breakpoint
CREATE TABLE "session" (
"id" text PRIMARY KEY NOT NULL,
"expires_at" timestamp NOT NULL,
"token" text NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp NOT NULL,
"ip_address" text,
"user_agent" text,
"user_id" text NOT NULL,
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 DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "user_email_unique" UNIQUE("email")
);
--> statement-breakpoint
CREATE TABLE "verification" (
"id" text PRIMARY KEY NOT NULL,
"identifier" text NOT NULL,
"value" text NOT NULL,
"expires_at" timestamp NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp 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 "passkey" ADD CONSTRAINT "passkey_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_userId_idx" ON "account" USING btree ("user_id");--> statement-breakpoint
CREATE INDEX "passkey_userId_idx" ON "passkey" USING btree ("user_id");--> statement-breakpoint
CREATE INDEX "passkey_credentialID_idx" ON "passkey" USING btree ("credential_id");--> statement-breakpoint
CREATE INDEX "session_userId_idx" ON "session" USING btree ("user_id");--> statement-breakpoint
CREATE INDEX "verification_identifier_idx" ON "verification" USING btree ("identifier");
5 changes: 5 additions & 0 deletions drizzle/0001_elite_omega_red.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE "session" ADD COLUMN "impersonated_by" text;--> statement-breakpoint
ALTER TABLE "user" ADD COLUMN "role" text;--> statement-breakpoint
ALTER TABLE "user" ADD COLUMN "banned" boolean DEFAULT false;--> statement-breakpoint
ALTER TABLE "user" ADD COLUMN "ban_reason" text;--> statement-breakpoint
ALTER TABLE "user" ADD COLUMN "ban_expires" timestamp;
3 changes: 3 additions & 0 deletions drizzle/0002_violet_norman_osborn.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE "user" ADD COLUMN "username" text;--> statement-breakpoint
ALTER TABLE "user" ADD COLUMN "display_username" text;--> statement-breakpoint
ALTER TABLE "user" ADD CONSTRAINT "user_username_unique" UNIQUE("username");
Loading