Skip to content

Build your own Posthog - PART 1

Published: at 03:22 PMSuggest Changes

Introduction and Project Overview

What if I told you that you could build your own version of PostHog or Mixpanel in just a weekend? That’s exactly what I did with SmolHog - and through this blog, I’m going to share why I built it, how it works, and why you should care.

The Why

Every developer has used Google Analytics or Mixpanel, but have you ever wondered what’s actually happening under the hood? When your app sends an event, where does it go? How does it get processed? How do those beautiful dashboards get their data in real-time?

Building SmolHog has been an incredible journey into system design patterns, event-driven architectures, and real-time data processing. There’s no better way to understand how these systems work than building one yourself!

Tech Stack

TechnologyPurpose
Typescript/ExpressAPI Gateway
Flutter/ DartFlutter SDK
Python/ FastAPIEvent Processor
PostgreSQLDatabase
RabbitMQMessage Broker
NextJSAnalytics Dashboard (Client Side)
JaegerTracing
PrometheusMonitoring
Grafana & LokiDashboard & Logs (System Infra)
DockerContainerization

10,000 feet perspective

Smolhog Architecture

Key Components

Flutter SDK

API Gateway

RabbitMQ (Message Broker)

Event Processor

Workers

Database

Frontend

Key Features

  1. Event Tracking SmolHog can track any user interaction - clicks, page views, form submissions - with custom properties for detailed analysis.

  2. User Identification Connect events to specific users and track their journey through your application over time.

  3. Real-time Dashboard See events as they happen with a 10-second refresh interval (with plans to upgrade to WebSockets for true real-time updates).

  4. Custom Event Properties Attach any properties to your events for deeper analysis and segmentation.

  5. Time-Series Analysis Track event distribution over time to identify patterns and trends.

  6. Cross-Platform SDK Currently supports Flutter, with a clean, easy-to-use API.

Stay tuned for more technical deep dives into specific components of SmolHog in future blog posts!

Till then Happy Coding.


Next Post
GoogleSignIn Macos - Flutter