A minimalist seo friendly blog application built with Next.js and Laravel REST API.
- 🔐 Authentication with Laravel Sanctum
- 👤 User and Admin roles
- 📝 Blog post management
- 🎨 Modern UI with Tailwind CSS
- 🔄 Real-time data updates with SWR
- 📱 Responsive design
- Clone the repository:
git clone https://github.com/developermithu/nextjs-api-blog.git
cd nextjs-api-blog
- Install dependencies:
npm install or bun install
- 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
- Start the development server:
npm run dev or bun dev
- Open
http://localhost:3000
in your browser to view the application.
# Admin Info:
Email: [email protected]
Password: admin
# User Info:
Email: [email protected]
Password: user
├── 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
The application uses Laravel Sanctum for authentication. The authentication flow is handled through the useAuth
hook, which provides:
- Login, Register and Logout functionality
Key dependencies used in this project:
- Backend - Laravel + Sanctum
- Next.js 15 - React framework
- Tailwind CSS V4 - Utility-first CSS framework
- SWR - Data fetching and caching
- Axios - HTTP client
- Lucide React - Icon library
- Shadcn UI - UI components library
Made with ❤️ by developermithu