Aman Bagrecha’s Personal Website - Repository Context
This is a self-hosted Quarto-based personal website/blog with integrated services.
What This Repository Does
Primary Purpose: Personal website and blog for Aman Bagrecha (geospatial/remote sensing engineer) built with Quarto and hosted at https://amanbagrecha.com
Tech Stack: - Frontend: Quarto (static site generator) - builds to HTML/CSS/JS - Backend Services: - FastAPI (port 8000) - Photo search API with face recognition - Flask (port 8001) - Image mask labeler tool - Umami (port 8002) - Self-hosted privacy-friendly analytics - Web Server: Nginx (reverse proxy + static file serving) - Database: PostgreSQL (for Umami analytics)
Architecture
User → Nginx (443/80)
├─→ Static files: /root/work/amanbagrecha.github.io/docs/ (production)
├─→ Static files: /root/work/amanbagrecha.github.io/docs-staging/ (staging)
├─→ /api/* → FastAPI (localhost:8000) - photo search
├─→ /tools/mask-labeler/* → Flask (localhost:8001) - image labeler
└─→ /umami/* → Umami Analytics (localhost:8002)
Important Build System
CRITICAL: This site uses a three-tier deployment system:
- Local Preview -
quarto preview- Test locally at localhost:4848 - Staging -
./build-staging.shorquarto render --profile staging- Output:
docs-staging/ - URL: https://staging.amanbagrecha.com
- Drafts visible, orange “STAGING” banner
- Output:
- Production -
./build-production.shorquarto render --profile production- Output:
docs/ - URL: https://amanbagrecha.com
- Only published content, Umami tracking enabled
- Output:
Key Files: - _quarto.yml - Base configuration - _quarto-staging.yml - Staging overrides (docs-staging output, drafts visible) - _quarto-production.yml - Production overrides (docs output, Umami tracking) - _umami-tracking.html - Umami analytics script (production only)
Content Types
- Blog Posts -
posts/*/index.qmdorposts/*/index.md - Projects - Defined in
projects/gallery.yaml+ optional detail pages - Presentations -
presentations/*/index.md - Notebooks - Jupyter notebooks in
notebooks/*/ - Tools - Interactive tools (photo search, mask labeler)
- TIL (Today I Learned) -
til/*.md- Short tips
Critical Constraints
❌ NEVER Edit These Directories
docs/- Auto-generated production builddocs-staging/- Auto-generated staging build
These are OUTPUT directories generated by Quarto. Always edit source files (.qmd, .md) instead.
✓ Always Use Build Scripts
- Use
./build-staging.shfor staging - Use
./build-production.shfor production - These handle backups and proper configuration
✓ Virtual Environments
- FastAPI:
/root/work/photos-index-search/.venv/ - Flask:
/root/work/amanbagrecha.github.io/tools/brush-segmentation/.venv/ - Always activate venv before installing packages OR use
uv run
Services Management
Check service status:
sudo systemctl status photo-search-api # FastAPI photo search
sudo systemctl status image-mask-labeler # Flask image labeler
sudo systemctl status umami # Umami analytics
sudo systemctl status nginx # Web serverRestart after code changes:
sudo systemctl restart photo-search-api # After FastAPI changes
sudo systemctl restart image-mask-labeler # After Flask changes
sudo systemctl restart umami # After Umami changes
sudo systemctl reload nginx # After Nginx config changesKey Directories
/root/work/amanbagrecha.github.io/
├── posts/ # Blog posts (.qmd, .md)
├── projects/ # Project pages + gallery.yaml
├── presentations/ # Presentation content
├── notebooks/ # Jupyter notebooks
├── tools/ # Interactive tools
│ ├── photo-search.qmd # Photo search page
│ └── brush-segmentation/ # Flask app for mask labeler
├── _quarto*.yml # Quarto configurations
├── docs/ # ❌ GENERATED - Production output
├── docs-staging/ # ❌ GENERATED - Staging output
├── build-*.sh # Build helper scripts
└── .claude/ # Claude-specific files
Related repositories: - /root/work/photos-index-search/ - FastAPI photo search backend - /opt/umami/ - Umami analytics installation
Common Tasks
Add New Blog Post
- Create
posts/my-post/index.qmdwithdraft: true - Test locally:
quarto preview - Deploy to staging:
./build-staging.sh - When ready: Change
draft: falseand run./build-production.sh
Update Photo Search
- Edit
/root/work/photos-index-search/image_search_app/app.py - Restart:
sudo systemctl restart photo-search-api
Update Analytics Setup
See UMAMI.md for complete Umami reference
Environment-Specific Features
| Feature | Staging | Production |
|---|---|---|
| Output dir | docs-staging/ |
docs/ |
| Drafts | Visible in listings | Hidden (unlinked) |
| Umami tracking | Disabled | Enabled |
| Visual indicator | Orange banner | None |
| URL | staging.amanbagrecha.com | amanbagrecha.com |
Important Notes
- Content workflow: Always test on staging before production
- Backups: Production is auto-backed up before each build (kept last 3)
- Umami: Tracks production only, daily DB backups at 2 AM
- SSL: Auto-renewed by certbot for both staging and production
- Drafts: Use
draft: truein frontmatter to work on posts before publishing
Agent Deployment Instructions
When a user asks to “push and deploy to production”:
- Commit and push source changes to git first.
- Prefer pushing to
upstreamif that remote exists; otherwise push toorigin. - Run
./build-production.shfrom repo root to deploy prod. - If
docs/changes after render (tracked in this repo), commit and push those generated files. - Never manually edit files under
docs/ordocs-staging/; only update by Quarto render.
File Permissions
Nginx needs execute permission on directories to serve static files:
sudo chmod +x /root /root/work /root/work/amanbagrecha.github.io
sudo chmod -R +r /root/work/amanbagrecha.github.io/docsQuick Reference
Build commands: - quarto preview - Local dev server - ./build-staging.sh - Build staging - ./build-production.sh - Build production (with backup)
Logs: - FastAPI: sudo journalctl -u photo-search-api -f - Flask: sudo journalctl -u image-mask-labeler -f - Umami: sudo journalctl -u umami -f - Nginx: sudo tail -f /var/log/nginx/error.log
Repository Type: Personal website/blog Primary Tech: Quarto, FastAPI, Flask, Umami, Nginx Deployment: Self-hosted VPS with staging/production environments Last Updated: January 2026