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 toapps/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
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Ensure all tests pass
- Submit a pull request
Debugging
VS Code Configuration
.vscode/launch.json:
Common Issues
Database connection errors
Database connection errors
Ensure PostgreSQL is running and
DATABASE_URL is correct:Prisma client not generated
Prisma client not generated
Regenerate the Prisma client:
bash yarn db:generate Port already in use
Port already in use
The dev server runs on port 3010. Kill the process: