{"id":28569869,"url":"https://github.com/workos/supabase-authkit-example","last_synced_at":"2025-10-30T00:07:52.075Z","repository":{"id":266514555,"uuid":"887962437","full_name":"workos/supabase-authkit-example","owner":"workos","description":"An example application demonstrating auth with AuthKit and making queries once authenticated with Supabase","archived":false,"fork":false,"pushed_at":"2025-01-03T20:42:51.000Z","size":1739,"stargazers_count":8,"open_issues_count":2,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-06-05T21:13:47.966Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/workos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-13T15:23:47.000Z","updated_at":"2025-05-28T23:50:54.000Z","dependencies_parsed_at":"2024-12-04T17:42:15.736Z","dependency_job_id":null,"html_url":"https://github.com/workos/supabase-authkit-example","commit_stats":null,"previous_names":["workos/supabase-authkit-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workos%2Fsupabase-authkit-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workos%2Fsupabase-authkit-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workos%2Fsupabase-authkit-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workos%2Fsupabase-authkit-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/workos","download_url":"https://codeload.github.com/workos/supabase-authkit-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workos%2Fsupabase-authkit-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259118826,"owners_count":22808063,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-10T17:39:28.421Z","updated_at":"2025-10-30T00:07:47.028Z","avatar_url":"https://github.com/workos.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Supabase and WorkOS AuthKit Next.js integration example\n\nAn example application demonstrating how to authenticate users with AuthKit and interact with Supabase data.\n\n![AuthKit \u0026 Supabase Next.js example](./img/homepage.png)\n\n\u003e Refer to the [User Management](https://workos.com/docs/user-management) and [Supabase](https://supabase.com/docs) documentation for reference.\n\n## Prerequisites\n\n- A [WorkOS account](https://dashboard.workos.com/signup)\n- A [Supabase account](https://database.new)\n\n## Requirements\n\nNode v18 or higher\n\n## Running the example\n\n1. Rename `.env.example` to `.env` and configure the following environment variables, which you can retrieve from the [WorkOS dashboard](https://dashboard.workos.com/):\n\n```sh\n# WorkOS configuration\nWORKOS_CLIENT_ID=client_... # retrieved from the WorkOS dashboard\nWORKOS_API_KEY=sk_test_... # retrieved from the WorkOS dashboard\nWORKOS_REDIRECT_URI=http://localhost:3000/callback # configured in the WorkOS dashboard\nWORKOS_COOKIE_PASSWORD=\u003cyour password\u003e # generate a secure password here\n\n# Supabase configuration\nNEXT_PUBLIC_SUPABASE_URL=[INSERT SUPABASE PROJECT URL]\nNEXT_PUBLIC_SUPABASE_ANON_KEY=[INSERT SUPABASE PROJECT API ANON KEY]\n```\n\n`WORKOS_COOKIE_PASSWORD` must be at least 32 characters long. Generate one using [1Password](https://1password.com/password-generator/) or via command line:\n\n```bash\nopenssl rand -base64 24\n```\n\nBoth `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_ANON_KEY` can be found in [your Supabase project's API settings](https://app.supabase.com/project/_/settings/api)\n\n2. Install the dependencies:\n\n```bash\nnpm install\n```\n\n3. Run the development server:\n\n```bash\nnpm run dev\n```\n\n4. Navigate to [http://localhost:3000](http://localhost:3000)\n\n## Features\n\n- User authentication with WorkOS AuthKit\n- Protected routes requiring authentication\n- Supabase data access from authenticated routes\n- Built with Next.js App Router\n- Styling with Tailwind CSS\n\n## Using the Sample App\n\n### 1. Database Setup\n\nAfter setting up your Supabase project, you'll need to create and populate a messages table. Run the following SQL in your [Supabase SQL Editor](https://app.supabase.com/project/_/sql):\n\n```sql\nCREATE TABLE messages (\n    id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,\n    message_text TEXT NOT NULL,\n    created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP\n);\n\nINSERT INTO messages (message_text)\nVALUES\n    ('Hello, how are you?'),\n    ('Have a great day!'),\n    ('Welcome to our platform!'),\n    ('Enjoy your time here!'),\n    ('Feel free to ask any questions.'),\n    ('We appreciate your feedback.'),\n    ('Thank you for being a part of our community.'),\n    ('Let us know how we can help you.'),\n    ('Stay positive and keep smiling!'),\n    ('Your support means a lot to us.'),\n    ('Wishing you all the best!'),\n    ('Keep up the great work!'),\n    ('We are glad to have you with us.'),\n    ('Take care and stay safe!'),\n    ('Looking forward to your contributions!'),\n    ('Every day is a new opportunity!');\n```\n\n### 2. Authentication Flow\n\n1. Visit the homepage at `http://localhost:3000`\n2. Click either \"Sign up\" to create a new account or \"Sign in\" if you already have one\n3. Complete the authentication process through WorkOS AuthKit\n\n### 3. Application Features\n\nOnce authenticated:\n\nThe homepage will display messages from your Supabase database\n\n![Supabase messages](./img/logged-in.png)\n\nVisit `/protected` to view your user information. If you're not logged in, you'll be prompted to sign in.\n\nIf you are logged in, you'll see your WorkOS user profile details\n\n![WorkOS user profile](./img/protected.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkos%2Fsupabase-authkit-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworkos%2Fsupabase-authkit-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkos%2Fsupabase-authkit-example/lists"}