About

About

An overview of the technologies, infrastructure, and architecture behind YDIN — a news intelligence platform for the energy sector.

Built as a solo full-stack project. 100% of the code written with AI (Claude Code, ChatGPT). All architecture, design decisions, code reviews, and trade-offs made by a human.


Architecture

Serverless monorepo on Google Cloud Platform / Firebase. React SPA frontend, Cloud Functions backend, Firestore NoSQL database, and multiple AI models for content processing.

                          +------------------+
                          |   Firebase       |
                          |   Hosting (CDN)  |
                          +--------+---------+
                                   |
                          +--------+---------+
                          |   React SPA      |
                          |   (Vite + MUI)   |
                          +--------+---------+
                                   |
                          httpsCallable()
                                   |
                  +----------------+----------------+
                  |                                 |
         +--------+---------+            +---------+----------+
         |  Cloud Functions |            |  Cloud Functions   |
         |  (onCall APIs)   |            |  (Triggers &       |
         |                  |            |   Schedulers)      |
         +--------+---------+            +---------+----------+
                  |                                |
      +-----------+-----------+         +----------+----------+
      |           |           |         |          |          |
+-----+--+ +-----+---+ +-----+---+ +---+---+ +----+----+ +---+------+
|Firestore| |  Cloud  | |  Auth   | | Cloud | | Gemini  | | Gemini   |
|  (NoSQL)| | Storage | |(Identity| | Tasks | | 3 Flash | | 2.5 Flash|
|         | |         | |Platform)| |       | |(Polling)| |(Enrich)  |
+---------+ +---------+ +---------+ +---+---+ +---------+ +----------+
                                        |
                                  +-----+------+
                                  |  Cloud Run |
                                  | (Puppeteer |
                                  |  Fetcher)  |
                                  +------------+

Frontend

Technology        | Version | Purpose                            
------------------+---------+------------------------------------
React             | 18      | UI library                         
TypeScript        | 5.9     | Type safety, strict mode           
Vite              | 7       | Build tool, dev server, HMR        
Material UI (MUI) | 7       | Component library                  
Zustand           | 5       | Global state management            
React Router      | 7       | Client-side routing                
Zod               | 3       | Schema validation                  
Emotion           | 11      | CSS-in-JS (MUI styling engine)     
Firebase SDK      | 12      | Auth, Firestore, callable functions

Custom dark theme (“YDIN Electric Dark”) with electric cyan accent. Nordic minimalism design language. Responsive layout with mobile-first bottom navigation.


Backend

Technology                    | Version | Purpose                                      
------------------------------+---------+----------------------------------------------
Node.js                       | 22      | Runtime                                      
Firebase Functions            | 7       | Serverless framework (onCall, onSchedule)    
Firebase Admin                | 13      | Server-side Firestore, Auth, Storage         
Google AI SDK (@google/genai) | 1.40+   | Gemini AI: structured output, text generation
Cloud Tasks                   | 5       | Async job queue for source polling           
jsdom                         | 28      | HTML parsing and DOM extraction              
unpdf                         | 1.4     | PDF text extraction                          
sharp                         | 0.33    | Image processing (resize, optimize)          
Resend                        | 6       | Transactional email / newsletters            

AI & Machine Learning

Two Gemini models used for different stages of the pipeline, chosen for cost/capability trade-offs. All calls via Google AI SDK (@google/genai).

Model                  | Use Case                        | Why                                       
-----------------------+---------------------------------+-------------------------------------------
Gemini 3 Flash Preview | Source polling, config analysis | Extended thinking + structured JSON output
Gemini 2.5 Flash       | Text extraction, enrichment     | Cost-effective, fast, JSON schema support 

Infrastructure (Google Cloud)

Service            | Purpose                                        
-------------------+------------------------------------------------
Firebase Hosting   | CDN-backed static site serving (SPA)           
Cloud Functions    | Serverless TypeScript backend (asia-southeast1)
Firestore          | NoSQL document database with real-time sync    
Cloud Storage      | Article text (Bronze layer), org images        
Identity Platform  | Email/password authentication (invite-only)    
Cloud Tasks        | Distributed job queue for polling pipeline     
Cloud Run          | Containerized Puppeteer for JS-heavy sites     
Pub/Sub            | Event messaging (scheduler triggers)           
Google AI (Gemini) | AI text generation and content processing      

Database Design (Firestore)

NoSQL document model. Public collections are read-accessible without authentication. All writes restricted to Cloud Functions (server-side only).

Collection       | Records                          | Access       
-----------------+----------------------------------+--------------
newsItems        | News articles with AI enrichment | Public read  
sources          | RSS/HTML feed configurations     | Public read  
organizations    | Energy companies and regulators  | Public read  
users            | Registered users (invite-only)   | Auth required
userSettings     | Per-user preferences             | Owner only   
searchRuns       | AI search execution history      | Admin only   
pollingSummaries | Operational polling data         | Admin only   

Security Model

  • Authentication via Firebase Identity Platform (email/password, invite-only)
  • Firestore Security Rules enforce read/write access per collection
  • All data mutations through Cloud Functions only (no direct client writes)
  • Secrets managed via Firebase defineSecret() — never in code
  • Service account authentication for Cloud Tasks and Cloud Run
  • HTTPS enforced everywhere (Firebase Hosting, Cloud Functions, Cloud Run)