A modern, full-featured blog application built with Next.js 15, TypeScript, shadcn/ui, and PostgreSQL.
- CRUD Operations: Create, Read, Update, and Delete blog posts
- Authentication: Simple email/password authentication with NextAuth.js
- Rich UI: Clean, elegant interface using shadcn/ui components
- Dark/Light Mode: Theme toggle with system preference detection
- Responsive Design: Mobile-friendly interface
- Database: PostgreSQL with Prisma ORM
- Type Safety: Full TypeScript support
- Framework: Next.js 15 with App Router
- Language: TypeScript
- UI: shadcn/ui components with Tailwind CSS
- Database: PostgreSQL with Prisma ORM
- Authentication: NextAuth.js
- Styling: Tailwind CSS with custom theme
- Node.js 18+
- PostgreSQL database
- npm or yarn
- Clone the repository:
git clone <repository-url>
cd blog-copilot- Install dependencies:
npm install- Set up environment variables:
Create a
.env.localfile in the root directory:
DATABASE_URL="postgresql://username:password@localhost:5432/blog_copilot"
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key-here"- Set up the database:
npx prisma generate
npx prisma db push- Run the development server:
npm run devOpen http://localhost:3000 to view the application.
src/
├── app/ # Next.js App Router pages
│ ├── api/ # API routes
│ ├── auth/ # Authentication pages
│ ├── posts/ # Blog post pages
│ └── create/ # Create post page
├── components/ # React components
│ ├── ui/ # shadcn/ui components
│ └── ... # Custom components
└── lib/ # Utility functions
├── auth.ts # NextAuth configuration
├── prisma.ts # Prisma client
└── utils.ts # Utility functions
- Lists all blog posts with title, author, and preview
- Clean card-based layout
- Responsive design
- Full post content display
- Author information and creation date
- Edit/Delete buttons for post authors
- Back navigation
- Simple form with title and content fields
- Rich text support
- Form validation
- Author-only editing permissions
- Sign up with name, email, and password
- Sign in with email and password
- Session management
- Protected routes
- Clean navbar with theme toggle
- User menu with logout option
- Responsive design
- Dark/light mode support
POST /api/posts- Create a new postPUT /api/posts/[id]- Update a postDELETE /api/posts/[id]- Delete a postPOST /api/auth/register- Register a new user
- User: id, email, passwordHash, name, createdAt
- Post: id, title, content, authorId, createdAt, updatedAt
- Session: id, sessionToken, userId, expires