Skip to content

feat(community): add privy-auth template#315

Open
hetansh2220 wants to merge 4 commits intosolana-foundation:mainfrom
hetansh2220:add-privy-auth-template
Open

feat(community): add privy-auth template#315
hetansh2220 wants to merge 4 commits intosolana-foundation:mainfrom
hetansh2220:add-privy-auth-template

Conversation

@hetansh2220
Copy link

Overview

Adds community/privy-auth — a Next.js Solana dApp starter with Privy authentication, embedded wallets, and social login support.

Features

  • Social login via Google, Twitter/X, Discord, and Email
  • Embedded Solana wallet auto-created for every user
  • External wallet support (Phantom, Solflare, etc.)
  • Protected routes with middleware + client-side auth guards
  • Message signing demo with embedded wallet

Tech Stack

  • Next.js 15 (App Router) + React 19 + TypeScript 5
  • @privy-io/react-auth ^2.24.0
  • @solana/web3.js ^1.98.0
  • Tailwind CSS v4 + shadcn/ui

Usage

pnpm create solana-dapp --template privy-auth

},
embeddedWallets: {
solana: {
createOnLogin: "all-users",
Copy link

Choose a reason for hiding this comment

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

Any reason for all-users and not users-without-wallets?

Copy link
Author

Choose a reason for hiding this comment

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

Fixed !

@@ -0,0 +1,48 @@
"use client";
Copy link

Choose a reason for hiding this comment

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

You should be using useWallets from the @privy-io/react-auth/solana as opposed to creating a separate hook for creating the wallet object from user.linkedWallets.

import {useWallets} from '@privy-io/react-auth/solana';

Copy link
Author

Choose a reason for hiding this comment

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

Fixed !

"use client";

import { usePrivy } from "@privy-io/react-auth";
import { useSolanaWallet } from "@/hooks/use-solana-wallet";
Copy link

Choose a reason for hiding this comment

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

commented below but this should be using hooks from the Privy react auth library

Copy link

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Fixed !

"Hello from privy-auth! This is a demo message signed with your embedded Solana wallet.",
);

const result = await signMessage({
Copy link

Choose a reason for hiding this comment

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

this should take in a wallet returned by useWallets hook from privy

Copy link
Author

Choose a reason for hiding this comment

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

Fixed !

@@ -0,0 +1,39 @@
import type {
Copy link

Choose a reason for hiding this comment

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

this can probably go away once you use useWallets hook!

Copy link
Author

Choose a reason for hiding this comment

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

Fixed !

Copy link

@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.

Let's use the useWallets hook!

@github-actions
Copy link

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 13, 2026
@github-actions github-actions bot removed the stale label Mar 14, 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.

2 participants