Explore the full case study, featuring an overview of the project's architecture, technical decisions, challenges, and solutions developed throughout the implementation.
A personal analytics platform designed to understand portfolio traffic, visitor engagement, and interaction patterns.
Portfolio Analytics is a personal analytics platform developed to provide a clearer understanding of how visitors interact with my developer portfolio.
The project collects browsing events and organizes them into sessions, allowing me to analyze traffic patterns, section engagement, and interactions with important portfolio resources.
Rather than relying only on page view counts, the platform tracks relevant actions such as visiting sections, opening project links, accessing GitHub, and downloading a résumé.
The collected information is presented through an analytics dashboard and can also be used to trigger automated Telegram notifications through n8n.
The system was built with React, TypeScript, Node.js, Express, and PostgreSQL, with a focus on backend development, event tracking, data organization, and service integration.
A developer portfolio is an important part of a professional online presence, but basic traffic statistics do not always provide enough information to understand how visitors use it.
I wanted to answer practical questions:
- Which portfolio sections attract the most attention?
- How much time do visitors spend exploring different sections?
- Are visitors accessing project pages, demos, GitHub, or LinkedIn?
- Are visitors downloading my résumé?
- How do visitor interactions change over time?
- Is the portfolio providing enough engagement to justify improvements?
The goal was to build a lightweight analytics solution focused on the information that could help me evaluate and improve my own portfolio.
Portfolio Analytics provides an event-tracking system that collects visitor interactions and organizes them into sessions.
Each visitor receives a randomly generated identifier that is stored in the browser and reused on subsequent visits while the stored data remains available. Each browsing session is tracked separately, allowing the system to distinguish returning visitors from new ones.
The backend stores the collected events in PostgreSQL and provides aggregated information for the dashboard.
An additional automation layer uses n8n to monitor session activity and send relevant summaries to Telegram when a session is considered finished.
This approach combines data collection, backend processing, visualization, and automation in a single personal analytics project.
- Generate a unique random identifier for each visitor.
- Reuse the visitor identifier across visits while browser storage remains available.
- Create separate sessions for different visits.
- Distinguish new visitors from returning visitors.
- Record session information such as timestamps, referrer, and browser details.
Visitor identifiers represent browser-level recognition, not verified real-world identities. Clearing browser data may cause the same person to be registered as a new visitor.
The application records relevant interactions with the portfolio, including:
- Page views.
- Section views.
- GitHub link clicks.
- Demo link clicks.
- Résumé downloads.
- Other tracked portfolio interactions.
A minimum time threshold is applied to section tracking to reduce accidental or very brief visits. The exact threshold is not specified here.
- Display visitor and session information.
- Present traffic and engagement indicators.
- Organize interactions by event type.
- Analyze visited sections and project interactions.
- Visualize activity through charts.
- Provide an overview of collected portfolio analytics.
- Retrieve information associated with a session.
- Organize recorded events into a session summary.
- Include visitor classification and session duration.
- Provide relevant interaction details for automated notifications.
- Integrate the backend with n8n through a webhook.
- Monitor session activity through the automation workflow.
- Send session summaries to Telegram.
- Highlight whether the visitor is new or returning.
- Include relevant information such as duration, visited sections, résumé downloads, and external link interactions.
- Protect administrative functionality through authentication.
- Use JWT-based authentication.
- Hash passwords with bcrypt.
- Use HTTP-only cookies for authentication-related session handling.
The project is organized into separate frontend, backend, and automation responsibilities.
The React application presents the analytics dashboard, while the Node.js and Express backend handles event collection, session management, persistence, and data retrieval.
PostgreSQL databases hosted on Neon store the application data. The n8n automation service operates independently from the backend and uses a separate database.
Cloudflare Tunnel provides the connection between the self-hosted services and the external network through a custom domain.
flowchart TD
VISITOR[Portfolio Visitor] --> PORTFOLIO[Developer Portfolio]
PORTFOLIO --> CF[Cloudflare Tunnel]
CF --> API[Node.js / Express API]
API --> DB[(Neon PostgreSQL<br/>Backend Database)]
API --> WEBHOOK[n8n Webhook]
WEBHOOK --> N8N[n8n Automation Service]
N8N --> N8NDB[(Neon PostgreSQL<br/>n8n Database)]
N8N --> SUMMARY[Session Monitoring]
SUMMARY --> API
SUMMARY --> TELEGRAM[Telegram Notification]
ADMIN[Portfolio Owner] --> DASHBOARD[React Analytics Dashboard]
DASHBOARD --> CF
CF --> API
| Layer | Responsibility |
|---|---|
| Presentation | React dashboard and analytics visualizations |
| API | Node.js and Express endpoints |
| Event Tracking | Collection and processing of visitor interactions |
| Session Management | Visitor identification and session lifecycle |
| Authentication | JWT, bcrypt, and HTTP-only cookies |
| ORM | Prisma for database access |
| Database | PostgreSQL hosted on Neon |
| Automation | n8n workflows for session monitoring |
| Notifications | Telegram integration |
| Network Access | Cloudflare Tunnel and custom domain |
The backend and n8n are independent services. Although they run on the same physical device, the backend can continue collecting and processing analytics if the automation service becomes unavailable.
The backend uses PostgreSQL with Prisma ORM.
The main data entities are organized around visitors, sessions, and events.
Stores the browser-level identifier associated with a visitor.
| Field | Description |
|---|---|
| id | Unique visitor identifier |
| createdAt | Visitor registration timestamp |
Stores information about each browsing session.
| Field | Description |
|---|---|
| id | Session identifier |
| visitorId | Reference to the associated visitor |
| startedAt | Session start timestamp |
| lastActivityAt | Most recent recorded activity |
| referrer | Traffic origin information |
| userAgent | Browser and device information |
Stores individual interactions recorded during a session.
| Field | Description |
|---|---|
| id | Event identifier |
| sessionId | Reference to the associated session |
| type | Event type |
| page | Related page or section |
| projectSlug | Related project, when applicable |
| metadata | Additional event information |
| createdAt | Event timestamp |
erDiagram
VISITOR ||--o{ SESSION : has
SESSION ||--o{ EVENT : records
VISITOR {
string id PK
timestamp createdAt
}
SESSION {
string id PK
string visitorId FK
timestamp startedAt
timestamp lastActivityAt
string referrer
string userAgent
}
EVENT {
string id PK
string sessionId FK
string type
string page
string projectSlug
json metadata
timestamp createdAt
}
This structure separates visitor identity, browsing sessions, and individual interactions.
A visitor can have multiple sessions, and each session can contain multiple events. This makes it possible to analyze both individual interactions and broader browsing behavior.
The event collection process starts when a visitor interacts with the portfolio.
flowchart TD
A[Visitor Opens Portfolio] --> B{Visitor ID Exists?}
B -->|Yes| C[Reuse Visitor ID]
B -->|No| D[Generate Random Visitor ID]
C --> E[Create New Session]
D --> E
E --> F[Send Session Data to Backend]
F --> G[Store Session in PostgreSQL]
G --> H[Visitor Interacts with Portfolio]
H --> I[Register Interaction Event]
I --> J[Validate and Process Event]
J --> K[Store Event in PostgreSQL]
K --> L[Update Session Activity]
L --> M[Make Data Available to Dashboard]
The system distinguishes between a visitor and a session. This is important because a returning visitor can generate multiple sessions over time.
Section tracking includes a minimum time threshold to reduce noise caused by accidental or very brief visits.
This makes the collected engagement information more useful than simply recording every section entry.
The exact threshold is an implementation detail that can be adjusted and documented alongside the tracking logic.
One of the project's additional components is an automation workflow that monitors session activity and sends notifications when a session is considered finished.
The backend triggers an n8n webhook with the session identifier. The automation then checks the session information through the backend.
Based on the session's activity status, the workflow continues monitoring or prepares a summary for Telegram.
flowchart TD
A[Backend Creates Session] --> B[Trigger n8n Webhook]
B --> C[Send Session ID]
C --> D[Check Session Information]
D --> E{Session Still Active?}
E -->|Yes| F[Wait for Next Check]
F --> D
E -->|No| G[Retrieve Session Summary]
G --> H[Format Notification]
H --> I[Send Telegram Message]
The Telegram message can include:
- Whether the visitor is new or returning.
- Session duration.
- Visited portfolio sections.
- Résumé download activity.
- LinkedIn and GitHub interactions.
- Other relevant events recorded during the session.
The backend considers a session active when activity has been recorded within the previous 90 seconds. The n8n workflow checks session status periodically, approximately every two minutes according to the current workflow configuration.
This distinction is important: the backend's activity threshold and the automation's polling interval are separate mechanisms.
The backend and n8n run as independent services.
This separation means that a failure in the automation service does not automatically stop the backend from receiving and storing analytics events.
However, because both services share the same physical host, a device-level outage can affect both.
One of the project's most interesting aspects is its deployment approach.
Instead of paying for a traditional server from the beginning, I chose to reuse an available mobile device as the host for the backend and n8n services.
The device remains continuously powered through a charger, allowing the services to run without requiring a dedicated cloud server.
| Component | Purpose |
|---|---|
| Mobile Device | Hosts the backend and n8n services |
| Node.js / Express | Handles analytics API operations |
| n8n | Runs session monitoring and notification workflows |
| Neon Database 1 | Stores backend analytics data |
| Neon Database 2 | Stores n8n data |
| Cloudflare Tunnel | Provides external network access |
| Custom Domain | Provides a stable public entry point |
| Telegram | Receives automated session notifications |
Cloudflare operates as the network bridge between the externally accessible application and the self-hosted services. The backend and n8n remain separate processes with independent responsibilities.
This architecture was chosen primarily to reduce hosting costs and make use of existing resources.
It also introduced practical limitations:
- Availability depends on the mobile device and its network connection.
- Connectivity between the self-hosted services and Cloudflare can occasionally fail.
- Infrastructure instability can affect event timing and session measurements.
- The automation workflow depends on the availability and usage limits of its services.
- The current free monthly n8n allowance has been exhausted, temporarily affecting the notification automation.
The backend and analytics collection are separate from the n8n workflow, so the automation limitation does not necessarily prevent the backend from continuing to operate.
| Category | Technologies |
|---|---|
| Frontend | React, TypeScript |
| Styling | Tailwind CSS |
| Data Visualization | Recharts |
| Backend | Node.js, Express |
| Language | TypeScript |
| ORM | Prisma |
| Database | PostgreSQL |
| Database Hosting | Neon |
| Authentication | JWT, bcrypt, HTTP-only cookies |
| Workflow Automation | n8n |
| Notifications | Telegram |
| Network and Access | Cloudflare Tunnel |
| Development Assistance | Claude, Windsurf |
A central decision was to avoid treating every interaction as an isolated page view.
Instead, the system uses three related entities:
- Visitors represent browser-level identifiers.
- Sessions represent individual browsing visits.
- Events represent interactions recorded during those visits.
This structure provides a more useful foundation for analyzing engagement and understanding how visitors navigate the portfolio.
The visitor identifier is randomly generated and stored in the browser.
This allows the application to recognize a returning browser while its stored identifier remains available.
However, it does not identify a real person or determine which company is visiting the portfolio. It is a technical identifier for analytics purposes, not a verified identity.
A session needs to be treated as an evolving process rather than a record that ends immediately after the first interaction.
The backend updates the last activity timestamp, and the automation workflow periodically checks whether the session is still active.
This makes it possible to generate session summaries after the visitor stops interacting with the portfolio.
The project uses a webhook to connect backend events with an external automation workflow.
The backend remains responsible for collecting and storing analytics data, while n8n handles periodic checks and Telegram notifications.
Keeping these responsibilities separate reduces coupling between the main API and the notification workflow.
The decision to use an existing mobile device instead of a paid server was driven by cost optimization.
This required working with a less conventional deployment environment and dealing with connectivity, availability, and timing issues.
The experience highlighted the difference between making a service accessible and ensuring that it is consistently reliable.
AI tools such as Claude and Windsurf were used during development to support implementation and problem-solving.
The development process still involved reviewing generated suggestions, making technical decisions, adapting the implementation, and modifying the code according to the project's requirements.
This approach provided practical experience using AI-assisted development tools while maintaining responsibility for the resulting application.
The project is currently deployed and collecting real portfolio analytics data.
However, the current infrastructure has limitations that can occasionally affect service availability and the accuracy of timing information.
The inspected project snapshot did not include an automated test suite or a configured CI/CD pipeline.
These are important areas for improvement, especially as the application evolves beyond its original personal-use scope.
Some improvements identified for future development include:
- Move the backend and automation services to more reliable hosting.
- Improve service availability and recovery after connectivity failures.
- Add more robust error handling and retry mechanisms for webhook communication.
- Expand automated unit and integration testing.
- Add rate limiting and stronger validation to event ingestion endpoints.
- Review access controls for session summary endpoints.
- Improve monitoring and structured logging.
- Refine session duration and engagement calculations.
- Add more detailed analytics and filtering options.
- Improve the reliability of automated Telegram notifications.
These improvements would make the platform more reliable and provide a stronger foundation for more advanced analytics.
Developing Portfolio Analytics provided practical experience in:
- Designing a backend-oriented application with Node.js and TypeScript.
- Building REST APIs with Express.
- Modeling relational data with PostgreSQL and Prisma.
- Designing visitor, session, and event relationships.
- Implementing browser-level visitor recognition.
- Collecting and processing behavioral events.
- Building dashboards and data visualizations with React and Recharts.
- Integrating backend services with n8n through webhooks.
- Automating workflows and sending Telegram notifications.
- Deploying self-hosted services through Cloudflare Tunnel.
- Working with separate databases and independent services.
- Understanding infrastructure trade-offs when operating with limited resources.
The project reinforced the importance of designing data collection around real questions, separating application responsibilities, and considering operational reliability alongside implementation.
Software Engineer • Python • FastAPI • TypeScript • Node.js • PostgreSQL
I develop web applications, backend services, and API integrations, with an interest in software architecture, automation, and AI-powered solutions.
Portfolio Analytics is a personal project created to understand how visitors interact with my developer portfolio. It combines event tracking, session management, data visualization, backend development, and workflow automation to turn browsing activity into useful insights.
