Skip to content

developermithu/nextjs-api-blog

Repository files navigation

Next.js + Laravel Rest API

A minimalist seo friendly blog application built with Next.js and Laravel REST API.

Features

  • 🔐 Authentication with Laravel Sanctum
  • 👤 User and Admin roles
  • 📝 Blog post management
  • 🎨 Modern UI with Tailwind CSS
  • 🔄 Real-time data updates with SWR
  • 📱 Responsive design

Installation

  1. Clone the repository:
git clone https://github.com/developermithu/nextjs-api-blog.git
cd nextjs-api-blog
  1. Install dependencies:
npm install or bun install
  1. Create a .env.local file in the root directory and add the following content:
NEXT_PUBLIC_APP_URL=http://localhost:3000
NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
  1. Start the development server:
npm run dev or bun dev
  1. Open http://localhost:3000 in your browser to view the application.

Login with the following credentials:

# Admin Info:
Email: [email protected]
Password: admin

# User Info:
Email: [email protected]
Password: user

Project Structure

├── src/
│   ├── app/
│   │   ├── (auth)/              # Authentication routes
│   │   ├── (main)/              # Public routes
│   │   ├── dashboard/           # Protected dashboard routes
│   │   ├── styles/              # Global styles
│   │   ├── layout.jsx           # Root layout
│   │   └── page.jsx             # Home page
│   ├── components/              # Reusable components
│   ├── hooks/                   # Custom React hooks
│   ├── lib/                     # Utilities and configurations
│   └── services/                # API service functions

Authentication

The application uses Laravel Sanctum for authentication. The authentication flow is handled through the useAuth hook, which provides:

  • Login, Register and Logout functionality

Dependencies

Key dependencies used in this project:

Made with ❤️ by developermithu

About

Minimalist blog using Next.js and Laravel Rest API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published