Skip to content

feat(express): Introduce Clerk package for Express - #2918

Merged
dimkl merged 16 commits into
mainfrom
feat/express
Apr 5, 2024
Merged

feat(express): Introduce Clerk package for Express#2918
dimkl merged 16 commits into
mainfrom
feat/express

Conversation

@dimkl

@dimkl dimkl commented Mar 2, 2024

Copy link
Copy Markdown
Contributor

Description

Introduce Express specific Clerk SDK @clerk/express. The SDK exposes the following API:

  • clerkClient: default @clerk/backend client initialized from env variables and used to make BAPI requests
  • clerkMiddleware: centralized middleware that authenticates all requests without blocking them (also triggers handshake mechanism)
  • getAuth: utility to retrieve the auth state from the request (requires clerkMiddleware to executed)
  • requireAuth: middleware that returns http 401 response when request is signed-out

Also all the top level exports from @clerk/backend are re-exported from @clerk/express top level.

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

TODOs

  • Add tests
  • Add examples
  • Replace all TODO(express) TODOs
  • Use this package to create separate page in backend-request/handling docs

@dimkl
dimkl requested a review from nikosdouvlis March 2, 2024 01:20
@dimkl dimkl self-assigned this Mar 2, 2024
@changeset-bot

changeset-bot Bot commented Mar 2, 2024

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 55d9b64

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clerk/express Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@LekoArts LekoArts 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.

First pass at looking through the changes :)

Comment thread .changeset/bright-gorillas-crash.md Outdated
Comment thread packages/express/.npmignore Outdated
Comment thread packages/express/CHANGELOG.md
Comment thread packages/express/LICENSE Outdated
Comment thread packages/express/README.md Outdated
Comment thread packages/express/src/clerkClient.ts Outdated
Comment thread packages/express/src/errors.ts Outdated
Comment thread packages/express/src/getAuth.ts
Comment thread packages/express/src/protect.ts Outdated
Comment thread packages/express/src/clerkMiddleware.ts Outdated
Base automatically changed from backend/debug to main March 11, 2024 11:34
@dimkl
dimkl force-pushed the feat/express branch 2 times, most recently from e213120 to 3ed2a03 Compare March 11, 2024 18:47
@dimkl
dimkl requested a review from LekoArts March 11, 2024 18:48
@dimkl
dimkl force-pushed the feat/express branch 3 times, most recently from d771634 to 94530c5 Compare March 15, 2024 13:46
@dimkl
dimkl force-pushed the feat/express branch 3 times, most recently from 61e0396 to 2029c38 Compare March 15, 2024 14:00
@dimkl
dimkl force-pushed the feat/express branch 2 times, most recently from 3d62ee1 to 5ac94e9 Compare March 29, 2024 11:55
@dimkl

dimkl commented Apr 2, 2024

Copy link
Copy Markdown
Contributor Author

@LekoArts, @nikosdouvlis Could you take another look at this PR?

@dimkl
dimkl force-pushed the feat/express branch 3 times, most recently from e13a230 to 4a035c5 Compare April 2, 2024 20:48

@LekoArts LekoArts 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.

Overall LGTM, some minor comments I'd like to resolve before merging

Comment thread packages/express/README.md Outdated
Comment thread packages/express/README.md
Comment thread packages/express/src/errors.ts Outdated
Comment thread packages/express/src/requireAuth.ts Outdated
Comment thread packages/express/src/types.ts Outdated
@dimkl
dimkl force-pushed the feat/express branch 2 times, most recently from 30cceb7 to 91e596a Compare April 4, 2024 10:34
Comment thread packages/express/src/authenticateRequest.ts
Comment thread packages/express/src/clerkClient.ts
Comment thread packages/express/src/clerkMiddleware.ts Outdated
Comment thread packages/express/src/utils.ts Outdated
Comment thread packages/express/src/clerkMiddleware.ts
Comment thread packages/express/src/requireAuth.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants