Skip to content

hammayo/hammayo.github.io

Repository files navigation

Build Version Updated

Hammayo

A modern, responsive portfolio website built with Next.js, TypeScript, and Tailwind CSS.

https://hammayo.github.io/

Features

  • πŸš€ Built with Next.js 15
  • πŸ” SEO optimized
  • πŸ“± Fully responsive
  • 🎨 Dark and light mode
  • πŸ’¨ Fast and lightweight
  • ⚑ Server-side rendering
  • 🧠 Type-safe with TypeScript
  • πŸ› οΈ Error boundary for graceful error handling
  • πŸ“Š Centralized environment variable management
  • πŸ”„ Clean code architecture
  • πŸ“ Comprehensive documentation

πŸš€ Getting Started

Prerequisites

  • Git
  • Node.js 18+
  • npm, yarn, or bun

Installation

  1. Clone the repository:
git clone https://github.com/hammayo/hammayo.github.io.git
cd hammayo.github.io
  1. Install dependencies:
# Using npm
npm install

# Using yarn
yarn install

# Using bun
bun install
  1. Set up environment variables:
  • Copy .env.local.example to .env.local
  • Fill in the necessary environment variables

Development

Start the development server:

# Using npm
npm run dev

# Using yarn
yarn dev

# Using bun
bun dev

Open http://localhost:3000 in your browser to see the application.

Building for Production

Build the application for production:

# Using npm
npx serve build     
npm run build

# Using yarn
yarn build

# Using bun
bun run build

Running in Production

Start the production server:

# Using npm
npm run start

# Using yarn
yarn start

# Using bun
bun start

πŸ› οΈ Deployment

GitHub Pages

The project is configured for easy deployment to GitHub Pages using GitHub Actions. Simply push to the main branch to trigger a deployment.

Vercel

For deployment to Vercel, connect your GitHub repository to Vercel for automatic deployment.

πŸ“‚ Project Structure

hammayo.github.io/
β”œβ”€β”€ .github/           # GitHub Actions workflows
β”œβ”€β”€ .vscode/           # VS Code configuration
β”‚   └── launch.json    # Debugging configuration
β”œβ”€β”€ public/            # Static assets
β”‚   β”œβ”€β”€ icons/         # Favicon and app icons
β”‚   └── screenshots/   # README screenshots
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/           # Next.js App Router
β”‚   β”‚   β”œβ”€β”€ contact/   # Contact page
β”‚   β”‚   β”œβ”€β”€ projects/  # Projects page
β”‚   β”‚   β”œβ”€β”€ layout.tsx # Root layout
β”‚   β”‚   └── page.tsx   # Home page
β”‚   β”œβ”€β”€ components/    # React components
β”‚   β”‚   β”œβ”€β”€ ui/        # UI components
β”‚   β”‚   └── project-card.tsx  # Project specific components
β”‚   β”œβ”€β”€ lib/           # Utilities
β”‚   β”‚   β”œβ”€β”€ constants.ts # App constants
β”‚   β”‚   β”œβ”€β”€ env.ts     # Environment variables
β”‚   β”‚   β”œβ”€β”€ github.ts  # GitHub API client
β”‚   β”‚   β”œβ”€β”€ logger.ts  # Logging utility
β”‚   β”‚   └── utils.ts   # Utility functions
β”‚   └── providers/     # React context providers
β”œβ”€β”€ .env.local         # Local environment variables
β”œβ”€β”€ .eslintrc.js      # ESLint configuration
β”œβ”€β”€ .eslintrc.json    # Additional ESLint rules
β”œβ”€β”€ bun.lock          # Bun lock file
β”œβ”€β”€ components.json   # shadcn/ui configuration
β”œβ”€β”€ netlify.toml     # Netlify configuration
β”œβ”€β”€ next.config.ts   # Next.js configuration
β”œβ”€β”€ package.json     # Project dependencies
β”œβ”€β”€ postcss.config.mjs # PostCSS configuration
β”œβ”€β”€ tailwind.config.ts # Tailwind CSS configuration
└── tsconfig.json    # TypeScript configuration

πŸ”§ Configuration

Environment Variables

The application uses type-safe environment variables with Zod validation. Create a .env.local file with the following variables:

# Next.js
NODE_ENV=development
NEXT_PUBLIC_BASE_PATH=

# GitHub (for GitHub Pages deployment)
GITHUB_ACTIONS=
GITHUB_REPOSITORY=

# Analytics (optional)
GA_MEASUREMENT_ID=G-xxxxxxxx

Environment variables are managed in src/lib/env.ts with runtime validation:

const envSchema = z.object({
  // Next.js specific
  NODE_ENV: z.enum(["development", "production", "test"])
    .optional()
    .default("development"),
  
  // GitHub specific
  GITHUB_ACTIONS: z.string().optional(),
  GITHUB_REPOSITORY: z.string().optional(),
  
  // Analytics
  GA_MEASUREMENT_ID: z.string().optional(),
});

NOTE: For GitHub Actions deployment, the following environment variables are automatically set in .github/workflows/deploy.yml:

env:
  NODE_ENV: production
  NEXT_PUBLIC_BASE_PATH: ${{ github.event.repository.name }}

Base Path Configuration

The application automatically configures base paths for different environments:

  • Development: No base path
  • GitHub Pages: Uses repository name as base path
  • Production: Configurable via environment variables

Base path logic is handled in src/lib/env.ts:

export const isGithubActions = Boolean(env.GITHUB_ACTIONS);
export const repo = env.GITHUB_REPOSITORY?.replace(/.*?\//, '') || '';
export const basePath = isGithubActions ? `/${repo}` : '';
export const assetPrefix = isGithubActions ? `/${repo}/` : '';

Configuration Files

  • next.config.ts: Next.js configuration including image optimization and base path settings
  • tailwind.config.ts: Tailwind CSS theme and plugin configuration
  • components.json: shadcn/ui component configuration
  • tsconfig.json: TypeScript compiler options
  • postcss.config.mjs: PostCSS plugins configuration
  • eslintrc.js: ESLint rules and TypeScript integration
  • netlify.toml: Netlify deployment configuration

Constants

Application-wide constants are centralized in src/lib/constants.ts:

export const SITE = {
  name: "Hammayo's Portfolio",
  title: "Hammayo's | Backend Software Engineer",
  description: "Portfolio site showcasing dev projects.",
  // ...
};

export const SOCIAL = {
  github: "https://github.com/hammayo",
  linkedin: "https://linkedin.com/in/hammayo",
  email: "[email protected]",
};

export const THEME = {
  defaultTheme: "dark",
  lightThemeColor: "#ffffff",
  darkThemeColor: "#000000",
};

πŸ”§ Best Practices

  • Type Safety: Comprehensive TypeScript usage for type safety
  • Environment Variable Management: Centralized environment variable management with runtime validation
  • Error Handling: Comprehensive error boundary implementation
  • Logging: Structured logging system
  • Code Organization: Clear separation of concerns
  • Configuration Management: Centralized constants and configuration
  • Responsive Design: Mobile-first approach with Tailwind CSS
  • SEO Optimization: Metadata and semantic HTML
  • Performance Optimization: Efficient bundle size and loading strategies
  • Accessibility: ARIA attributes and semantic HTML

Personal Information

Edit the following files to customize portfolio:

  1. Home Page: /src/app/page.tsx - Update introduction and hero section
  2. Projects: GitHub repositories are automatically fetched and displayed
  3. Contact Information: /src/app/contact/page.tsx - Update contact details
  4. Header Links: /src/components/header.tsx - Modify navigation links

Styling

  • Colors: Edit the gradient colors in /src/app/globals.css
  • Theme: Modify the theme variables in /src/app/globals.css
  • Typography: Change the font in /src/app/layout.tsx

πŸ“· Screenshots

Home Page

Dark/Light Mode

Acknowledgements

About

The codebase used for my personal site showcasing my projects.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •