All-in-One
Private repositoryFull-stack serverless microservices personal web platform (Next.js · NestJS · AWS · Cloudflare), run in production for ~$0.02/month.
A full-stack, serverless microservices personal web platform that I designed, built, and run in production for near-zero cost (~$0.02/month). It bundles several small products into a single codebase: a portfolio, an English-learning toolkit, a resource/blog manager, an AI stock & gold analysis dashboard, and a codebase-understanding RAG engine (my graduation project).
🌐 Live demo: https://all-in-one-cpp.pages.dev — the portfolio home page is viewable without logging in.
This is my playground for practicing a real product end-to-end: from UI/UX design, building the backend, provisioning infrastructure as code, CI/CD, all the way to cost optimization and security. Each feature solves a concrete problem and demonstrates a distinct skill set.
| Technology | What it's used for |
|---|---|
Next.js 14 (App Router, output: export) | Fully statically exported SPA → free CDN hosting, no SSR server required |
| TypeScript (strict) | Type safety across the entire frontend |
| Tailwind CSS v3 | Utility-first design system with custom design tokens in globals.css |
| Framer Motion v12 | Smooth animation/transitions (weather banner, landing, feature map) |
| Axios | API calls with JWT cookie (withCredentials) |
| lucide-react | Icon set |
| Technology | What it's used for |
|---|---|
| NestJS on AWS Lambda | 6 independent microservices, one Lambda each (pnpm packaging, symlinks kept) |
| DynamoDB | Serverless NoSQL database (single-digit ms, 25GB free tier) |
| JWT (access + refresh) | Authentication; SameSite=None; Secure cookie for cross-site Pages ↔ API |
| AWS SES | Sends study-reminder emails |
| AWS EventBridge | Cron for periodic jobs (scraping, reminders) |
| Technology | What it's used for |
|---|---|
| Cloudflare Pages | Hosts the static frontend, auto-deploys on push to main (free, zero egress) |
| Cloudflare R2 | File storage (images, PDFs, audio) — S3-compatible, zero egress fees |
| AWS API Gateway (HTTP API) | A single URL that path-routes to all 6 Lambdas |
| Terraform | All infrastructure as code (Lambda, DynamoDB, API GW, SES, EventBridge, Budget) |
| GitHub Actions | CI (lint/test/build per changed unit) + CD (terraform apply + Lambda deploy) |
| AWS Budget + IAM | Cost hard-stop: auto-attaches a Deny policy when the budget threshold is hit |
| Docker Compose | Local environment (DynamoDB Local + LocalStack S3 + MailHog) |
| Cloudflare Workers AI | bge-m3 embeddings + open-source LLM for the CodeMind RAG (no paid API dependency) |
💰 Deliberate cost optimization: the serverless architecture + Cloudflare free tier keep the real cost at ~$0.02/month, with an AWS Budget ($1/month) and an automatic hard-stop that blocks any overrun.
The home page / is viewable without logging in: hero, about-me, certificates (lightbox), GitHub projects (responsive grid), and a login CTA.
- The intro text comes from
profile.bio— the owner edits it in the dashboard and the public page syncs automatically. - A real-time weather theme (OpenWeatherMap, HCMC time): 5 conditions × 6 time-of-day periods = 30 gradients; the banner renders rain/fog/clouds/thunder/stars effects with SVG + Framer Motion.
- The landing uses one continuous dark canvas + an "aurora" transition zone for seamless section handoff.
- Study schedule by TOEIC/IELTS, per skill.
- Generate tests from PDF: upload a PDF → extract text → build an exam; upload audio (MP3/WAV) for listening sections.
- Vocabulary flashcards using the SM-2 spaced-repetition algorithm.
- Reminder emails sent automatically via SES + EventBridge.
The /topics area holds resource files + blog posts; each topic is public/private. Files upload to R2 via presigned URLs. Real-world problems handled along the way: SPA fallback for dynamic routes on a static export (Cloudflare Pages), and UTF-8 charset for Vietnamese files.
The /stocks dashboard analyzes QNS, VIC (VN equities), GOLD (XAU/USD), and SJC (domestic gold):
- A pure Node pipeline driven by Claude Code Routine (no extra infrastructure): keyless price fetching, technical indicators (SMA, Bollinger, RSI), and a ledger + self-scoring of predictions.
- Interactive SVG charts (crosshair tooltip, progressive line drawing) and an investment-simulation profit/loss panel.
- The full dataset (
ledger.json) is being collected to train an offline ML model in Phase 2.
The /codemind engine indexes this very repo and answers questions about it:
- A feature map in the style of Runeterra/LoL: each capability is a "region", routes = dependencies; clicking opens a function-to-function relationship map by role (zoom/pan/pin).
- Two-mode RAG Q&A (general user / developer), with hybrid retrieval BM25 + semantic embeddings (RRF) + feature routing (top-1: 35% → 80%).
- A Cross-Modal Bridge linking docs ↔ code + stale-documentation (drift) detection.
- No dependency on commercial LLM APIs — embeddings/generation run on open-source models via Cloudflare Workers AI (zero-cost) or local Ollama.
_(The job-search feature — job-scraper — is hidden from the UI because the scrape sources are blocked; the backend remains intact.)_
┌─────────────────────────────┐
Cloudflare Pages │ Next.js 14 (static export) │
(CDN, free) │ Portfolio · English · │
│ Topics · Stocks · CodeMind │
└──────────────┬───────────────┘
│ HTTPS + JWT cookie
┌──────────────▼───────────────┐
AWS API Gateway │ HTTP API (1 URL, path-route) │
└──────────────┬───────────────┘
┌──────────────────────────┼──────────────────────────┐
▼ ▼ ▼ ▼ ▼
auth-service profile-svc english-svc topics-svc notification-svc
(Lambda) (Lambda) (Lambda) (Lambda) (Lambda) + job-scraper
└──────────────┬──────────────┬──────────────┬───────────┘
▼ ▼ ▼
DynamoDB Cloudflare R2 AWS SES
(NoSQL) (file storage) (email) ◄── EventBridge cron- Frontend: Cloudflare Pages (
output: 'export', no SSR). - Backend: 6 NestJS Lambdas — auth, profile, english, topics, notification, job-scraper.
- Storage: DynamoDB (data) + Cloudflare R2 (files, zero egress).
- No Lambda Function URLs (blocked by an SCP) → routing goes through API Gateway.
Details: PROJECT_CONTEXT.md · doc/architecture.md · doc/deployment.md.
All-in-One/
├── frontend/ # Next.js 14 App Router (public + private routes)
├── services/ # 6 NestJS microservices (each deploys to 1 Lambda)
│ ├── auth-service/ # JWT auth (no signup, seeded admins)
│ ├── profile-service/ # Portfolio, certificates, GitHub repos
│ ├── english-service/ # Schedule, PDF→tests, SM-2 vocabulary
│ ├── topics-service/ # Resource files + blog (R2 presigned)
│ ├── notification-service/ # Reminder emails (SES)
│ └── job-scraper-service/ # Job scraping (hidden from UI)
├── shared/ # Shared types & constants
├── infrastructure/ # Terraform IaC (all AWS resources)
├── stock-analysis/ # Stock/gold analysis pipeline (Claude Routine)
├── codemind/ # RAG indexing pipeline + Cloudflare Worker
├── doc/ # Detailed per-feature documentation
└── docker-compose.yml # Local dev (DynamoDB + LocalStack + MailHog)- Full-stack TypeScript — Next.js (App Router, static export) + NestJS.
- Serverless & microservices architecture — service separation, API Gateway, Lambda packaging.
- Infrastructure as Code — fully modularized AWS infrastructure with Terraform.
- CI/CD — GitHub Actions running test/build per changed unit, automated deploys, secret scanning.
- Cloud cost optimization — near-$0 architecture + Budget hard-stop.
- Security — cross-site JWT, CORS with credentials, prompt-injection guard for the RAG, no committed secrets.
- Applied AI/ML — RAG (BM25 + vector + rerank), open-source embeddings, time-series analysis.
- Frontend craft — SVG animation, dynamic weather theme, anti-slop design system.
- Testing — ~465 tests (Jest backend, Vitest frontend,
node --testfor pipelines).
# Requirements: Node 20+, pnpm 9+, Docker, AWS CLI v2, Terraform 1.7+
pnpm install
docker-compose up -d # DynamoDB Local + LocalStack S3 + MailHog
pnpm dev # Frontend at http://localhost:3000# Checks before pushing
cd frontend && npx tsc --noEmit && pnpm build
pnpm -r run test # backend/shared (Jest)
cd frontend && npx vitest run # frontend (Vitest)| Topic | File |
|---|---|
| Overall architecture | doc/architecture.md |
| Deployment | doc/deployment.md |
| Home / landing page | doc/landing.md |
| Topics | doc/topics.md |
| Stock analysis | doc/stock-analysis.md |
| CodeMind (RAG) | doc/codemind.md |
| English learning | doc/english.md |
| Testing | doc/testing.md |
_Built end-to-end with Next.js · NestJS · AWS Serverless · Cloudflare — by Nguyễn Phúc Thọ._