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