Local Development
Customize and contribute to Helper
Make sure you follow the Quick Start in the README first!
Docker Services
The app uses Docker to run the following services locally:
- Supabase
- Inngest
- Nginx (allowing you to use the
https://helperai.dev
domain)
pnpm dev
will automatically start and stop these services, or you can use pnpm services:start
and pnpm services:stop
to start and stop them manually.
Nginx will attempt to listen on port 80 and 443, so if you have other containers or services running on those ports you will need to stop them first.
Database Management
Seed the database with sample data:
Generate/run database migrations:
Note that pnpm dev
will automatically run migrations, but won't generate them.
Testing
Background Tasks
This project uses Inngest for background tasks. You can view the dashboard / development server at http://localhost:8288/.
SSL certificates
The app uses a local Certificate Authority (CA) to generate SSL certificates for the https://helperai.dev
domain.
The certificates will be automatically generated when you run pnpm dev
for the first time, but if you need to regenerate them you can use:
Optional Integrations
These integrations are optional for local development but required to make Helper work correctly in production:
Google OAuth (sending via Gmail)
- Go to the Google Cloud Console.
- Create a new project or select an existing one.
- Navigate to "APIs & Services" > "Credentials".
- Click "Create Credentials" and select "OAuth client ID".
- Choose "Web application" as the application type.
- Add
https://helperai.dev/api/connect/google/callback
to the "Authorized redirect URIs". - Click "Create". You will be shown the Client ID and Client Secret.
- Add these values to your
.env.local
file asGOOGLE_CLIENT_ID
andGOOGLE_CLIENT_SECRET
. - Navigate to "APIs & Services" > "Library".
- Search for "Gmail API" and enable it for your project.
- Navigate to "APIs & Services" > "OAuth consent screen".
- Configure the consent screen. Under "Data access", add the
.../auth/gmail.send
scope. - Add your Google account email address as a Test User under "Audience" while the app is in testing mode.
Google Pub/Sub (receiving from Gmail)
This setup allows the app to receive real-time notifications (e.g., new emails) from Gmail during local development.
1. Set up and start Serveo, ngrok or similar to get a public forwarding URL pointing to localhost:3010
.
2. Set up Google Pub/Sub:
- Go to the Google Cloud Console and select the same project used for Google OAuth.
- Navigate to "Pub/Sub" > "Topics".
- Click "Create Topic". Give it a name (e.g.,
helper-email-dev
) and click "Create". - Add the topic name to your
.env.local
file asGOOGLE_PUBSUB_TOPIC_NAME
. - Grant the Gmail service account permission to publish to this topic:
- Go back to the "Topics" list and check the box next to your new topic.
- Click "Permissions" in the info panel on the right (or click the topic name and go to the Permissions tab).
- Click "Add Principal".
- In the "New principals" field, enter
gmail-api-push@system.gserviceaccount.com
. - Assign the role "Pub/Sub Publisher".
- Click "Save".
- Create a service account for the push subscription authentication:
- Go to "IAM & Admin" > "Service Accounts".
- Click "Create Service Account".
- Give it a name (e.g.,
pubsub-push-auth-dev
) and an ID. Click "Create and Continue". - Grant the service account the "Service Account Token Creator" role (
roles/iam.serviceAccountTokenCreator
). This allows it to generate OIDC tokens for authentication. Click "Continue" and "Done". - Add the service account email (e.g.,
pubsub-push-auth-dev@<your-project-id>.iam.gserviceaccount.com
) to your.env.local
file asGOOGLE_PUBSUB_CLAIM_EMAIL
- Create the push subscription:
- Navigate to "Pub/Sub" > "Subscriptions".
- Click "Create Subscription".
- Give it an ID (e.g.,
helper-email-subscription-dev
). - Select the Pub/Sub topic you created earlier (e.g.,
helper-email-dev
). - Under "Delivery type", select "Push".
- In the "Endpoint URL" field, enter your forwarding URL followed by the webhook path:
https://<your-forwarding-url>/api/webhooks/gmail
(replace<your-forwarding-url>
with the URL from step 1). - Check the box for "Enable authentication".
- Select the service account you just created (e.g.,
pubsub-push-auth-dev@<your-project-id>.iam.gserviceaccount.com
). - Leave other settings as default and click "Create".
Now linking your Gmail account from Settings → Integrations should grant Gmail access and webhooks for new emails should arrive on your local server.
These integrations are entirely optional but add more functionality to Helper.
Slack
Enables various features including messaging channels when tickets are received, messaging users when tickets are assigned, and an AI agent.
- Set up and start Serveo, ngrok or similar to get a public forwarding URL pointing to
localhost:3010
. - Go to api.slack.com/apps and create a new app.
- Under "Basic Information", find your app credentials.
- Add the following values to your
.env.local
file:SLACK_CLIENT_ID
: Client ID from Basic InformationSLACK_CLIENT_SECRET
: Client Secret from Basic InformationSLACK_SIGNING_SECRET
: Signing Secret from Basic Information
- Under "OAuth & Permissions", add all scopes listed in
lib/slack/constants.ts
- Under "Event Subscriptions", add
https://<your-forwarding-url>/api/webhooks/slack/event
as the event request URL - Also under "Event Subscriptions", subscribe to the following bot events:
app_mention
assistant_thread_started
message.channels
message.im
tokens_revoked
- Under "Interactivity & Shortcuts", add
https://<your-forwarding-url>/api/webhooks/slack/response
as the interactivity request URL - Under "Agents & AI Apps", check "Agent or Assistant"
- Under "App Home", check "Always Show My Bot as Online"
- Install the app to your workspace.
GitHub
Enables creating GitHub issues from tickets and replying to the customer when the issue is closed.
- Go to github.com/settings/apps and click "New GitHub App".
- Fill in the required fields, including a name for your app.
- Set the Callback URL to
https://<your-forwarding-url>/api/connect/github/callback
- Also set the post-installation Setup URL to
https://<your-forwarding-url>/api/connect/github/callback
and check "Redirect on update" - Set the following permissions:
- Repository permissions:
- Issues: Read & write
- Account permissions:
- Email addresses: Read-only
- Repository permissions:
- After creating the app, note the App ID and generate a private key.
- Add the following values to your
.env.local
file:GITHUB_APP_SLUG
: The slug of your GitHub app (from the URL; it should be a dasherized version of your app's name)GITHUB_APP_ID
: The App ID found in the app settingsGITHUB_CLIENT_SECRET
: The Client Secret from the app settingsGITHUB_PRIVATE_KEY
: The contents of the private key file you downloaded
Jina
Enables the widget to read the current page for better AI context.
- Go to jina.ai and create an account or log in.
- Navigate to the API section to generate an API token.
- Add the token to your
.env.local
file asJINA_API_TOKEN
.
Firecrawl
Enables linking an existing knowledge base website for the AI to reference.
- Go to firecrawl.dev and create an account or log in.
- Generate an API key from your account settings or dashboard.
- Add the API key to your
.env.local
file asFIRECRAWL_API_KEY
.
Asset Proxy
Enables passing email assets through an intermediate server to increase security.
- Set up a proxy server with HMAC authentication. Use the following CloudFlare Worker script for reference:
- Add the following values to your
.env.local
file:PROXY_URL
: The URL of your proxy serverPROXY_SECRET_KEY
: The same secret key you set in the script
Sentry
Enables error reporting and performance tracing.
- Go to sentry.io and create an account or log in.
- Create a new project for a Next.js application.
- In the project settings, find the DSN (Data Source Name).
- Add the DSN to your
.env.local
file asNEXT_PUBLIC_SENTRY_DSN
.