Skip to content

AKzar1el/blog-starter-template

Repository files navigation

πŸš€ Your Professional Blog - Modern Blog Starter Template

GitHub stars GitHub forks GitHub issues License Last commit

Launch your professional blog in minutes, not days. A production-ready, SEO-optimized blog platform with rich content support, multimedia embedding, and powerful API.

🌐 Live Demo | πŸ“– Full API Docs | πŸ› Report Bug | ✨ Request Feature


πŸ“Έ Preview

Blog Template Preview


πŸ’‘ Why This Template?

Building a professional blog from scratch takes weeks of development time. Your Professional Blog gives you everything you need to start publishing content immediately:

  • βœ… Production-ready in 5 minutes - Clone, install, and start writing
  • βœ… SEO optimized out of the box - Rank higher on Google from day one
  • βœ… No configuration required - Sensible defaults that just work
  • βœ… Professional design - Clean, modern UI with smooth animations
  • βœ… Powerful API - Programmatic content creation for automation
  • βœ… Free for personal use - Start your blog journey today

Perfect for developers, startups, indie hackers, content creators, and anyone who wants a modern, fast, SEO-friendly blog without the complexity.


✨ Features

🎯 Core Functionality

  • Modern Tech Stack - Next.js 14+ with App Router, TypeScript, Tailwind CSS
  • Rich Content Support - Full Markdown and HTML support with syntax highlighting
  • 13 Blog Categories - Organized content (Technology, Business, Education, Entertainment, etc.)
  • Turso Database - Serverless SQLite database, perfect for edge deployment
  • Mobile-First Design - Responsive and beautiful on all devices
  • Lightning Fast - Server-side rendering, image optimization, code splitting

🎬 Media & Content

  • Video Embedding - YouTube, Vimeo, and direct video files (.mp4, .webm, .ogg)
  • Audio Support - Embed podcasts and audio files (.mp3, .wav, .ogg, .m4a)
  • Flexible Layouts - Position media inline, left, right, or full-width
  • Image Optimization - Automatic image compression and lazy loading
  • Table of Contents - Auto-generated from post headings
  • Code Highlighting - Beautiful syntax highlighting for technical posts

πŸ” SEO & Performance

  • SEO-Optimized - Dynamic meta tags, Open Graph, Twitter Cards
  • JSON-LD Structured Data - Rich search results with article schema
  • Automatic Sitemap - Generated sitemap.xml for search engines
  • Robots.txt - Proper search engine indexing configuration
  • 90+ Lighthouse Score - Optimized for Core Web Vitals
  • Clean URLs - SEO-friendly slugs and canonical URLs

πŸš€ Developer Experience

  • Powerful REST API - Create posts programmatically with secure authentication
  • TypeScript - Full type safety and excellent IDE support
  • Hot Reload - Instant preview of changes during development
  • Comprehensive Validation - Input validation for all API endpoints
  • Well-Documented - Clear code, comments, and extensive API documentation
  • Easy Customization - Modular components and Tailwind CSS

πŸ“Š Analytics & Engagement

  • View Counter - Track post popularity
  • Reading Time - Automatic reading time estimates
  • Social Sharing - Built-in Twitter, LinkedIn, and link sharing
  • Tag System - Organize and filter posts by tags
  • Category Navigation - Filter posts by category with one click
  • Comment System - Threaded comments with nested replies, likes, and real-time engagement

🎨 UI/UX

  • Smooth Animations - Fade-in and slide effects for professional feel
  • Dark/Light Compatible - Ready for dark mode implementation
  • Professional Shadows - Depth and hierarchy with subtle shadows
  • Responsive Tables - Mobile-optimized data display
  • Accessible - Semantic HTML and ARIA attributes

πŸš€ Quick Start

Get your blog running in 4 simple steps:

1️⃣ Clone the repository

git clone https://github.com/AKzar1el/blog-starter-template.git
cd blog-starter-template

2️⃣ Set up Turso Database

Create a free Turso account:

  1. Go to https://turso.tech
  2. Sign up with GitHub (it's free!)
  3. Click "Create Database"
  4. Name it blog-db and click Create

Get your credentials:

  • Copy the Database URL (looks like libsql://blog-db-xxxxx.turso.io)
  • Click "Create Token" and copy the auth token

Initialize the database schema:

  1. In Turso dashboard, click your database
  2. Open the SQL Shell or Console
  3. Paste and run this SQL:
CREATE TABLE posts (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  slug TEXT UNIQUE NOT NULL,
  title TEXT NOT NULL,
  content TEXT NOT NULL,
  excerpt TEXT NOT NULL,
  author TEXT NOT NULL,
  tags TEXT NOT NULL,
  coverImage TEXT,
  category TEXT DEFAULT 'All Blog Posts',
  publishedAt TEXT NOT NULL,
  updatedAt TEXT NOT NULL,
  views INTEGER DEFAULT 0,
  embeddedMedia TEXT
);

CREATE INDEX idx_posts_slug ON posts(slug);
CREATE INDEX idx_posts_publishedAt ON posts(publishedAt DESC);
CREATE INDEX idx_posts_category ON posts(category);

3️⃣ Install dependencies and configure

# Install packages
npm install

# Set up environment variables
cp .env.example .env.local

Edit .env.local file with your Turso credentials:

# Database Configuration (from Turso dashboard)
TURSO_DATABASE_URL=libsql://your-database-name.turso.io
TURSO_AUTH_TOKEN=your-turso-auth-token-here

# API Configuration
API_KEY=your-secure-api-key-here

# Site Configuration
NEXT_PUBLIC_SITE_URL=http://localhost:3000
NEXT_PUBLIC_SITE_NAME=Your Professional Blog

4️⃣ Start the development server

npm run dev

πŸŽ‰ That's it! Open http://localhost:3000 and start blogging!


πŸ“ Creating Your First Post

Using the API (Recommended)

curl -X POST http://localhost:3000/api/posts \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "title": "My First Blog Post",
    "content": "# Welcome\n\nThis is my first post!",
    "excerpt": "An introduction to my new blog",
    "author": "Your Name",
    "tags": ["welcome", "introduction"],
    "category": "Technology",
    "coverImage": "https://images.unsplash.com/photo-1499750310107-5fef28a66643"
  }'

For detailed API documentation with all features, see API_DOCUMENTATION.md.


βš™οΈ Configuration

Site Settings

next.config.js - Configure Next.js settings:

module.exports = {
  images: {
    domains: ['images.unsplash.com', 'your-image-domain.com'],
  },
}

.env.local - Environment variables:

# Required - Database Configuration (Turso)
TURSO_DATABASE_URL=libsql://your-database.turso.io
TURSO_AUTH_TOKEN=your-turso-auth-token

# Required - API Configuration
API_KEY=your-secure-random-api-key

# Required - Site Configuration
NEXT_PUBLIC_SITE_URL=https://yourdomain.com
NEXT_PUBLIC_SITE_NAME=Your Blog Name

# Optional
NEXT_PUBLIC_GA_ID=G-XXXXXXXXXX  # Google Analytics

Customization

Colors & Styling:

  • Edit tailwind.config.ts for theme colors
  • Modify app/globals.css for custom styles and animations
  • Update components in components/ folder

Content Categories:

  • Edit lib/constants.ts to modify or add categories
  • Default categories: Technology, Business, Education, Ethics, Art, Entertainment, Fun, Games, Music, Politics, History, News

Database:

  • Turso (serverless SQLite) - Perfect for production and edge deployment
  • SQLite-compatible syntax - Easy to work with
  • Schema defined in lib/db/index.ts
  • Initialization script available: npm run init-db

πŸ“ Project Structure

blog-starter-template/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   └── posts/
β”‚   β”‚       └── route.ts              # REST API with validation
β”‚   β”œβ”€β”€ blog/
β”‚   β”‚   β”œβ”€β”€ [slug]/
β”‚   β”‚   β”‚   └── page.tsx              # Individual post page
β”‚   β”‚   └── page.tsx                  # Blog listing with categories
β”‚   β”œβ”€β”€ about/
β”‚   β”‚   └── page.tsx                  # About page
β”‚   β”œβ”€β”€ layout.tsx                    # Root layout with SEO
β”‚   β”œβ”€β”€ page.tsx                      # Homepage
β”‚   β”œβ”€β”€ sitemap.ts                    # Dynamic sitemap
β”‚   β”œβ”€β”€ robots.ts                     # Robots.txt
β”‚   └── globals.css                   # Global styles
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ Header.tsx                    # Navigation
β”‚   β”œβ”€β”€ Footer.tsx                    # Site footer
β”‚   β”œβ”€β”€ PostCard.tsx                  # Post preview card
β”‚   β”œβ”€β”€ MarkdownContent.tsx           # Markdown/HTML renderer
β”‚   β”œβ”€β”€ MediaEmbed.tsx                # Video/audio embedding
β”‚   β”œβ”€β”€ TableOfContents.tsx           # Auto-generated TOC
β”‚   └── ShareButtons.tsx              # Social sharing
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ db/
β”‚   β”‚   β”œβ”€β”€ index.ts                  # Database setup (Turso client)
β”‚   β”‚   └── posts.ts                  # Post operations
β”‚   β”œβ”€β”€ constants.ts                  # Blog categories & config
β”‚   β”œβ”€β”€ media-utils.ts                # Media processing
β”‚   └── utils.ts                      # Helper functions
β”œβ”€β”€ scripts/
β”‚   └── init-db.ts                    # Database initialization script
β”œβ”€β”€ public/                           # Static assets
β”œβ”€β”€ .env.example                      # Environment template
β”œβ”€β”€ API_DOCUMENTATION.md              # Full API docs
β”œβ”€β”€ DATABASE_MIGRATION.md             # Database setup guide
└── package.json

🎬 Rich Media Support

Embed videos and audio with flexible layouts:

YouTube Videos

{
  "embeddedMedia": [
    {
      "url": "https://www.youtube.com/watch?v=VIDEO_ID",
      "type": "youtube",
      "position": "right",
      "caption": "Tutorial: Getting Started"
    }
  ]
}

Vimeo Videos

{
  "url": "https://vimeo.com/VIDEO_ID",
  "type": "vimeo",
  "position": "full-width"
}

Direct Video Files

{
  "url": "https://example.com/video.mp4",
  "type": "video",
  "position": "inline"
}

Audio Files (Podcasts, Music)

{
  "url": "https://example.com/podcast.mp3",
  "type": "audio",
  "position": "inline",
  "caption": "Episode 1: Introduction"
}

Position Options:

  • inline - Centered within content (default)
  • right - Media on right, text wraps left (desktop only)
  • left - Media on left, text wraps right (desktop only)
  • full-width - Spans full width for cinematic effect

πŸ“– API Documentation

Create a Post

Endpoint: POST /api/posts

Headers:

Content-Type: application/json
x-api-key: YOUR_API_KEY

Required Fields:

  • title (string) - Post title
  • content (string) - Markdown or HTML content
  • excerpt (string) - Brief summary
  • author (string) - Author name
  • tags (array) - Minimum 1 tag

Optional Fields:

  • category (string) - One of 13 available categories
  • slug (string) - Custom URL (auto-generated if not provided)
  • coverImage (string) - Cover image URL
  • embeddedMedia (array) - Video/audio embeds

Example Request:

curl -X POST http://localhost:3000/api/posts \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "title": "Getting Started with Next.js",
    "content": "# Introduction\n\nNext.js is amazing...",
    "excerpt": "Learn Next.js fundamentals",
    "author": "John Doe",
    "tags": ["nextjs", "react", "tutorial"],
    "category": "Technology",
    "coverImage": "https://images.unsplash.com/photo-1461749280684-dccba630e2f6"
  }'

Success Response (201):

{
  "success": true,
  "message": "Post created successfully",
  "post": {
    "id": 1,
    "slug": "getting-started-with-nextjs",
    "title": "Getting Started with Next.js",
    "publishedAt": "2024-11-17T10:30:00.000Z",
    ...
  }
}

Get All Posts

Endpoint: GET /api/posts

Query Parameters:

  • limit (number) - Posts per page
  • offset (number) - Pagination offset

Example:

curl http://localhost:3000/api/posts?limit=10&offset=0

πŸ“š For comprehensive API documentation, see API_DOCUMENTATION.md


🌐 Deployment

Deploy your blog to production with one click:

Vercel (Recommended - Free Tier Available)

Deploy with Vercel

Steps:

  1. Set up Turso Database (see Quick Start above)
  2. Click the deploy button above
  3. Connect your GitHub account
  4. Set environment variables (for Production, Preview, and Development):
    • TURSO_DATABASE_URL - Your Turso database URL
    • TURSO_AUTH_TOKEN - Your Turso auth token
    • API_KEY - Choose a secure API key
    • NEXT_PUBLIC_SITE_URL - Your Vercel deployment URL
    • NEXT_PUBLIC_SITE_NAME - Your blog name
  5. Deploy! πŸŽ‰

Important: Make sure your Turso database is initialized with the schema (see Quick Start step 2️⃣) before deploying.

Netlify

Deploy to Netlify

Other Platforms

This standard Next.js app can deploy to:

πŸ’‘ Production Tip: Turso is production-ready and serverless, perfect for edge deployment. The free tier includes everything you need to get started!


πŸ› οΈ Built With

Core Technologies

Content & Data

SEO & Performance

  • Next/Image - Automatic image optimization
  • Next/Font - Font optimization
  • JSON-LD - Structured data for search engines

πŸ“Š Database Schema

Posts Table

Column Type Description
id INTEGER Primary key, auto-increment
slug TEXT Unique URL slug (indexed)
title TEXT Post title
content TEXT Markdown or HTML content
excerpt TEXT Brief summary for SEO
author TEXT Author name
tags TEXT JSON array of tags
category TEXT Blog category (indexed)
coverImage TEXT Cover image URL (nullable)
embeddedMedia TEXT JSON array of media objects (nullable)
publishedAt TEXT ISO 8601 timestamp (indexed)
updatedAt TEXT ISO 8601 timestamp
views INTEGER View counter (default: 0)

Indexes for Performance:

  • idx_posts_slug - Fast slug lookups
  • idx_posts_publishedAt - Efficient sorting by date
  • idx_posts_category - Quick category filtering

🎯 Performance & SEO

Lighthouse Scores

  • Performance: 90+
  • Accessibility: 95+
  • Best Practices: 95+
  • SEO: 100

SEO Features Included

  • βœ… Dynamic meta tags for every page
  • βœ… Open Graph tags for social sharing
  • βœ… Twitter Card support
  • βœ… JSON-LD structured data (Article schema)
  • βœ… Automatic sitemap.xml generation
  • βœ… Robots.txt configuration
  • βœ… Semantic HTML5 structure
  • βœ… Canonical URLs
  • βœ… Mobile-friendly design
  • βœ… Fast page load times

Performance Optimizations

  • βœ… Server-side rendering (SSR)
  • βœ… Automatic code splitting
  • βœ… Image lazy loading and optimization
  • βœ… Font optimization
  • βœ… Efficient caching strategies
  • βœ… Minimal JavaScript bundle

πŸ”’ Security

Your blog is secure by default:

  • API Authentication - Secure API key for post creation
  • Input Validation - Comprehensive validation on all inputs
  • SQL Injection Protection - Parameterized queries
  • XSS Protection - React escaping + DOMPurify for HTML
  • External Link Security - Automatic rel="noopener noreferrer"
  • CSRF Protection - Built-in Next.js CSRF protection
  • Type Safety - TypeScript prevents common errors

πŸ“– Documentation

Database (Turso)

This blog uses Turso - a serverless SQLite database perfect for modern web applications:

Why Turso?

  • βœ… Serverless - No infrastructure to manage
  • βœ… SQLite-compatible - Familiar SQL syntax
  • βœ… Edge-ready - Deploy close to your users
  • βœ… Free tier - Generous limits for most blogs
  • βœ… Fast - Sub-10ms query latency
  • βœ… Scalable - Grows with your blog

Key Features:

  • Automatic backups and point-in-time recovery
  • Built-in replication for high availability
  • Web dashboard for easy management
  • CLI tools for advanced operations

For detailed setup instructions, see the Quick Start guide above.


πŸ—ΊοΈ Roadmap

Current Features βœ…

  • Production-ready blog platform
  • SEO optimization
  • Rich content support (Markdown & HTML)
  • Media embedding (video & audio)
  • 13 blog categories
  • REST API with authentication
  • Mobile-responsive design
  • View counter and analytics
  • Dark mode support
  • Related posts recommendations
  • Threaded comment system with likes and nested replies

Planned Features 🚧

  • Search functionality
  • Newsletter integration (Mailchimp, ConvertKit)
  • Multi-author support with profiles
  • RSS feed
  • Admin dashboard
  • Draft posts management
  • Scheduled publishing

See open issues for feature requests and bug reports.


🀝 Contributing

Contributions make the open-source community amazing! Any contributions you make are greatly appreciated.

How to Contribute

  1. Fork the repository
  2. Create a feature branch
    git checkout -b feature/AmazingFeature
  3. Commit your changes
    git commit -m 'Add some AmazingFeature'
  4. Push to the branch
    git push origin feature/AmazingFeature
  5. Open a Pull Request

Contribution Guidelines

  • Write clear, descriptive commit messages
  • Follow the existing code style (TypeScript, ESLint)
  • Add comments for complex logic
  • Update documentation if needed
  • Test your changes thoroughly

πŸ“„ License

This project is available under dual licensing:

βœ… Personal & Educational Use (Free)

Free to use under the MIT License for:

  • Personal blogs and portfolios
  • Educational projects and learning
  • Non-profit organizations
  • Open-source projects
  • Hobby projects

πŸ’Ό Commercial Use

For commercial use, please contact me for licensing options.

Commercial use includes:

  • Building blogs for clients (paid work)
  • Using in products or services that generate revenue
  • Integrating into SaaS platforms
  • Selling as a premium template

Why dual licensing?
I want this template to be freely available for personal use and learning while ensuring sustainable development through commercial licensing.

πŸ“§ Contact for commercial license: tomi.seregi99@gmail.com

Questions about licensing? Email me - I'm happy to help you determine which license fits your use case!


πŸ’¬ Support & Community

Need help? Have questions? Want to share what you built?

Response Time: I aim to respond to issues and questions within 48 hours.


🌟 Show Your Support

If this project helped you launch your blog, please consider:

  • ⭐ Starring this repository
  • 🍴 Forking and contributing
  • πŸ“’ Sharing with others who might find it useful
  • πŸ’¬ Tweeting about your experience
  • β˜• Buy me a coffee (optional)

Every star motivates me to keep improving this project! πŸš€


πŸ™ Acknowledgments

Built with ❀️ using amazing open-source tools:

  • Next.js team for the incredible framework
  • Vercel for seamless deployment
  • Tailwind CSS for beautiful styling
  • The open-source community for inspiration and support

πŸ“ˆ Stats

GitHub Repo Stats


πŸ”— Links


πŸ“ What's New

Version 2.1 (November 2024)

πŸš€ Database Migration to Turso

  • Migrated from SQLite to Turso (serverless SQLite)
  • Perfect compatibility with Vercel and edge deployment
  • Sub-10ms query latency
  • Built-in backups and replication
  • Easy setup with web dashboard
  • Production-ready from day one

Version 2.0 (November 2024)

🎬 Rich Media Features

  • YouTube and Vimeo video embedding
  • Direct video file support (.mp4, .webm, .ogg)
  • Audio embedding (.mp3, .wav, .ogg, .m4a)
  • Flexible positioning (inline, left, right, full-width)
  • Optional captions for embedded content

πŸ“‚ Content Organization

  • 13 organized blog categories
  • Category navigation with tabs
  • Category badges on post cards
  • Efficient category-based filtering

✨ Enhanced Content

  • Full HTML support alongside Markdown
  • SEO-optimized link handling
  • Automatic external link attributes
  • Improved code syntax highlighting

🎨 UI/UX Improvements

  • Smooth fade-in animations
  • Enhanced button interactions
  • Professional shadow transitions
  • Responsive media layouts
  • Better mobile experience

For detailed API usage with new features, see API_DOCUMENTATION.md.


Made with ❀️ for developers and content creators

Launch your blog today. Start writing tomorrow.

⬆ Back to Top

About

πŸš€ Professional blog starter with Next.js 14+, TypeScript, SQLite. Rich content support, video/audio embedding, 13 categories, powerful API. Launch your blog in 5 minutes. Free for personal use.

Topics

Resources

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE.md
Unknown
LICENSE-MIT.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors