A full-stack social media application built with modern web technologies
SimpleInsta adalah aplikasi social media yang terinspirasi dari Instagram, memiliki fitur-fitur lengkap untuk berbagi foto, memberi like, berkomentar, dan mengelola profil pengguna.
- React 18 - UI Library
- Vite - Build Tool & Dev Server
- React Router DOM - Client-side Routing
- Tailwind CSS - Utility-first CSS Framework
- Lucide React - Icon Library
- Axios - HTTP Client
- Canvas Confetti - Celebration Animations
- Laravel 10 - PHP Framework
- Laravel Sanctum - API Authentication
- PostgreSQL - Database
- Laravel Storage - File Management
- ESLint - Code Linting
- PostCSS - CSS Processing
- Composer - PHP Dependency Manager
- NPM - JavaScript Package Manager
- β User Registration dengan validasi lengkap
- β User Login dengan Remember Me
- β Logout functionality
- β Protected Routes (hanya user login yang bisa akses)
- β Welcome Animation setelah registrasi berhasil
- β Token-based authentication (Laravel Sanctum)
- β Create Post - Text + Image (opsional)
- β Edit Post - Update caption atau ganti gambar
- β Delete Post - Hapus post beserta likes & comments
- β View Posts - Feed timeline dengan infinite scroll
- β Post Validation - Minimal ada text atau image
- β Authorization - Hanya owner yang bisa edit/delete
- β Like/Unlike post dengan satu klik
- β Realtime like count update
- β Optimistic UI update (instant feedback)
- β Like state persistence (tetap tersimpan saat navigasi)
- β Visual indicator (red heart untuk liked posts)
- β Add Comment - Tulis komentar di post
- β View Comments - Lihat semua komentar dalam modal
- β Delete Comment - Hapus komentar sendiri
- β Comment Modal - Full-screen modal untuk fokus membaca
- β Timestamp - Relative time (just now, 5m ago, dll)
- β User Avatar - Tampilkan foto profil di setiap komentar
- β Profile Page - Halaman profil user
- β User Stats - Total posts, followers, following
- β Posts Grid - Tampilan grid untuk semua post user
- β Avatar - Profile picture dengan UI-Avatars fallback
- β Responsive Design - Mobile-first approach
- β Bottom Navigation - Easy navigation (Home, Add, Profile)
- β Loading States - Skeleton screens & spinners
- β Error Handling - User-friendly error messages
- β Empty States - Informative empty state messages
- β Smooth Animations - Transitions & micro-interactions
- β Modern UI - Clean, minimalist design dengan Tailwind CSS
- β Role-based Access - User vs Admin roles
- β Post Ownership - Hanya owner bisa edit/delete post
- β Comment Ownership - Hanya owner bisa delete comment
- β CORS Configuration - Secure cross-origin requests
- β Rate Limiting - Prevent spam & abuse
- β Input Sanitization - XSS protection
insta-app-web/
βββ backend/ # Laravel Backend
β βββ app/
β β βββ Http/
β β β βββ Controllers/ # API Controllers
β β β βββ Resources/ # API Resources (transformers)
β β β βββ Middleware/ # Custom middleware
β β βββ Models/ # Eloquent Models
β β βββ Policies/ # Authorization policies
β βββ database/
β β βββ migrations/ # Database migrations
β β βββ factories/ # Model factories
β β βββ seeders/ # Database seeders
β βββ routes/
β β βββ api.php # API routes
β β βββ web.php # Web routes
β βββ tests/ # Backend tests
β
βββ frontend/ # React Frontend
β βββ src/
β β βββ components/ # Reusable components
β β βββ pages/ # Page components
β β βββ context/ # React Context (AuthContext)
β β βββ hooks/ # Custom hooks
β β βββ lib/ # API client & utilities
β βββ public/ # Static assets
β βββ index.html # HTML template
β
βββ README.md # This file
Pastikan sudah terinstall:
- PHP >= 8.1
- Composer >= 2.0
- Node.js >= 18.0
- PostgreSQL >= 13.0
- Git
git clone https://github.com/yourusername/insta-app-web.git
cd insta-app-web# Masuk ke folder backend
cd backend
# Install dependencies
composer install
# Copy environment file
cp .env.example .env
# Generate application key
php artisan key:generate
# Setup database di .env
# Edit file .env dan sesuaikan:
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=insta_app
DB_USERNAME=your_username
DB_PASSWORD=your_password
# Create database (via psql)
createdb insta_app
# Run migrations
php artisan migrate
# Create storage symlink
php artisan storage:link
# (Optional) Run seeders
php artisan db:seed
# Start Laravel development server
php artisan serve
# Backend running at: http://localhost:8000# Buka terminal baru, masuk ke folder frontend
cd frontend
# Install dependencies
npm install
# Setup environment variables
# Create .env file dan tambahkan:
echo "VITE_API_URL=http://localhost:8000/api" > .env
# Start Vite development server
npm run dev
# Frontend running at: http://localhost:5173Buka browser dan akses:
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000/api
- Buka http://localhost:5173
- Klik "Sign Up" atau navigate ke
/register - Isi form:
- Full Name (required)
- Email (required, must be valid)
- Password (required, min 6 characters)
- Confirm Password (must match)
- Klik "Sign Up"
- Welcome animation akan muncul π
- Automatically redirected ke Home page
- Navigate ke
/login - Isi email & password
- Klik "Sign In"
- Redirected ke Home page
- Klik tombol "+" di bottom navigation
- Modal "Create Post" akan muncul
- Isi caption (optional)
- Upload image (optional)
- Note: Minimal ada caption ATAU image
- Klik "Post"
- Post baru muncul di feed
- Klik icon heart di post
- Icon berubah merah = liked
- Like count bertambah
- Klik lagi untuk unlike
- Klik icon comment di post
- Modal comments akan muncul
- Tulis komentar di bottom form
- Klik Send
- Komentar muncul di list
- Klik trash icon untuk delete komentar sendiri
- Klik menu (3 dots) di post milik sendiri
- Pilih "Edit Post"
- Update caption atau image
- Klik "Save Changes"
- Klik menu (3 dots) di post milik sendiri
- Pilih "Delete Post"
- Konfirmasi delete
- Post terhapus beserta likes & comments
- Klik icon user di bottom navigation
- Lihat stats: Posts count, Followers, Following
- Lihat grid semua post user
- Klik Logout untuk keluar
cd backend
# Run all tests
php artisan test
# Run specific test
php artisan test --filter PostTest
# Run with coverage
php artisan test --coveragecd frontend
# Run linter
npm run lint
# Build for production (test build)
npm run build
# Preview production build
npm run previewFile: backend/.env
# Application
APP_NAME="SimpleInsta"
APP_ENV=local
APP_DEBUG=true
APP_URL=http://localhost:8000
# Database
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=insta_app
DB_USERNAME=postgres
DB_PASSWORD=secret
# CORS (allow frontend)
SANCTUM_STATEFUL_DOMAINS=localhost:5173
SESSION_DOMAIN=localhostFile: frontend/.env
# API URL
VITE_API_URL=http://localhost:8000/api| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /api/register |
Register new user | No |
| POST | /api/login |
Login user | No |
| POST | /api/logout |
Logout user | Yes |
| GET | /api/user |
Get current user | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /api/posts |
Get all posts | No |
| GET | /api/posts/{id} |
Get single post | No |
| POST | /api/posts |
Create post | Yes |
| PUT | /api/posts/{id} |
Update post | Yes (owner) |
| DELETE | /api/posts/{id} |
Delete post | Yes (owner) |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /api/posts/{id}/like |
Toggle like | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /api/posts/{id}/comments |
Add comment | Yes |
| DELETE | /api/comments/{id} |
Delete comment | Yes (owner) |
Problem: Like icon color resets after navigation
Solution: Update parent state on like action
Details: See BUGFIX_LIKE_PERSISTENCE_FINAL.md
Problem: Error when opening comment modal on post with 0 comments
Solution: Added MessageCircle to import statement
# Build for production
composer install --optimize-autoloader --no-dev
# Set environment
php artisan config:cache
php artisan route:cache
php artisan view:cache
# Run migrations
php artisan migrate --force
# Set permissions
chmod -R 755 storage bootstrap/cache# Build for production
npm run build
# Output: dist/ folder
# Deploy dist/ to your hosting (Vercel, Netlify, etc.)Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Your Name - Initial work - GitHub
- https://github.com/DwikyAnggarda/insta-app-web/blob/main/frontend/ss-1.png
- https://github.com/DwikyAnggarda/insta-app-web/blob/main/frontend/ss-2.png
- https://github.com/DwikyAnggarda/insta-app-web/blob/main/frontend/ss-3.png
- Inspired by Instagram
- Built with β€οΈ using Laravel & React
- Icons by Lucide React
- UI design with Tailwind CSS
For support, email your.email@example.com or open an issue in the repository.
Happy Coding! π