Toko Thrifty is a full-stack web application for a thrift store specializing in second-hand clothing (pakaian bekas). It allows users to browse products, filter by categories, sizes, and prices, make purchases, and manage orders. Admins can handle product inventory, user management, and purchases.
The project is structured as a monorepo with a Laravel backend API and a Next.js frontend.
- Framework: Laravel 10 with Sanctum for API authentication
- Database: MySQL (configurable in
backend/config/database.php) - API Documentation: Scramble (OpenAPI/Swagger) for auto-generated docs
- Key Packages:
- Guzzle for HTTP requests
- Laravel Sanctum for auth
- Eloquent ORM for models (Pakaian, KategoriPakaian, Pembelian, etc.)
- Models: Pakaian (Products), KategoriPakaian (Categories), MetodePembayaran (Payment Methods), Pembelian (Purchases), User
- Framework: Next.js 15 with App Router and Turbopack
- UI Library: Radix UI components, Tailwind CSS 4, Lucide React icons
- State Management: SWR for data fetching, Axios for API calls
- Other: Recharts for charts, Sonner for toasts, Embla Carousel for sliders
- Sections: Admin dashboard, User pages, Auth flows
- Browse and search products (by name, description, category)
- Filter products by category, size, price range
- View product details
- Make purchases with payment method selection
- Order history and details
- Authentication (login/register)
- Dashboard with analytics (e.g., sales charts)
- Manage products (CRUD for Pakaian)
- Manage categories (KategoriPakaian)
- Manage users and roles
- View and update purchases (Pembelian)
- Products: GET
/api/pakaian(list with filters), GET/api/pakaian/{id}(details), POST/PUT/DELETE for admins - Categories: GET
/api/kategori-pakaian - Payments: GET
/api/metode-pembayaran - Search: GET
/api/pakaian/search(advanced filters) - Auth: Standard Laravel Sanctum routes (login, register, logout)
- Purchases: CRUD for Pembelian and PembelianDetail
- Full API docs available at
/api/docs(Scramble) when server is running
- PHP 8.1+
- Composer
- Node.js 18+
- MySQL (or your preferred DB)
- Git
- Navigate to the backend directory:
cd backend - Install PHP dependencies:
composer install - Install Node dependencies (for Vite assets):
npm install - Copy environment file:
cp .env.example .env - Generate app key:
php artisan key:generate - Configure database in
.env(DB_HOST, DB_DATABASE, etc.) - Run migrations:
php artisan migrate - Seed database (includes admin user):
php artisan db:seed- Default admin: Check
database/seeders/AdminUserSeeder.phpfor credentials (e.g., email: admin@example.com, password: password)
- Default admin: Check
- Navigate to the frontend directory:
cd frontend - Install dependencies:
npm install - Update API base URL in
frontend/src/lib/api.jsif needed (defaults tohttp://localhost:8000/api).
-
Start the backend server:
cd backend php artisan serve- API runs on
http://localhost:8000 - API Docs:
http://localhost:8000/api/docs
- API runs on
-
Start the frontend dev server:
cd frontend npm run dev- App runs on
http://localhost:3000
- App runs on
-
For production build:
- Backend:
php artisan optimize - Frontend:
npm run buildthennpm start
- Backend:
toko_thrifty/
├── backend/ # Laravel API
│ ├── app/ # Models, Controllers, Resources
│ ├── database/ # Migrations, Seeders, Factories
│ ├── routes/ # API and Web routes
│ └── ...
├── frontend/ # Next.js App
│ ├── src/ # Components, Pages, Lib
│ ├── public/ # Static assets
│ └── ...
├── readme.md # This file
└── LICENSE # MIT License
- Improve API endpoints for better error handling
- Enhance admin pages for full CRUD operations
- Fix middleware issues (e.g., auth guards)
- Add responsive UI tests
- Complete API documentation
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Please ensure code follows Laravel and Next.js best practices. Run composer lint (backend) and npm run lint (frontend) before submitting.
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ for thrift shopping!