Skip to content

Feat/auth#13

Merged
itssimmons merged 16 commits into
mainfrom
feat/auth
May 12, 2026
Merged

Feat/auth#13
itssimmons merged 16 commits into
mainfrom
feat/auth

Conversation

@itssimmons
Copy link
Copy Markdown
Contributor

Pull Request Template

📌 Description

Provide a clear and concise description of what this PR does.

  • What problem does it solve?
  • Why is this change necessary?

🔧 Type of Change

Select all that apply:

  • Feature (new functionality)
  • Fix (bug fix)
  • Refactor (code improvement, no behavior change)
  • Docs (documentation only)
  • Test (adding or updating tests)
  • Chore (build, tooling, dependencies, etc.)

🧪 How Has This Been Tested?

Describe the testing strategy:

  • Unit tests
  • Integration tests
  • Manual testing

Steps to reproduce/test:
1.
2.
3.


📂 Related Issues

Link any related issues:

  • Closes #
  • Related to #

⚠️ Breaking Changes

  • Yes
  • No

If yes, describe the impact and migration steps:


📸 Screenshots / Logs (if applicable)

Add screenshots, request/response examples, or logs if helpful.


✅ Checklist

Ensure your PR meets the following:

  • Code follows project conventions
  • Self-review completed
  • Tests added/updated where necessary
  • Documentation updated (if needed)
  • No sensitive data exposed (API keys, secrets)

💬 Additional Notes

Anything else reviewers should know.

Copilot AI review requested due to automatic review settings May 8, 2026 18:31
Copy link
Copy Markdown

Copilot AI left a comment

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 introduces a revamped authentication system, adding local signup/login with Redis-backed JWT sessions and new OAuth flows (Google/GitHub/Discord), plus related infra/config updates (cookies, CORS, Prisma schema, env/compose).

Changes:

  • Added JWT session middleware, cookie handling, and custom CORS handling.
  • Implemented local auth endpoints (signup/local login/refresh/revoke/logout) and OAuth routes/controllers for Google/GitHub/Discord.
  • Extended Prisma schema/migration to support OAuth accounts, updated i18n namespaces, and added dev Docker compose/Dockerfile.

Reviewed changes

Copilot reviewed 43 out of 51 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
shared/utils/crypto.ts Adds PKCE helper utilities for OAuth flows.
routes/v1.ts Registers new OAuth router under v1.
plugins/jwt.ts Adds JWT session validation middleware backed by Redis.
plugins/i18n.ts Extends request decorations (t/language) and tweaks plugin wrapper.
plugins/cors.ts Adds custom CORS preHandler with allowlist.
package.json Adds deps for cookies, bcrypt, and Google APIs.
bun.lock Locks newly added dependencies.
modules/users/models/User.d.ts Introduces a shared User interface used by sessions.
modules/auth/types/jwt.d.ts Updates JWT subject/payload typing for access/refresh tokens.
modules/auth/serivces/jwt.service.ts Adds centralized access/refresh token creation.
modules/auth/serivces/google.service.ts Adds placeholder Google OAuth service namespace.
modules/auth/schemas/signup.schema.ts Adds signup validation (nickname rules + i18n errors).
modules/auth/schemas/signin.schema.ts Adds sign-in schema (currently unused).
modules/auth/schemas/refresh-token.schema.ts Exports refresh token schema as named export.
modules/auth/schemas/index.schema.ts Centralizes auth schema exports.
modules/auth/schemas/google-user.schema.ts Adds Google user payload validation.
modules/auth/schemas/github-user.schema.ts Adds GitHub user payload validation.
modules/auth/schemas/discord-user.schema.ts Adds Discord user payload validation.
modules/auth/schemas/credential.schema.ts Updates credential schema to accept email or nickname (i18n rules).
modules/auth/routes/oauth.router.ts Adds OAuth endpoints for providers.
modules/auth/routes/index.router.ts Reworks auth routes and introduces protected scope via JWT plugin.
modules/auth/models/Session.d.ts Defines Redis-stored session shape (including provider tokens).
modules/auth/exceptions/unauthorized.exception.ts Removes module-local UnauthorizedError (moved to shared exceptions).
modules/auth/exceptions/notfound.exception.ts Removes module-local NotFoundError (moved to shared exceptions).
modules/auth/controllers/index.controller.ts Implements signup/login/refresh/logout/revoke using Prisma + Redis sessions.
modules/auth/controllers/google-oauth.controller.ts Implements Google OAuth redirect/callback and session creation.
modules/auth/controllers/github-oauth.controller.ts Implements GitHub OAuth redirect/callback with PKCE and session creation.
modules/auth/controllers/discord-oauth.controller.ts Implements Discord OAuth redirect/callback and session creation.
locales/pt-BR/zod.json Adds zod namespace file (empty).
locales/fr-FR/zod.json Adds zod namespace file (empty).
locales/es-ES/zod.json Adds ES translation for nickname validation rules.
locales/es-ES/errors.json Adds ES error translation entry.
locales/en-US/zod.json Adds EN translation for nickname validation rules.
index.ts Registers CORS + cookies and mounts v1 routes under /1.
exceptions/unauthorized.exception.ts Adds shared UnauthorizedError with statusCode.
exceptions/notfound.exception.ts Adds shared NotFoundError with statusCode.
exceptions/index.exception.ts Adds shared exception barrel exports.
exceptions/conflict.exception.ts Adds shared ConflictError with statusCode.
database/redis/client.ts Renames/normalizes Redis client/config extraction.
database/prisma/schema.prisma Adds OAuthAccount relations/fields and adjusts image/user relations.
database/prisma/migrations/20260507020539/migration.sql Updates migration for new OAuth fields/constraints and onDelete behavior.
config/jwt.ts Fixes JWT expirations to be relative seconds.
config/i18n.ts Adds zod namespace and types the init config.
config/database.ts Changes default DB/Redis env defaults (empty strings).
compose.yml Adds dev compose stack (API + Postgres + Redis).
ci/Dockerfile.dev Adds dev Dockerfile including Prisma generate step.
@types/i18next.d.ts Adds lightweight i18next type shim for schema factories.
.env.example Updates env example with Postgres/Redis and OAuth vars.

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

Comment thread plugins/cors.ts
Comment thread modules/auth/routes/index.router.ts Outdated
Comment thread plugins/jwt.ts
Comment thread plugins/jwt.ts
Comment thread modules/auth/controllers/google-oauth.controller.ts
Comment thread .env.example Outdated
Comment thread compose.yml
Comment thread modules/auth/controllers/index.controller.ts Outdated
Comment thread modules/auth/controllers/discord-oauth.controller.ts Outdated
Comment thread locales/es-ES/errors.json Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

🚀 Preview deployed: https://api-preview-13-nnratsflva-uc.a.run.app

@itssimmons itssimmons self-assigned this May 8, 2026
Copilot AI review requested due to automatic review settings May 8, 2026 23:37
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

🚀 Preview deployed: https://api-preview-13-nnratsflva-uc.a.run.app

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 43 out of 51 changed files in this pull request and generated 14 comments.

Comment thread modules/auth/routes/index.router.ts Outdated
Comment thread plugins/jwt.ts
Comment thread plugins/jwt.ts
Comment thread plugins/cors.ts
Comment thread config/jwt.ts
Comment thread .env.example Outdated
Comment thread compose.yml
Comment thread modules/auth/services/jwt.service.ts
Comment thread modules/auth/controllers/index.controller.ts Outdated
Comment thread modules/auth/controllers/index.controller.ts Outdated
@github-actions
Copy link
Copy Markdown

🚀 Preview deployed: https://api-preview-13-nnratsflva-uc.a.run.app

@itssimmons itssimmons merged commit 44f882d into main May 12, 2026
4 checks passed
@itssimmons itssimmons deleted the feat/auth branch May 12, 2026 01:32
@github-actions
Copy link
Copy Markdown

🧹 Preview no longer available

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.

3 participants