Skip to content

imBharathkumarp/BlogSpace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

BlogSpace - Modern Blog Application πŸš€

A full-stack blog application built with Next.js 13, TypeScript, Supabase, and modern UI components. Create, read, update, and delete blog posts with rich text editing capabilities.

BlogSpace


πŸ“‘ Table of Contents

πŸ”ŽClick to expand πŸ‘‡

🧩 Features

Core Functionality

  • Full CRUD Operations: Create, Read, Update, and Delete blog posts
  • Rich Text Editor: WYSIWYG editor powered by React Quill with formatting options
  • User Authentication: Secure authentication system using Supabase Auth
  • Responsive Design: Fully responsive UI that works on all devices
  • Image Support: Add cover images to blog posts via URL
  • Author Attribution: Display author name and publish dates
  • Protected Routes: Only authenticated users can create, edit, or delete posts

Technical Features

  • TypeScript: Fully typed codebase for better development experience
  • Server-Side Rendering: Optimized performance with Next.js 13 App Router
  • Modern UI: Beautiful components built with ShadCN UI and Tailwind CSS
  • Database: PostgreSQL database managed by Supabase
  • Row-Level Security: Secure data access with RLS policies
  • API Routes: RESTful API endpoints for all CRUD operations

πŸ›  Tech Stack

  • Frontend: Next.js 13 (App Router), React 18, TypeScript
  • Styling: Tailwind CSS, ShadCN UI
  • Editor: React Quill (WYSIWYG)
  • Backend: Next.js API Routes
  • Database: Supabase (PostgreSQL)
  • Authentication: Supabase Auth
  • Deployment: Vercel

βš™ Project Structure

blogspace/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   └── blogs/
β”‚   β”‚       β”œβ”€β”€ route.ts          # GET all blogs, POST new blog
β”‚   β”‚       └── [id]/
β”‚   β”‚           └── route.ts      # GET, PUT, DELETE single blog
β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   β”œβ”€β”€ login/
β”‚   β”‚   β”‚   └── page.tsx          # Login page
β”‚   β”‚   └── signup/
β”‚   β”‚       └── page.tsx          # Signup page
β”‚   β”œβ”€β”€ blog/
β”‚   β”‚   └── [id]/
β”‚   β”‚       └── page.tsx          # View single blog
β”‚   β”œβ”€β”€ create/
β”‚   β”‚   └── page.tsx              # Create new blog
β”‚   β”œβ”€β”€ edit/
β”‚   β”‚   └── [id]/
β”‚   β”‚       └── page.tsx          # Edit existing blog
β”‚   β”œβ”€β”€ layout.tsx                # Root layout
β”‚   β”œβ”€β”€ page.tsx                  # Home page (blog list)
β”‚   └── globals.css               # Global styles
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ ui/                       # ShadCN UI components
β”‚   β”œβ”€β”€ BlogCard.tsx              # Blog card component
β”‚   β”œβ”€β”€ BlogForm.tsx              # Blog create/edit form
β”‚   β”œβ”€β”€ Editor.tsx                # WYSIWYG editor wrapper
β”‚   └── Navbar.tsx                # Navigation bar
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ supabase.ts               # Supabase client & types
β”‚   └── auth.ts                   # Authentication helpers
└── README.md

πŸ“Έ Snapshots

  • alt text
  • alt text

πŸ•Ή Database Schema

blogs Table

  • id (uuid, primary key) - Unique identifier
  • title (text, required) - Blog post title
  • content (text, required) - Rich text content
  • excerpt (text) - Short preview (auto-generated)
  • image_url (text) - Cover image URL
  • author_id (uuid) - References auth.users
  • author_name (text) - Author display name
  • created_at (timestamptz) - Creation timestamp
  • updated_at (timestamptz) - Last update timestamp

Security (RLS Policies)

  • Anyone can read blogs
  • Authenticated users can create blogs
  • Users can only update/delete their own blogs

πŸ“œ Getting Started

Prerequisites

  • Node.js 18+ and npm
  • Supabase account and project

Installation

  1. Clone the repository

    git clone https://github.com/imBharathkumarp/BlogSpace.git
    cd BlogSpace
  2. Install dependencies

    npm install
  3. Set up environment variables

    Create a .env.local file in the root directory:

    NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
    NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
  4. Set up Supabase database

    The database migration has already been applied. Your Supabase project includes:

    • blogs table with proper schema
    • Row-Level Security policies
    • Indexes for optimized queries
    • Automatic timestamp updates
  5. Run the development server

    npm run dev
  6. Open your browser

    Navigate to http://localhost:3000


πŸ‘€ Usage Guide

Creating an Account

  1. Click "Sign Up" in the navigation bar
  2. Enter your name, email, and password
  3. After signing up, please check your registered email inbox for a confirmation message.
    Once you verify your email, return to BlogSpace and sign in using your credentials.

Creating a Blog Post

  1. Log in to your account
  2. Click "Create Post" in the navigation
  3. Enter a title and content using the rich text editor
  4. Optionally add a cover image URL
  5. Click "Publish Post" to create your blog

Editing a Blog Post

  1. Navigate to your blog post
  2. Click the "Edit" button (only visible for your own posts)
  3. Make your changes
  4. Click "Update Post" to save

Deleting a Blog Post

  1. Navigate to your blog post
  2. Click the "Delete" button (only visible for your own posts)
  3. Confirm the deletion

🦾 API Endpoints

GET /api/blogs

Fetch all blog posts

  • Response: { blogs: Blog[] }

POST /api/blogs

Create a new blog post

  • Body: { title, content, excerpt?, image_url?, author_id, author_name }
  • Response: { blog: Blog }

GET /api/blogs/[id]

Fetch a single blog post

  • Response: { blog: Blog }

PUT /api/blogs/[id]

Update a blog post

  • Body: { title, content, excerpt?, image_url? }
  • Response: { blog: Blog }

DELETE /api/blogs/[id]

Delete a blog post

  • Response: { message: string }

πŸ’» Key Implementation Details

TypeScript Integration

All components and API routes are fully typed with TypeScript for better development experience and fewer runtime errors.

Authentication Flow

  • Uses Supabase Auth for secure user management
  • JWT-based session handling
  • Protected routes check authentication status
  • Automatic redirection for unauthorized access

WYSIWYG Editor

  • React Quill provides rich text editing
  • Supports headings, lists, formatting, links, and images
  • Custom toolbar configuration
  • HTML content storage

Row-Level Security

  • Database-level security using Supabase RLS
  • Ensures users can only modify their own content
  • Public read access for all blogs
  • Authenticated write access with ownership checks

Responsive Design

  • Mobile-first approach
  • Breakpoints: sm (640px), md (768px), lg (1024px)
  • Flexible grid layouts
  • Touch-friendly interface

πŸ‘‰ Future Enhancements

Potential features to add:

  • Direct image upload to Supabase Storage
  • Comments system
  • Like/favorite functionality
  • Categories and tags
  • Search functionality
  • User profiles
  • Draft/publish status
  • Social sharing buttons
  • Reading time estimation
  • Markdown support option

🀝 License

MIT License - feel free to use this project for learning or production.


😊 Author

  • GitHub : imBharathkumarp
  • Built with ❀️ using Next.js, TypeScript, and Supabase

About

Simple Blog Web Application where users can Create, Read, Update, and Delete (CRUD) blog posts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published