Setting up ZK Email SDK

Prerequisites

Before you begin:

Make sure you have the following tools installed:

  • Node.js

  • npm or yarn (package manager)

  • A Google OAuth Client ID (for Gmail API access)

To obtain a Google OAuth Client ID:

  1. Create a new project or select an existing one

  2. Enable the Gmail API for your project

  3. Create credentials (OAuth client ID) for a Web application

  4. 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-ts

For yarn users:

yarn create vite my-zk-email-app --template react-ts

2. Navigate to the project directory

cd my-zk-email-app

3. Install dependencies

For npm users:

npm install

For yarn users:

yarn

4. Install the ZK Email SDK

For npm users:

npm install @zk-email/zk-email-sdk

For yarn users:

yarn add @zk-email/zk-email-sdk

5. 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:

Last updated