Skip to content

feat: add better-auth - #10

Merged
Myxogastria0808 merged 4 commits into
mainfrom
dev
Jan 3, 2026
Merged

feat: add better-auth#10
Myxogastria0808 merged 4 commits into
mainfrom
dev

Conversation

@Myxogastria0808

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings January 3, 2026 21:16
@Myxogastria0808
Myxogastria0808 merged commit f577d5c into main Jan 3, 2026
12 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR integrates better-auth as the authentication solution by removing Sentry configuration and the entire notify service. The changes introduce Discord OAuth client credentials and better-auth URL/secret environment variables while simplifying the validator schemas.

Key Changes:

  • Replaced Sentry configuration with better-auth environment variables (URL, secret, Discord OAuth credentials)
  • Removed the entire notify service and its scheduled notification functionality
  • Simplified validator schemas by removing history-related schemas and adding a sample schema
  • Updated backend configuration to include better-auth environment variables

Reviewed changes

Copilot reviewed 82 out of 88 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
setup/src/types.ts Removed Sentry and notify config types, added better-auth configuration fields
setup/src/index.ts Removed Sentry environment variables and notify wrangler config, added better-auth vars to backend
setup/src/functions.ts Updated environment variable loading to replace Sentry vars with better-auth credentials
products/validator/src/response/sample.ts Added new sample schema replacing history schemas
products/validator/src/response/*.ts Removed history-related response schemas
products/validator/src/request/*.ts Removed history-related request schemas
products/validator/src/index.ts Updated exports to remove history schemas and export sample schema
products/validator/README.md Updated documentation to remove notify service references
products/notify/* Entire notify service removed including wrangler config, source code, and tests
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

})
.or(z.null());

export type sampleSchemaType = z.infer<typeof sampleSchema>;

Copilot AI Jan 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type name sampleSchemaType doesn't follow TypeScript naming conventions. Type names should be in PascalCase. Consider renaming to SampleSchemaType for consistency with TypeScript best practices.

Copilot uses AI. Check for mistakes.
import { HTTPException } from 'hono/http-exception';
import { cors } from 'hono/cors';
import type { ErrorResponseSchemaType } from 'validator';
import { errorResponseSchema, type ErrorResponseSchemaType } from 'validator';

Copilot AI Jan 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import errorResponseSchema.

Suggested change
import { errorResponseSchema, type ErrorResponseSchemaType } from 'validator';
import type { ErrorResponseSchemaType } from 'validator';

Copilot uses AI. Check for mistakes.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 66340d1d14

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +13 to +16
await authClient.signIn.social({
provider: 'discord',
callbackURL: 'http://localhost:5173/',
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid hardcoded localhost OAuth callback

The callbackURL is fixed to http://localhost:5173/. When the frontend is deployed on any other origin, the OAuth provider will redirect users back to localhost, which fails or lands on the wrong app, effectively breaking sign‑in in production. Use the current origin or a configurable env value so the callback matches the deployed site.

Useful? React with 👍 / 👎.

Comment on lines +32 to +35
baseURL: env.BETTER_AUTH_URL,
// allow requests from the frontend development server
trustedOrigins: ['http://localhost:5173'],
socialProviders: {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Trust production origin for better-auth requests

The auth server only trusts http://localhost:5173. better-auth enforces an Origin check via trustedOrigins, so requests from the production frontend origin (e.g., the one already used in CORS config) will be rejected, preventing login/session calls in production. Add the production origin (or derive it from env) alongside localhost.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants