portfolio_sveltekit Svelte Themes

Portfolio_sveltekit

A modern, performant portfolio website showcasing data engineering expertise, built with SvelteKit and deployed on Cloudflare Pages with Server-Side Rendering (SSR).

šŸš€ Krishnanand Anil - Senior Data Engineer Portfolio

A modern, performant portfolio website showcasing data engineering expertise, built with SvelteKit and deployed on Cloudflare Pages with Server-Side Rendering (SSR).

Live Site: https://krishnanandanil.com


✨ Features

  • šŸŒ™ Dark Mode First - Default dark theme with seamless toggle
  • ⚔ Server-Side Rendering - Optimized for SEO and performance
  • šŸ“± Mobile-First Design - iOS/Material UI inspired aesthetics
  • šŸŽÆ Real-time GitHub Integration - Dynamic project fetching via GitHub API
  • šŸ” SEO Optimized - Rich snippets, structured data, sitemap
  • šŸš€ Edge Deployment - Cloudflare Pages with global CDN
  • šŸ’Ø Lightning Fast - Prerendered static pages for instant loads
  • šŸ“Š Performance Metrics - Live GitHub stats and project analytics
  • šŸŽØ Modern UI - Tailwind CSS 4 with custom components
  • šŸ”’ Type-Safe - Full TypeScript implementation

šŸ› ļø Tech Stack

Core

Deployment & Hosting

  • Platform: Cloudflare Pages
  • Adapter: @sveltejs/adapter-cloudflare
  • Runtime: Cloudflare Workers (Edge Functions)
  • CDN: Global edge network

APIs & Integrations

  • GitHub API - Dynamic project and stats fetching
  • Environment: Cloudflare environment variables

šŸ“ Project Structure

my-portfolio/
ā”œā”€ā”€ src/
│   ā”œā”€ā”€ lib/
│   │   ā”œā”€ā”€ components/
│   │   │   ā”œā”€ā”€ home/              # Homepage components
│   │   │   │   ā”œā”€ā”€ HeroSection.svelte
│   │   │   │   ā”œā”€ā”€ MetricsGrid.svelte
│   │   │   │   ā”œā”€ā”€ FeaturedProjects.svelte
│   │   │   │   ā”œā”€ā”€ ProjectFilter.svelte
│   │   │   │   ā”œā”€ā”€ TechStack.svelte
│   │   │   │   └── ContactCTA.svelte
│   │   │   ā”œā”€ā”€ ui/                # Reusable UI components
│   │   │   ā”œā”€ā”€ SEO.svelte
│   │   │   ā”œā”€ā”€ StructuredData.svelte
│   │   │   └── ThemeToggle.svelte
│   │   ā”œā”€ā”€ stores/
│   │   │   └── theme.ts           # Theme management
│   │   └── data/
│   │       └── portfolio-data.ts  # Personal data configuration
│   ā”œā”€ā”€ routes/
│   │   ā”œā”€ā”€ +page.svelte           # Homepage (prerendered)
│   │   ā”œā”€ā”€ +page.ts               # Page load function
│   │   ā”œā”€ā”€ +layout.svelte         # Root layout with SEO
│   │   ā”œā”€ā”€ api/
│   │   │   └── github/
│   │   │       ā”œā”€ā”€ projects/+server.ts  # SSR API
│   │   │       └── stats/+server.ts     # SSR API
│   │   └── sitemap.xml/
│   │       └── +server.ts         # Dynamic sitemap (prerendered)
│   ā”œā”€ā”€ app.html                   # HTML template
│   ā”œā”€ā”€ app.css                    # Global styles
│   └── app.d.ts                   # TypeScript definitions
ā”œā”€ā”€ static/
│   ā”œā”€ā”€ favicon.png                # 192x192 favicon
│   ā”œā”€ā”€ apple-icon.png             # 180x180 Apple touch icon
│   ā”œā”€ā”€ manifest.json              # PWA manifest
│   ā”œā”€ā”€ robots.txt                 # SEO robots file
│   ā”œā”€ā”€ humans.txt                 # Credits file
│   ā”œā”€ā”€ llms.txt                   # LLM context file
│   └── screenshots/               # PWA screenshots
ā”œā”€ā”€ svelte.config.js               # SvelteKit configuration
ā”œā”€ā”€ tailwind.config.js             # Tailwind configuration
ā”œā”€ā”€ tsconfig.json                  # TypeScript configuration
ā”œā”€ā”€ vite.config.ts                 # Vite configuration
└── package.json

šŸš€ Getting Started

Prerequisites

  • Node.js 20+ (LTS)
  • npm or pnpm
  • Git
  • Cloudflare Account (for deployment)
  • GitHub Personal Access Token (for API integration)

Installation

  1. Clone the repository:

    git clone https://github.com/sudo-krish/my-portfolio.git
    cd my-portfolio
    
  2. Install dependencies:

    npm install
    
  3. Create environment file:

    cp .env.example .env
    
  4. Configure .env:

    VITE_GITHUB_TOKEN=ghp_your_github_personal_access_token_here
    PUBLIC_SITE_URL=https://krishnanandanil.com
    

    Get GitHub Token: GitHub Settings → Developer Settings → Personal Access Tokens

  5. Update personal data:

    // Edit src/lib/data/portfolio-data.ts
    export const portfolioData = {
      personal: {
        name: 'Your Name',
        title: 'Your Title',
        // ... update all fields
      }
    }
    

Development

# Start dev server
npm run dev

# Open in browser
# http://localhost:5173

Build

# Build for production
npm run build

# Preview production build
npm run preview

🌐 Deployment to Cloudflare Pages

Option 1: Manual Deployment (CLI)

  1. Install Wrangler:

    npm install -g wrangler
    
  2. Login to Cloudflare:

    wrangler login
    
  3. Build the project:

    npm run build
    
  4. Deploy:

    wrangler pages deploy .svelte-kit/cloudflare --project-name krishnanandanil-portfolio
    
  5. Set environment variable:

    wrangler pages secret put GITHUB_TOKEN --project-name krishnanandanil-portfolio
    # Paste your GitHub token when prompted
    

Option 2: Automatic Deployment (Git)

  1. Push to GitHub:

    git add .
    git commit -m "Initial commit"
    git push origin main
    
  2. Connect to Cloudflare Pages:

    • Go to Cloudflare Dashboard
    • Click Workers & Pages → Create Application → Pages
    • Connect to Git and select your repository
  3. Configure Build Settings:

    Framework preset: SvelteKit
    Build command: npm run build
    Build output directory: .svelte-kit/cloudflare
    Root directory: /
    
  4. Add Environment Variables:

    • Go to Settings → Environment Variables
    • Add GITHUB_TOKEN (encrypted)
    • Click Save and Deploy
  5. Custom Domain (Optional):

    • Go to Custom domains → Set up a custom domain
    • Add krishnanandanil.com
    • DNS will be configured automatically

šŸ”§ Configuration

SvelteKit Configuration

// svelte.config.js
import adapter from '@sveltejs/adapter-cloudflare';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

const config = {
  preprocess: vitePreprocess(),
  kit: {
    adapter: adapter(),
    prerender: {
      entries: ['/', '/sitemap.xml'],
      crawl: false,
      handleHttpError: ({ path, message }) => {
        if (path.startsWith('/api/')) return;
        console.warn(`Prerender warning: ${path} - ${message}`);
      },
      origin: 'https://krishnanandanil.com'
    }
  }
};

export default config;

Environment Variables

Local Development (.env):

VITE_GITHUB_TOKEN=ghp_xxxxx
PUBLIC_SITE_URL=https://krishnanandanil.com

Production (Cloudflare Dashboard):

GITHUB_TOKEN=ghp_xxxxx  (Encrypted)

Cloudflare Platform Types

// src/app.d.ts
declare global {
  namespace App {
    interface Platform {
      env?: {
        GITHUB_TOKEN?: string;
      };
    }
  }
}

export {};

šŸ“Š API Routes

GitHub Projects API

Endpoint: /api/github/projects

  • Method: GET
  • Cache: 30 minutes server-side
  • Response: JSON array of GitHub repositories
  • Authentication: GitHub Personal Access Token

GitHub Stats API

Endpoint: /api/github/stats

  • Method: GET
  • Cache: 30 minutes server-side
  • Response: Aggregated GitHub statistics
  • Authentication: GitHub Personal Access Token

šŸŽØ Customization

Theme Configuration

// src/lib/stores/theme.ts
// Default: Dark mode
// Toggle: Light/Dark with localStorage persistence

Colors (Tailwind)

// tailwind.config.js
theme: {
  extend: {
    colors: {
      border: 'hsl(var(--border))',
      background: 'hsl(var(--background))',
      foreground: 'hsl(var(--foreground))',
      primary: 'hsl(var(--primary))',
      // ... customize as needed
    }
  }
}

Portfolio Data

// src/lib/data/portfolio-data.ts
export const portfolioData = {
  personal: { /* ... */ },
  experience: [ /* ... */ ],
  projects: [ /* ... */ ],
  skills: [ /* ... */ ],
  certifications: [ /* ... */ ]
};

šŸ” SEO Features

  • āœ… Prerendered Static HTML - Instant indexing
  • āœ… Structured Data (JSON-LD) - Rich snippets
  • āœ… Dynamic Sitemap - Auto-generated
  • āœ… Robots.txt - Crawler configuration
  • āœ… Canonical URLs - Duplicate content prevention
  • āœ… Open Graph Tags - Social media previews
  • āœ… Twitter Cards - Enhanced Twitter sharing
  • āœ… Meta Descriptions - Page-specific descriptions
  • āœ… Semantic HTML - Accessibility compliance

⚔ Performance

  • Lighthouse Score: 95+ Performance, 100 SEO
  • First Contentful Paint: < 1s
  • Time to Interactive: < 2s
  • Total Bundle Size: ~200KB (compressed)
  • CDN: Global edge caching via Cloudflare

šŸ“ Scripts

# Development
npm run dev              # Start dev server
npm run build            # Build for production
npm run preview          # Preview production build
npm run check            # Type checking
npm run check:watch      # Type checking (watch mode)
npm run lint             # Lint code

# Deployment
wrangler login           # Login to Cloudflare
wrangler pages deploy .svelte-kit/cloudflare --project-name krishnanandanil-portfolio

šŸ› Troubleshooting

Build Errors

Issue: Property 'env' does not exist on type 'Platform'

  • Fix: Ensure src/app.d.ts has proper type definitions

Issue: GitHub API rate limits

  • Fix: Add GITHUB_TOKEN environment variable

Deployment Issues

Issue: 404 on API routes

  • Fix: Verify adapter-cloudflare is installed and configured

Issue: Environment variables not working

  • Fix: Use platform?.env?.GITHUB_TOKEN in API routes

šŸ“„ License

MIT License - feel free to use this for your own portfolio!


šŸ‘¤ Author

Krishnanand Anil


šŸ™ Acknowledgments


šŸ“® Contact

For inquiries or collaboration opportunities, reach out via:


Made with ā¤ļø using SvelteKit and Cloudflare Pages

⬆ Back to Top

```

Save this as README.md in your project root. It covers everything about your portfolio including setup, deployment, configuration, and troubleshooting! šŸ“šāœØ

Top categories

Loading Svelte Themes