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.
πClick to expand π
- 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
- 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
- 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
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
id(uuid, primary key) - Unique identifiertitle(text, required) - Blog post titlecontent(text, required) - Rich text contentexcerpt(text) - Short preview (auto-generated)image_url(text) - Cover image URLauthor_id(uuid) - References auth.usersauthor_name(text) - Author display namecreated_at(timestamptz) - Creation timestampupdated_at(timestamptz) - Last update timestamp
- Anyone can read blogs
- Authenticated users can create blogs
- Users can only update/delete their own blogs
- Node.js 18+ and npm
- Supabase account and project
-
Clone the repository
git clone https://github.com/imBharathkumarp/BlogSpace.git cd BlogSpace -
Install dependencies
npm install
-
Set up environment variables
Create a
.env.localfile in the root directory:NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
-
Set up Supabase database
The database migration has already been applied. Your Supabase project includes:
blogstable with proper schema- Row-Level Security policies
- Indexes for optimized queries
- Automatic timestamp updates
-
Run the development server
npm run dev
-
Open your browser
Navigate to http://localhost:3000
- Click "Sign Up" in the navigation bar
- Enter your name, email, and password
- 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.
- Log in to your account
- Click "Create Post" in the navigation
- Enter a title and content using the rich text editor
- Optionally add a cover image URL
- Click "Publish Post" to create your blog
- Navigate to your blog post
- Click the "Edit" button (only visible for your own posts)
- Make your changes
- Click "Update Post" to save
- Navigate to your blog post
- Click the "Delete" button (only visible for your own posts)
- Confirm the deletion
Fetch all blog posts
- Response:
{ blogs: Blog[] }
Create a new blog post
- Body:
{ title, content, excerpt?, image_url?, author_id, author_name } - Response:
{ blog: Blog }
Fetch a single blog post
- Response:
{ blog: Blog }
Update a blog post
- Body:
{ title, content, excerpt?, image_url? } - Response:
{ blog: Blog }
Delete a blog post
- Response:
{ message: string }
All components and API routes are fully typed with TypeScript for better development experience and fewer runtime errors.
- Uses Supabase Auth for secure user management
- JWT-based session handling
- Protected routes check authentication status
- Automatic redirection for unauthorized access
- React Quill provides rich text editing
- Supports headings, lists, formatting, links, and images
- Custom toolbar configuration
- HTML content storage
- 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
- Mobile-first approach
- Breakpoints: sm (640px), md (768px), lg (1024px)
- Flexible grid layouts
- Touch-friendly interface
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
MIT License - feel free to use this project for learning or production.
- GitHub : imBharathkumarp
- Built with β€οΈ using Next.js, TypeScript, and Supabase


