Skip to content

Latest commit

Β 

History

History
360 lines (300 loc) Β· 10.7 KB

File metadata and controls

360 lines (300 loc) Β· 10.7 KB

WillCap.io - Project Overview

πŸ“‹ Summary

A personal blog website migrated from Gatsby v2 to a modern Next.js 14+ and FastAPI architecture. The application features blog posts with markdown content, tag-based filtering, and responsive design, optimized for deployment on Vercel.

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Vercel                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   Next.js        │◄──►│    FastAPI       β”‚  β”‚
β”‚  β”‚   Frontend       β”‚    β”‚    Backend       β”‚  β”‚
β”‚  β”‚                  β”‚    β”‚                  β”‚  β”‚
β”‚  β”‚  - React Pages   β”‚    β”‚  - REST API      β”‚  β”‚
β”‚  β”‚  - Components    β”‚    β”‚  - Markdown      β”‚  β”‚
β”‚  β”‚  - Styling       β”‚    β”‚  - Images        β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚          β”‚                         β”‚            β”‚
β”‚          β”‚                         β”‚            β”‚
β”‚          β–Ό                         β–Ό            β”‚
β”‚    Static Assets            Blog Content        β”‚
β”‚    (images, logos)          (markdown files)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🎯 Key Features

Content Management

  • βœ… Markdown-based blog posts with frontmatter
  • βœ… Image support within posts
  • βœ… Tag-based categorization
  • βœ… Post excerpts and summaries

User Experience

  • βœ… Fast page loads with SSG
  • βœ… Responsive mobile-first design
  • βœ… Smooth navigation
  • βœ… Clean, modern UI

Developer Experience

  • βœ… TypeScript for type safety
  • βœ… Hot reload in development
  • βœ… API documentation (FastAPI Swagger)
  • βœ… Easy content updates

SEO & Performance

  • βœ… Static site generation
  • βœ… Incremental static regeneration
  • βœ… Image optimization
  • βœ… Metadata and Open Graph tags

πŸ“ Project Structure

willcapio-old/
β”‚
β”œβ”€β”€ frontend/                       # Next.js Application
β”‚   β”œβ”€β”€ app/                        # App Router
β”‚   β”‚   β”œβ”€β”€ layout.tsx              # Root layout with nav/footer
β”‚   β”‚   β”œβ”€β”€ page.tsx                # Homepage (blog listing)
β”‚   β”‚   β”œβ”€β”€ page.module.css
β”‚   β”‚   β”œβ”€β”€ globals.css             # Global styles
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ blog/
β”‚   β”‚   β”‚   └── [slug]/
β”‚   β”‚   β”‚       β”œβ”€β”€ page.tsx        # Individual blog post
β”‚   β”‚   β”‚       └── page.module.css
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ tags/
β”‚   β”‚   β”‚   β”œβ”€β”€ page.tsx            # All tags listing
β”‚   β”‚   β”‚   β”œβ”€β”€ page.module.css
β”‚   β”‚   β”‚   └── [tag]/
β”‚   β”‚   β”‚       └── page.tsx        # Posts by tag
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ about/
β”‚   β”‚   β”‚   β”œβ”€β”€ page.tsx
β”‚   β”‚   β”‚   └── page.module.css
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ code/
β”‚   β”‚   β”‚   β”œβ”€β”€ page.tsx
β”‚   β”‚   β”‚   └── page.module.css
β”‚   β”‚   β”‚
β”‚   β”‚   └── whereiswill/
β”‚   β”‚       β”œβ”€β”€ page.tsx
β”‚   β”‚       └── page.module.css
β”‚   β”‚
β”‚   β”œβ”€β”€ components/                 # React Components
β”‚   β”‚   β”œβ”€β”€ NavBar.tsx              # Sticky navigation
β”‚   β”‚   β”œβ”€β”€ NavBar.module.css
β”‚   β”‚   β”œβ”€β”€ Footer.tsx              # Footer
β”‚   β”‚   β”œβ”€β”€ Footer.module.css
β”‚   β”‚   β”œβ”€β”€ Header.tsx              # Page headers
β”‚   β”‚   β”œβ”€β”€ Header.module.css
β”‚   β”‚   β”œβ”€β”€ PostList.tsx            # Blog post card
β”‚   β”‚   β”œβ”€β”€ PostList.module.css
β”‚   β”‚   β”œβ”€β”€ TagsBlock.tsx           # Tag display
β”‚   β”‚   └── TagsBlock.module.css
β”‚   β”‚
β”‚   β”œβ”€β”€ lib/                        # Utilities
β”‚   β”‚   β”œβ”€β”€ api.ts                  # API client functions
β”‚   β”‚   └── theme.ts                # Theme configuration
β”‚   β”‚
β”‚   β”œβ”€β”€ public/                     # Static assets
β”‚   β”‚   β”œβ”€β”€ logo/                   # Logos and favicons
β”‚   β”‚   └── robots.txt
β”‚   β”‚
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ tsconfig.json
β”‚   β”œβ”€β”€ next.config.ts
β”‚   β”œβ”€β”€ .env.local                  # Environment variables
β”‚   └── .env.example
β”‚
β”œβ”€β”€ backend/                        # FastAPI Application
β”‚   β”œβ”€β”€ main.py                     # API server
β”‚   β”œβ”€β”€ requirements.txt            # Python dependencies
β”‚   β”‚
β”‚   └── content/                    # Blog content
β”‚       └── posts/
β”‚           β”œβ”€β”€ 2018-10-08/
β”‚           β”‚   β”œβ”€β”€ index.md        # Post content
β”‚           β”‚   └── *.jpg           # Post images
β”‚           β”œβ”€β”€ 2018-10-09/
β”‚           └── .../
β”‚
β”œβ”€β”€ vercel.json                     # Vercel deployment config
β”‚
β”œβ”€β”€ start-dev.sh                    # Dev startup script
β”œβ”€β”€ test-api.sh                     # API test script
β”‚
β”œβ”€β”€ README-MIGRATION.md             # Migration documentation
β”œβ”€β”€ DEPLOYMENT.md                   # Deployment guide
β”œβ”€β”€ MIGRATION-SUMMARY.md            # What was changed
β”œβ”€β”€ QUICK-START.md                  # Quick start guide
└── PROJECT-OVERVIEW.md             # This file

πŸ”Œ API Endpoints

Backend (FastAPI)

Endpoint Method Description
/ GET API info
/api/posts GET List all blog posts
/api/posts/{slug} GET Get single post by slug
/api/tags GET Get all unique tags
/api/posts/tag/{tag} GET Get posts by tag
/api/site-config GET Get site configuration
/images/{slug}/{filename} GET Serve post images
/docs GET API documentation (Swagger)

Frontend Pages

Route Description
/ Homepage with blog post listing
/blog/{slug} Individual blog post
/tags All tags listing
/tags/{tag} Posts filtered by tag
/about About page
/code Code projects page
/whereiswill Travel log page

πŸ› οΈ Technology Stack

Frontend

  • Framework: Next.js 14+ (App Router)
  • Language: TypeScript
  • Styling: CSS Modules
  • UI Library: React 18
  • Fonts: Google Fonts (Open Sans, Candal)
  • Image Optimization: Next.js Image component

Backend

  • Framework: FastAPI
  • Language: Python 3.x
  • Markdown: python-markdown
  • Frontmatter: python-frontmatter
  • Image Processing: Pillow
  • ASGI Server: Uvicorn

Deployment

  • Platform: Vercel
  • CDN: Vercel Edge Network
  • SSL: Automatic HTTPS

Development Tools

  • Package Manager: npm (frontend), pip (backend)
  • Linting: ESLint (frontend)
  • Type Checking: TypeScript
  • Version Control: Git

🎨 Design System

Colors

Primary Blue: #3498db
Dark Blue: #284187
Light Blue: #3e5fbc
Text: #333438
Light Text: #7f8184
Background: #fff

Typography

  • Headings: Candal (Google Font)
  • Body: Open Sans (Google Font)

Breakpoints

  • xs: 400px
  • s: 600px
  • m: 900px
  • l: 1200px

πŸ“ Content Format

Blog posts are markdown files with YAML frontmatter:

---
title: "Post Title"
date: "2024-12-19"
path: "/post-slug"
tags: ["tag1", "tag2"]
cover: "./cover-image.jpg"
published: true
---

Post content in markdown...

![Image](./image.jpg)

πŸš€ Quick Commands

# Development
./start-dev.sh                    # Start both servers
./test-api.sh                     # Test API

# Backend
cd backend
source venv/bin/activate
uvicorn main:app --reload         # Start API server

# Frontend
cd frontend
npm run dev                       # Start Next.js
npm run build                     # Build for production
npm run start                     # Run production build

# Deployment
vercel                            # Deploy to preview
vercel --prod                     # Deploy to production

πŸ“Š Performance

Expected metrics:

  • First Contentful Paint: < 1.5s
  • Time to Interactive: < 3.5s
  • Lighthouse Score: 90+
  • Bundle Size: Optimized with code splitting

πŸ” Environment Variables

Frontend (.env.local)

NEXT_PUBLIC_API_URL=http://localhost:8000

Production

NEXT_PUBLIC_API_URL=https://your-domain.vercel.app

πŸ“ˆ Scalability

The architecture supports:

  • βœ… Hundreds of blog posts
  • βœ… Multiple concurrent users
  • βœ… Global CDN distribution
  • βœ… Easy content updates
  • βœ… Future enhancements (comments, search, etc.)

πŸ”„ Development Workflow

  1. Content Updates: Edit markdown in backend/content/posts/
  2. Component Changes: Edit React components in frontend/components/
  3. Styling: Update CSS Modules
  4. API Changes: Modify backend/main.py
  5. Test Locally: Run both servers
  6. Deploy: Push to Git or use Vercel CLI

πŸŽ“ Learning Resources

πŸ“ž Support & Maintenance

Common Tasks

Add a new blog post:

mkdir backend/content/posts/YYYY-MM-DD
cd backend/content/posts/YYYY-MM-DD
# Create index.md with frontmatter
# Add images

Update styling:

# Edit component CSS modules in frontend/components/
# Or edit global styles in frontend/app/globals.css

Debug issues:

# Check backend logs
cd backend && source venv/bin/activate && uvicorn main:app --reload --log-level debug

# Check frontend logs
cd frontend && npm run dev

# Build locally
cd frontend && npm run build

🌟 Future Enhancements

Potential additions:

  • Search functionality
  • Comment system (Giscus/Utterances)
  • RSS feed
  • Newsletter integration
  • Dark mode
  • Reading time estimates
  • Related posts
  • Table of contents
  • Code syntax highlighting improvements
  • Analytics dashboard

πŸ“„ License

MIT


Author: Will Cap
Twitter: @thinkocapo
GitHub: thinkocapo
Website: WillCap.io