Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update repo #5

Merged
merged 7 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Get your Clerk API keys: https://dashboard.clerk.com
# Refer to the docs to get the correct variable name: https://clerk.com/docs/deployments/clerk-environment-variables
CLERK_PUBLISHABLE_KEY=pk_test_
CLERK_SECRET_KEY=sk_test_
3 changes: 0 additions & 3 deletions .env.sample

This file was deleted.

43 changes: 36 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,36 @@
node_modules
.idea
dist
.yalc
yalc.lock
build
.env
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# env files
.env
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
3 changes: 0 additions & 3 deletions .prettierrc

This file was deleted.

95 changes: 70 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,86 @@
<p align="center">
<a href="https://clerk.dev?utm_source=github&utm_medium=clerk_fastify" target="_blank" rel="noopener noreferrer">
<img src="https://images.clerk.dev/static/logo-light-mode-400x400.png" height="64">
<a href="https://clerk.com?utm_source=github&utm_medium=clerk_docs" target="_blank" rel="noopener noreferrer">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="./public/light-logo.png">
<img alt="Clerk Logo for light background" src="./public/dark-logo.png" height="64">
</picture>
</a>
<br />
<br />
</p>
<div align="center">
<h1>
Clerk and Fastify Quickstart
</h1>
<a href="https://www.npmjs.com/package/@clerk/clerk-js">
<img alt="Downloads" src="https://img.shields.io/npm/dm/@clerk/clerk-js" />
</a>
<a href="https://discord.com/invite/b5rXHjAg7A">
<img alt="Discord" src="https://img.shields.io/discord/856971667393609759?color=7389D8&label&logo=discord&logoColor=ffffff" />
</a>
<a href="https://twitter.com/clerkdev">
<img alt="Twitter" src="https://img.shields.io/twitter/url.svg?label=%40clerkdev&style=social&url=https%3A%2F%2Ftwitter.com%2Fclerkdev" />
</a>
<br />
<br />
<img alt="Clerk Hero Image" src="./public/hero.png">
</div>

## Introduction

Clerk is a developer-first authentication and user management solution. It provides pre-built React components and hooks for sign-in, sign-up, user profile, and organization management. Clerk is designed to be easy to use and customize, and can be dropped into any application.

After following the quickstart you'll have learned how to:

- Install `@clerk/fastify`
- Set your Clerk API keys
- Add Clerk's middleware
- Add `<ClerkProvider />` and Clerk components

## Deploy

Easily deploy the template to Vercel with the button below. You will need to set the required environment variables in the Vercel dashboard.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fclerk%2Fclerk-fastify-quickstart&env=NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY,CLERK_SECRET_KEY&envDescription=Clerk%20API%20keys&envLink=https%3A%2F%2Fclerk.com%2Fdocs%2Fquickstart%fastify&redirect-url=https%3A%2F%2Fclerk.com%2Fdocs%2Fquickstart%fastify)

# Clerk Fastify Starter
## Running the template

This example shows how to use [Clerk](https://www.clerk.dev/?utm_source=github&utm_medium=starter_repos&utm_campaign=fastify_starter) with Fastify.
```bash
git clone https://github.com/clerk/clerk-fastify-quickstart
```

[![chat on Discord](https://img.shields.io/discord/856971667393609759.svg?logo=discord)](https://discord.com/invite/b5rXHjAg7A)
[![documentation](https://img.shields.io/badge/documentation-clerk-green.svg)](https://docs.clerk.dev)
[![twitter](https://img.shields.io/twitter/follow/ClerkDev?style=social)](https://twitter.com/intent/follow?screen_name=ClerkDev)
To run the example locally, you need to:

## Running the starter
To run the example locally you need to:
1. Sign up for a Clerk account at [https://clerk.com](https://dashboard.clerk.com/sign-up?utm_source=DevRel&utm_medium=docs&utm_campaign=templates&utm_content=clerk-fastify-quickstart).

1. Sign up for a Clerk account at https://clerk.dev.
2. Go to [Clerk's dashboard](https://dashboard.clerk.dev/?utm_source=github&utm_medium=starter_repos&utm_campaign=fastify_starter) and create an application.
3. Clone the repo locally `git clone [email protected]:clerkinc/clerk-fastify-starter.git && cd clerk-fastify-starter`
4. Set the required Clerk environment variables as shown in [the example env file](./.env.sample).
5. `npm install` the required dependencies.
6. `npm run start` to launch the demo Fastify server.
2. Go to the [Clerk dashboard](https://dashboard.clerk.com?utm_source=DevRel&utm_medium=docs&utm_campaign=templates&utm_content=clerk-fastify-quickstart) and create an application.

## Contents
This example repo contains the following examples:
- `./src/index.ts`: Basic Clerk and Fastify usage. Run the example with `npm run start`
- `./src/authenticating-specific-routes.ts`: Instead of using Clerk globally, this examples show how to use Clerk for a subset of your routes, using the `register` Fastify helper. Run the example with `npm run start:specific-routes`.
- `./src/using-runtime-keys.ts`: Instead of setting environment variables, this examples shows how to initialise Clerk by passing the required API keys directly to `clerkPlugin`. Run the example with `npm run start:runtime-keys`
3. Set the required Clerk environment variables as shown in [the example `env.example` file](./.env.example).

4. `npm install` the required dependencies.

5. `npm run dev` to launch the development server.

## Learn more

To learn more about Clerk and Fastify, check out the following resources:

- [@clerk/fastify package README](https://github.com/clerkinc/javascript/blob/main/packages/fastify/README.md)
- [Clerk Documentation](https://clerk.dev/docs?utm_source=github&utm_medium=starter_repos&utm_campaign=fastify_starter)
- [Quickstart: Get started with Clerk and Fastify](https://clerk.com/docs/quickstarts/fastify?utm_source=DevRel&utm_medium=docs&utm_campaign=templates&utm_content=clerk-fastify-quickstart)
- [Clerk Documentation](https://clerk.com/docs?utm_source=DevRel&utm_medium=docs&utm_campaign=templates&utm_content=clerk-fastify-quickstart)
- [Fastify Documentation](https://fastify.dev/docs/latest)

## Found an issue?

If you have found an issue with the quickstart, please create an [issue](https://github.com/clerk/clerk-fastify-quickstart/issues).

If it's a quick fix, such as a misspelled word or a broken link, feel free to skip creating an issue.
Go ahead and create a [pull request](https://github.com/clerk/clerk-fastify-quickstart/pulls) with the solution. :rocket:

## Want to leave feedback?

Feel free to create an [issue](https://github.com/clerk/clerk-fastify-quickstart/issues) with the **feedback** label. Our team will take a look at it and get back to you as soon as we can!

## Connect with us

## Contact
You can discuss ideas, ask questions, and meet others from the community in our [Discord](https://discord.com/invite/b5rXHjAg7A).

If you need support or have anything you would like to ask, please reach out in our [Discord channel](https://discord.com/invite/b5rXHjAg7A). We'd love to chat!
If you prefer, you can also find support through our [Twitter](https://twitter.com/ClerkDev), or you can [email](mailto:[email protected]) us!
Loading