Setting up ZK Email SDK
Prerequisites
To obtain a Google OAuth Client ID:
Go to the Google Cloud Console
Create a new project or select an existing one
Enable the Gmail API for your project
Create credentials (OAuth client ID) for a Web application
Note down your Client ID for later use
Project Setup and Installation
Choose your framework below for specific setup and installation instructions.
1. Create a new React project with Vite
For npm users:
npm create vite@latest my-zk-email-app -- --template react-tsFor yarn users:
yarn create vite my-zk-email-app --template react-ts2. Navigate to the project directory
cd my-zk-email-app3. Install dependencies
For npm users:
npm installFor yarn users:
yarn4. Install the ZK Email SDK
For npm users:
npm install @zk-email/zk-email-sdkFor yarn users:
yarn add @zk-email/zk-email-sdk5. Create an environment file
Create a new file named .env in the root of your project:
Add your Google OAuth Client ID to the .env file:
6. Configuration
Update your src/App.tsx file:
1. Create a new Next.js project
For npm users:
For yarn users:
Choose the following options:
Would you like to use TypeScript? › Yes
Would you like to use ESLint? › Yes
Would you like to use Tailwind CSS? › Yes (or No, if you prefer)
Would you like to use
src/directory? › YesWould you like to use App Router? › Yes
Would you like to customize the default import alias? › No
2. Navigate to the project directory
3. Install the ZK Email SDK
For npm users:
For yarn users:
4. Create an environment file
Create a new file named .env.local in the root of your project:
Add your Google OAuth Client ID to the .env.local file:
5. Configuration
Create a new file src/app/providers.tsx:
Update your src/app/layout.tsx file:
1. Create a new Next.js project
For npm users:
For yarn users:
Choose the following options:
Would you like to use TypeScript? › Yes
Would you like to use ESLint? › Yes
Would you like to use Tailwind CSS? › Yes (or No, if you prefer)
Would you like to use
src/directory? › YesWould you like to use App Router? › No
Would you like to customize the default import alias? › No
2. Navigate to the project directory
3. Install the ZK Email SDK
For npm users:
For yarn users:
4. Create an environment file
Create a new file named .env.local in the root of your project:
Add your Google OAuth Client ID to the .env.local file:
5. Configuration
Create or update src/pages/_app.tsx:
Last updated