Skip to main content

Project Structure

hans.ai is built as a monorepo using Turborepo, with the following structure:

Technology Stack

Frontend

  • Next.js 15 - React framework with App Router
  • TypeScript - Type-safe development
  • Tailwind CSS - Utility-first CSS framework
  • Zustand - State management
  • Radix UI - Accessible component primitives

Backend

  • Next.js API Routes - API endpoints
  • Prisma - Database ORM
  • PostgreSQL - Primary database
  • Better Auth - Authentication system
  • Resend - Email service
  • OpenAI - AI-powered features

Infrastructure

  • Turborepo - Monorepo management
  • Vercel - Deployment platform
  • Stagehand - Browser automation

Development Commands

Root Commands (Monorepo)

Web App Commands

Navigate to apps/web or use turbo from root:

Environment Variables

Create a .env.local file in apps/web:

Database Schema

The application uses Prisma with PostgreSQL. Key models include:
  • User - User accounts and authentication
  • NotificationTask - Monitoring configurations
  • Action - Notification actions (email, webhook)
  • TaskExecution - Execution history
  • EvaluationResult - Evaluation outcomes

Testing

Running Tests

Writing Tests

Place test files next to the code they test:

Code Style

The project uses:
  • ESLint for linting
  • Prettier for formatting
  • TypeScript strict mode

Git Hooks

Pre-commit hooks ensure code quality:
  • Format with Prettier
  • Lint with ESLint
  • Type check with TypeScript

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Ensure all tests pass
  6. Submit a pull request

Debugging

VS Code Configuration

.vscode/launch.json:

Common Issues

Ensure PostgreSQL is running and DATABASE_URL is correct:
Regenerate the Prisma client: bash yarn db:generate
The dev server runs on port 3010. Kill the process: