Contact
personal-os-build
Back to Archive
code / ID_003

personal-os-build

Personal Site + Market Interest Radar(future)

Read raw project notes

Personal OS Build - The Node.js Overhaul

A personal tool by Muhammad Hamizan (Mi), 19, from Padang, Indonesia.

Project URL: /project/personal-os-build

The Story Behind the Build

This project is a massive update from its predecessor, V1.1, which was built using raw PHP structures. The core problem with that setup was design inconsistency; every page could have its very own design system, which completely broke consistency. In one page I’d really like it, the other would be a mess. The PHP stack also limited my ability to use modern JavaScript frameworks, which in turn restricted modern UI design. Don't get me wrong, PHP is faster, but I wanted changes and more possibilities.

The journey wasn't without its headaches. Unexpectedly, when I was testing in a local browser, the website was breaking—I had to double-click to navigate the sidebar or click buttons. But then I tried it on Chrome (I was previously on Firefox), and it turned out it worked just fine. Another major hurdle was connecting the new sites with my existing database. It was painfully difficult because the Node.js app kept crashing on the server. I had to manually fire it up using an API from my local machine. To keep it stable, I've even added a cron job that checks the site's health every 5 minutes; if the Node.js app is down, it restarts it and brings it back online.

But now, it's really interesting. I finally achieved consistency across all pages and sections, and I even unlocked 3D technology—I’ve already applied it to my landing pages, and I love it. The sites now feel much more modern and sleek, truly updated. I know there's nothing wrong with PHP, but I just wanted more possibilities with a JavaScript framework, and I'm obsessed with what I can do now.

What It Does

Personal OS Build functions as an automated market intelligence pipeline. It continuously scans global trends across various platforms and synthesizes actionable niche opportunities using AI.

  • Collects Trends: Gathers global trends from YouTube and news RSS feeds.
  • Collects Social Data: Utilizes the Xpoz API to monitor social media trends.
  • Collects Meta Ads Data: Integrates with the Meta Graph API for Meta Ads trend analysis.
  • Synthesizes Opportunities: Processes collected data using the OpenCode Zen AI to identify actionable niche market opportunities.

Technical Specifications

The system is architected as an HTTP server powered by Express.js, leveraging express, express-session for session management, mysql2 for database interaction, bcryptjs for secure password handling, node-fetch for external API calls, dotenv for environment variable management, and cors for cross-origin resource sharing. It connects to the primary site at /, and interacts with various external APIs including YOUTUBE_API_KEY, XPOZ_API_KEY, OPENCODE_ZEN_API_KEY, and META_ACCESS_TOKEN, running locally during development on http://localhost:3000/ and http://127.0.0.1:5500/.

Most Interesting Code

The core of the server, typically found in app.js, sets up the Express application and establishes the crucial database connection. This snippet demonstrates how the server attempts to connect to the MySQL database asynchronously on startup, a critical part given the challenges faced with database connectivity and server stability. If the database connection fails, the application is designed to exit, mirroring the real-world server crashes Mi experienced before implementing the cron job for restarts.

const express = require('express'); const mysql = require('mysql2/promise'); const dotenv = require('dotenv'); dotenv.config(); const app = express(); const port = process.env.PORT || 3000; async function connectDB() { try { const connection = await mysql.createConnection({ host: process.env.DB_HOST, user: process.env.DB_USER, password: process.env.DB_PASSWORD, database: process.env.DB_NAME }); console.log('Database connected!'); return connection; } catch (error) { console.error('Database connection failed:', error); process.exit(1); } } let db; connectDB().then(connection => { db = connection; app.listen(port, () => { console.log(`Server running on port ${port}`); }); });

Changelog

  • v2.0 — 2026-06-15 — Initial documentation generated for the Node.js overhaul.

Mi/OS 7.0

A personal portfolio in two operating systems.