Very basic shuttle, axum and clerk set up. Index.html points to authed and unauthed routes. Allows users to sign in or sign up. That is it.
- Go to Clerk.dev and create an account.
- Create a new application.
- Add a dummy user so you can test authentication.
- Note we use a script tag in the index.html to access to JS Clerk SDK from a CDN. Alternatively, download it via NPM etc as per docs.
You’ll need two keys from Clerk:
CLERK_PUBLISHABLE_KEY(frontend)CLERK_SECRET_KEY(backend)
-
Create a
Secrets.tomlfile in the root of your project:CLERK_SECRET_KEY = "your-secret-key-here"
-
Create a
.envfile in the root of your project:CLERK_PUBLISHABLE_KEY=your-publishable-key-here
Note: The index.html file includes a placeholder for the CLERK_PUBLISHABLE_KEY — make sure it matches your .env value.
Make sure you have the Shuttle runtime installed. From your terminal, run:
curl -sSfL https://www.shuttle.dev/install | bashFor more shuttle install info go to Shuttle.dev
git clone https://github.com/leshec/axum_clerk_basic.git
cd axum_clerk_basic
cargo update
shuttle runGo to http://127.0.0.1:8000/
Note: check the latest shuttle runtime and axum versions in the docs are right as that can be an issue.
Further note: Issue with out of date docs. To get Secrets.toml called in the main macro of axum.
#[shuttle_secrets::Secrets] has been replaced with [shuttle_runtime::Secrets] as per this main.rs file.
For production there are a whole load of other steps, see the Clerk docs.