Skip to content

feat: add privy-auth community template#317

Open
nathanliow wants to merge 2 commits intosolana-foundation:mainfrom
nathanliow:community/privy-auth
Open

feat: add privy-auth community template#317
nathanliow wants to merge 2 commits intosolana-foundation:mainfrom
nathanliow:community/privy-auth

Conversation

@nathanliow
Copy link
Copy Markdown

Add a community/privy-auth template to the Solana Foundation's templates repo demonstrating Privy-based authentication in a Solana dApp — including social logins, embedded wallet creation, and protected routes — usable via pnpm create solana-dapp --template privy-auth.

@@ -0,0 +1,42 @@
/** Represents a linked account from Privy's user object */
export type LinkedAccountType =
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for recreating LinkedAccountType? The react auth SDK contains types for these.

}

/** Auth status states used throughout the app */
export type AuthState = "loading" | "authenticated" | "unauthenticated";
Copy link
Copy Markdown

@tedim52 tedim52 Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here - would propose using ready and authenticated variable from usePrivy to control the UI state that shows and removing these.

@@ -0,0 +1,42 @@
/** Represents a linked account from Privy's user object */
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem like these types are being used?

export default function AuthStatus() {
const { ready, authenticated, user } = usePrivy();

const state: AuthState = !ready
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel like AuthState isn't too useful here , propose directly using ready and authenticated

@@ -0,0 +1,146 @@
"use client";

import { usePrivy } from "@privy-io/react-auth";
Copy link
Copy Markdown

@tedim52 tedim52 Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use LinkedAccountWithMetadata from react auth

"use client";

import { useSolanaWallets } from "@privy-io/react-auth/solana";
import { Connection, LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

web3.js is a deprecated package - let's use solana/kit instead: https://docs.privy.io/wallets/connectors/solana/kit-integrations

Copy link
Copy Markdown

@tedim52 tedim52 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this is an auth focused template but would be great to include simle code examples for sign message and send transaction.

- Delete types/privy.ts (custom types not used, duplicated SDK types)
- Refactor AuthStatus to use ready/authenticated directly (no custom AuthState)
- Rewrite UserProfile to use LinkedAccountWithMetadata from @privy-io/react-auth
- Replace @solana/web3.js with @solana/kit in WalletInfo (createSolanaRpc, address)
- Add SignMessage component (working signMessage demo)
- Add SendTransaction component (code reference for building txs with @solana/kit)
- Upgrade to @privy-io/react-auth v3, add @solana-program/{system,token,memo}
- Remove solanaClusters config (removed in Privy v3)
@nathanliow nathanliow requested a review from tedim52 February 27, 2026 23:32
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 7, 2026

This pull request has been automatically marked as stale because it has not had any activity for 7 days.

It will be closed in 7 days if no further activity occurs.

If you believe this PR is still relevant, please add a comment or push new commits to keep it open.

Thank you for your contributions!

@github-actions github-actions bot added the stale label Mar 7, 2026
@n4tebot
Copy link
Copy Markdown

n4tebot commented Mar 7, 2026

Still active — all requested changes have been addressed. Ready for re-review when you get a chance!

@github-actions github-actions bot removed the stale label Mar 8, 2026
@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 7 days.

It will be closed in 7 days if no further activity occurs.

If you believe this PR is still relevant, please add a comment or push new commits to keep it open.

Thank you for your contributions!

@github-actions github-actions bot added the stale label Mar 15, 2026
@n4tebot
Copy link
Copy Markdown

n4tebot commented Mar 15, 2026

Still actively maintained — bumping to keep open. Happy to address any additional feedback from reviewers.

@github-actions github-actions bot removed the stale label Mar 16, 2026
@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 7 days.

It will be closed in 7 days if no further activity occurs.

If you believe this PR is still relevant, please add a comment or push new commits to keep it open.

Thank you for your contributions!

@github-actions github-actions bot added the stale label Mar 23, 2026
@n4tebot
Copy link
Copy Markdown

n4tebot commented Mar 23, 2026

Still active and ready for review — all changes addressed. Bumping to keep open.

@github-actions github-actions bot removed the stale label Mar 24, 2026
@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 7 days.

It will be closed in 7 days if no further activity occurs.

If you believe this PR is still relevant, please add a comment or push new commits to keep it open.

Thank you for your contributions!

@github-actions github-actions bot added the stale label Mar 31, 2026
@n4tebot
Copy link
Copy Markdown

n4tebot commented Mar 31, 2026

Bumping to keep open — still actively maintained and ready for review.

@github-actions github-actions bot removed the stale label Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants