To fix the "Database setup required" error, follow these steps:
-
Go to Supabase and sign in
-
Open your project
-
Go to the SQL Editor in the Supabase dashboard
-
Execute the SQL scripts in this order:
- First, run the
supabase/1_database_structure.sql
file - Next, run the
supabase/2_security_policies.sql
file - Finally, run the
supabase/sample_data.sql
file for test data
⚠️ Important: Run each file separately to avoid SQL syntax errors - First, run the
-
In Supabase, go to Storage and create three buckets:
product-images
category-images
user-avatars
-
For the
product-images
bucket, add a policy for public access:- Click on the bucket, go to "Policies"
- Add new policy, select "For anonymous users" and "GET" operations
- Set policy name as "Public Access" and statement as "true"
-
Restart the app - the error should now be gone!
- Product List screen showing all products in a grid layout
- Product Detail screen with detailed information
- Category-based browsing
- Navigation between screens (Home → Categories → Products → Product Detail)
- Add to Cart button works from both Product List and Product Detail screens
- Quantity selection in Product Detail screen
- Cart badge updates with item count
- Cart screen shows all added items
- Ability to change quantities in cart
- Ability to remove items from cart
- Complete buying flow implemented
- Cart totals calculation with subtotal, shipping, and optional discounts
- Coupon code application
- Checkout process with order confirmation
- Order summary and details
- Visual feedback for actions (loading indicators, dialogs)
- Confirmation dialogs for important actions
- Stock quantity display and validation
- Browse products from the home screen or categories tab
- Click on a product to view details
- Adjust quantity and click "Add to Cart" or "Buy Now"
- In Cart screen, review items and modify quantities if needed
- Apply coupon codes (try WELCOME10, TIRUVEAR20, or FREESHIP)
- Click Checkout to complete the purchase
- View order confirmation with order details
The app implements a complete e-commerce buying flow with:
- Kotlin coroutines for async operations
- Repository pattern for data management
- MVVM architecture
- Navigation component for screen navigation
- Material Design UI components
- User authentication (login, register, forgot password)
- Guest browsing
- Product browsing by categories
- Featured products
- New arrivals
- Product search
- Shopping cart
- Order management
- User profile management
- Language: Kotlin
- Min SDK: 26 (Android 8.0 Oreo)
- Architecture: MVVM
- Backend: Supabase
- UI: Material Design Components
- Image Loading: Glide
- Asynchronous Programming: Coroutines
- Navigation: Jetpack Navigation Component
- app/src/main/java/com/tiruvear/textiles/
- data/
- models/: Data classes representing database entities
- repositories/: Repository interfaces and implementations
- ui/
- auth/: Authentication screens (login, register)
- main/: Main app screens (home, categories, cart, orders, profile)
- admin/: Admin dashboard for inventory management
- TiruvearApp.kt: Application class with Supabase initialization
- data/
- Clone the repository
- Open the project in Android Studio
- Sync Gradle dependencies
- Set up Supabase backend (see Supabase Setup below)
- Build and run the app
This app uses Supabase as its backend service. To set up Supabase:
- Create a Supabase account at https://supabase.com
- Create a new project
- Navigate to the SQL Editor and run the database setup script in
supabase/database_setup.sql
- Update the Supabase URL and API Key in
TiruvearApp.kt
For detailed Supabase setup instructions, see supabase/setup_instructions.md
.
The app uses the following tables in Supabase:
- profiles: User profiles linked to auth.users
- product_categories: Product categories
- products: Product information
- product_images: Product images
- product_variants: Product variants (size, color, etc.)
- carts: Shopping carts
- cart_items: Items in shopping carts
- orders: Order information
- order_items: Items in orders
- addresses: User shipping addresses
- reviews: Product reviews
All data is persistently stored in Supabase:
- User data: Authentication and profiles table
- Products: Products and related tables
- Cart: Carts and cart_items tables
- Orders: Orders and order_items tables
Supabase RLS policies are used to secure data:
- Product and category data is readable by everyone
- Cart data is only accessible by the cart owner
- Order data is only accessible by the order owner
- User data is only accessible by the user themselves
If you encounter issues connecting to Supabase:
- Make sure the Supabase URL and API key in
TiruvearApp.kt
are correct - Check that you've run the database setup script
- Verify your internet connection
- Check the Supabase dashboard for service status
- "Failed to create user": Check Supabase authentication settings
- "Failed to load products": Check database setup and RLS policies
- "Failed to add to cart": Check cart table schema and RLS policies
This project is proprietary and confidential.
Developed for Tiruvear Textiles.
The app follows an MVVM architecture:
- Models: Data classes representing entities like User, Product, etc.
- Repositories: Handle data operations and communicate with Supabase
- ViewModels: Manage UI-related data and communicate with repositories
- Views: UI components that display data to the user
This application uses Supabase as its backend database service. You need to set up Supabase before using the app:
-
Create a Supabase Account:
- Go to https://supabase.com and sign up for an account
- Create a new project
-
Set Up the Database:
- In your Supabase project dashboard, go to the SQL Editor
- Copy the contents of the
supabase/database_setup.sql
file - Paste and execute the SQL script in the Supabase SQL Editor
-
Configure the App:
- Get your Supabase project URL and anon key from the Settings > API section
- Update these values in the
app/src/main/java/com/tiruvear/textiles/TiruvearApp.kt
file:const val SUPABASE_URL = "your_project_url" const val SUPABASE_KEY = "your_anon_key"
-
Set Up Storage Buckets:
- In Supabase, go to Storage and create the following buckets:
product-images
category-images
user-avatars
- Set up public access for the product-images bucket
- In Supabase, go to Storage and create the following buckets:
-
Build and Run the App:
- After completing the database setup, build and run the app:
./gradlew build ./gradlew installDebug
- After completing the database setup, build and run the app:
For more detailed instructions, refer to the supabase/setup_instructions.md
file.