Skip to main content

Setup your development environment

Learn how to set up your local development environment for hans.ai.

Prerequisites

Before you begin, make sure you have the following installed:
  • Node.js 22.0 or later
  • Yarn package manager
  • PostgreSQL database

Installation

1

Clone the repository

git clone https://github.com/your-org/notify-me.git
cd notify-me
2

Install dependencies

bash yarn install
3

Set up environment variables

Create a .env.local file in the apps/web directory:
DATABASE_URL="postgresql://user:password@localhost:5432/notify_me"
BETTER_AUTH_SECRET="your-secret-key"
BETTER_AUTH_URL="http://localhost:3010"
RESEND_API_KEY="your-resend-api-key"
OPENAI_API_KEY="your-openai-api-key"
4

Set up the database

bash yarn db:migrate yarn db:seed
5

Start the development server

yarn dev
Your app should now be running on http://localhost:3010.

Create your first notification task

Once your development environment is set up, you can create your first notification task:
const response = await fetch('http://localhost:3010/api/notifications', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: 'Bearer YOUR_API_TOKEN',
  },
  body: JSON.stringify({
    name: 'Price Monitor',
    description: 'Monitor product price changes',
    url: 'https://example.com/product',
    evaluationFunction: `
      const price = document.querySelector('.price').textContent;
      const numericPrice = parseFloat(price.replace('$', ''));
      return numericPrice < 100;
    `,
    actions: [
      {
        type: 'email',
        config: {
          to: '[email protected]',
          subject: 'Price Alert!',
        },
      },
    ],
  }),
});

Next steps