Hanami is a comprehensive affiliate marketing platform that empowers both brands and affiliates to track, manage, and optimize their campaigns and traffic. The platform provides robust analytics, campaign management, affiliate onboarding, and transparent conversion tracking, all in a modern, scalable architecture.
- Features
- Architecture Overview
- Monorepo Structure
- Tech Stack
- Getting Started
- API Overview
- Database Schema
- Tracking SDK
- Contributing
Screen.Recording.2025-04-28.at.7.07.25.PM.1.mp4
- Campaign Management: Brands can create, manage, and analyze affiliate campaigns.
- Affiliate Onboarding: Affiliates can register, receive invites, and join campaigns.
- Comprehensive Analytics: Real-time dashboards for traffic, conversions, revenue, and campaign performance.
- Conversion Tracking: End-to-end tracking of clicks and sales via a lightweight SDK.
- Multi-Channel Support: Track traffic from WhatsApp, Instagram, YouTube, and more.
- Secure Authentication: Role-based access for brands and affiliates.
Key Components:
- Hanami Frontend: Next.js-based dashboard for brands and affiliates to view analytics, manage campaigns, and access documentation.
- Hanami API: Go-based REST API serving all business logic, analytics, authentication, and campaign management.
- Brand Application: Integrates the Hanami Tracking SDK to capture traffic and conversions from multiple channels.
- Hanami Tracking SDK: Lightweight JavaScript SDK for tracking user actions and conversions, setting cookies, and sending data to the Hanami API.
- Traffic Sources: WhatsApp, Instagram, YouTube, and other platforms drive traffic to the brand's application, tracked via unique links.
Data Flow:
- Brands and affiliates interact with the Hanami Frontend.
- The Frontend communicates with the Hanami API for all data operations.
- The Brand's own application integrates the Hanami Tracking SDK, which collects cookies/events and sends conversion data to the API.
- Traffic from various sources is tracked and attributed to the correct affiliate/campaign.
Hanami/
├── client/ # Next.js frontend (dashboard)
├── server/ # Go backend (REST API)
├── tracking-sdk/ # Lightweight JS SDK for tracking
├── hanami.sql # Database schema (PostgreSQL)
- Frontend: Next.js, React, TailwindCSS, Chart.js, Tremor, Radix UI, React Query
- Backend: Go (Gin, SQLC), PostgreSQL
- SDK: JavaScript (compatible with Next.js)
- Node.js (v18+)
- Go (v1.23+)
- PostgreSQL
git clone <repo-url>
cd Hanami- Use the provided
hanami.sqlto set up the PostgreSQL schema.
cd server
cp .env.example .env # Update DB_URL, DRIVER, etc.
go run main.gocd ../client
npm install
npm run dev- For brands, integrate the SDK from
tracking-sdk/loader.jsinto your application to enable event and conversion tracking.
The Hanami API exposes REST endpoints for:
- User & Authentication: Register/login for brands and affiliates
- Campaigns: Create, update, delete, and list campaigns
- Invites: Send and manage campaign invites
- Tracking Links: Generate and manage unique tracking links
- Analytics: Retrieve real-time metrics for traffic, revenue, conversions, and more
- Conversions: Record and fetch conversion data
See server/api/ for detailed handler implementations.
- See
hanami.sqlfor a detailed schema including users, brands, affiliates, campaigns, tracking links, clicks, conversions, and sales.
- The SDK is designed to be easily integrated into any web application.
- Usage example (see
tracking-sdk/loader.js):<script src="/tracking-sdk/loader.js"></script>
- The SDK will automatically set cookies and send conversion/click data to the Hanami API.
- Fork the repo
- Create your feature branch (
git checkout -b feature/fooBar) - Commit your changes (
git commit -am 'Add some fooBar') - Push to the branch (
git push origin feature/fooBar) - Create a new Pull Request
MIT
For questions, reach out to the maintainer.
Hanami © 2025
