Skip to content

Example implementation (POC) highly unstable implementation of Clerk + SvelteKit. WIP

Notifications You must be signed in to change notification settings

kddige/clerk-sveltekit

Repository files navigation

POC: Clerk + SvelteKit

This is a proof of concept for using Clerk with SvelteKit, it should be treated as an experiment and not as a production ready code. It is highly recommended to use the official Clerk SvelteKit, when it is released (check their documentation)

How to use

  1. Clone the repository
git clone https://github.com/kddige/clerk-sveltekit.git
cd clerk-sveltekit
  1. Install dependencies
yarn
  1. Create a Clerk account and setup a project (since you are already here you probably already did that)
  2. Create .env file in the root of the project and add the following variables
PUBLIC_CLERK_PUBLISHABLE_KEY=<PUBLISHABLE_KEY>
CLERK_SECRET_KEY=<SECRET_KEY>
  1. Run the project
yarn dev

Features

  • Client side authentication
  • Client side session
  • Server side authentication
  • Server side session

TODO (draft)

  • Improve server side DX
    • Add a withSession middleware hook to handle sessions
    • Research/improve the current authentication flow. (I am almost certain the current way is NOT the best way to do it)
  • Improve client side DX
    • Create a useSession store
    • Create a useAuth store
    • Create a useUser store
    • Create a getAuth function
    • ...Others?

Contributing

Contributions are very much appreciated! If you want to contribute, please follow these steps:

  • Fork the repository
    • Create a new branch
    • Make your changes
    • Create a pull request

FAQ


  • Is this the Offical Clerk Sveltekit integration?
    • NO!!! Its no way endorsed or maintained by Clerk. This is a proof of concept and it is highly recommended to use the official Clerk SvelteKit, when it is released (check their documentation)

  • Why did you create this?
    • I wanted to try out Clerk and SvelteKit and I couldn't find any examples of how to use them together. So I decided to create this POC.

  • Can I use this in my project?
    • Yes, you can. But I am not responsible for any damage this code might cause.

  • Is it safe?
    • One thing i know, is that i don't know anything🤓. Frankly i am not a security expert, so I can't guarantee that this code is safe. But I am pretty sure that it is safe enough for a POC. If you find any security issues, please let me know.

About

Example implementation (POC) highly unstable implementation of Clerk + SvelteKit. WIP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published