Buy, sell, and trade items within your university community with real-time messaging, secure authentication, and a seamless user experience.
- π― About
- β¨ Features
- ποΈ Demo
- π οΈ Tech Stack
- π Quick Start
- π Documentation
- π Project Structure
- ποΈ Database Schema
- π§ͺ Testing
- π¦ Deployment
- π€ Contributing
- π License
- π₯ Team
Fretio is a comprehensive marketplace platform designed specifically for students to buy, sell, and trade items within their university community. It features real-time messaging, phone verification, product ratings, and a seamless user experience built with modern web technologies.
- University-Focused: Built for students with hostel and university integration
- Real-time Communication: Instant messaging between buyers and sellers
- Secure: Phone verification and authentication via Supabase
- Modern Stack: Built with the latest React ecosystem tools
- Responsive: Works seamlessly on desktop and mobile devices
| Feature | Description |
|---|---|
| ποΈ Product Listings | Create, edit, and manage product listings with multiple images |
| πΈ Image Management | Bulk upload with WebP compression and lazy loading |
| π Category Navigation | Browse products by categories with smart filtering |
| π Smart Search | Real-time search with filters for price, condition, and location |
| β€οΈ Favorites | Save products for later and track price changes |
| π« University Focus | Filter by university and hostel locations |
| Feature | Description |
|---|---|
| π¬ Real-time Chat | Instant messaging between buyers and sellers |
| π Push Notifications | Get alerts for messages, price drops, and new listings |
| β Rating System | Build reputation through transaction ratings |
| π€ User Profiles | Detailed profiles with verification badges |
| π± SMS Verification | Secure phone number verification via Twilio |
| Feature | Description |
|---|---|
| π Dark Mode | System-aware theme with smooth transitions |
| π± Mobile Optimized | Touch gestures, swipe navigation, bottom nav bar |
| βΎοΈ Accessibility | WCAG compliant with screen reader support |
| π¨ Modern Design | Clean UI with Tailwind CSS and shadcn/ui |
| β‘ Performance | Lazy loading, code splitting, and optimized bundle |
| Feature | Description |
|---|---|
| π¦ Bulk Operations | Manage multiple products at once |
| π Inventory Dashboard | Analytics and insights for your listings |
| π CSV Import/Export | Bulk upload products via spreadsheet |
| π° Price Management | Bulk price adjustments and promotions |
| π€ Draft Mode | Save listings as drafts before publishing |
| Feature | Description |
|---|---|
| π Analytics Dashboard | Platform metrics and user activity |
| π‘οΈ Content Moderation | Review and manage flagged content |
| π― Product Promotion | Feature products on homepage |
| π₯ User Management | Manage accounts and permissions |
π Coming Soon - Demo deployment in progress
Click to view screenshots
- Hero section with featured products
- Category grid for easy navigation
- Featured products carousel
- Advanced filtering options
- Grid/list view toggle
- Real-time search results
- Image gallery with zoom
- Seller information
- Similar products suggestions
- Bottom navigation bar
- Swipeable product cards
- Touch-optimized interface
Demo accounts will be available once the live demo is deployed.
- Framework: React 18.3
- Language: TypeScript 5.8
- Build Tool: Vite 5.4
- Routing: React Router v6
- State Management: TanStack Query (React Query) + React Context
- Form Handling: React Hook Form + Zod validation
- UI Components: shadcn/ui (Radix UI primitives)
- Styling: Tailwind CSS 3.4 with animations
- Icons: Lucide React
- Notifications: Sonner (toast notifications)
- Database: Supabase (PostgreSQL)
- Authentication: Supabase Auth
- Storage: Supabase Storage (product images)
- Real-time: Supabase Realtime (messages, notifications)
- SMS: Twilio integration for phone verification
- Testing Framework: Vitest 3.2
- Component Testing: React Testing Library
- User Interaction Testing: @testing-library/user-event
- Linting: ESLint with TypeScript support
| Requirement | Version | Download |
|---|---|---|
| Node.js | 18.0+ | Download |
| npm/bun | 9.0+ / 1.0+ | Included with Node.js / Bun |
| Git | Latest | Download |
| Supabase | Account | Sign up free |
| Twilio (Optional) | Account | Sign up |
# Clone the repository
git clone https://github.com/Coder-MayankSaini/fretio.git
# Navigate to project directory
cd fretio# Using npm (recommended)
npm install
# OR using bun (faster)
bun install
# OR using yarn
yarn install# Copy environment template
cp .env.example .env
# Edit .env file with your credentialsπ Environment Variables Reference
# === REQUIRED ===
# Supabase Configuration
VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your-anon-key-here
# === OPTIONAL ===
# SMS Provider (use "mock" for development)
VITE_SMS_PROVIDER=mock # Options: mock, twilio
# Twilio Configuration (if using Twilio)
VITE_TWILIO_ACCOUNT_SID=your-account-sid
VITE_TWILIO_AUTH_TOKEN=your-auth-token
VITE_TWILIO_PHONE_NUMBER=+1234567890
# Application URL
VITE_APP_URL=http://localhost:8080ποΈ Supabase Database Configuration
-
Create a Supabase Project
- Go to Supabase Dashboard
- Click "New Project"
- Fill in project details
-
Run SQL Scripts (in order)
Navigate to SQL Editor in Supabase Dashboard and run:
-- 1. Storage setup -- Run: supabase/setup-storage.sql -- 2. Categories seed data -- Run: supabase/seed-categories.sql -- 3. Universities & Hostels data -- Run: supabase/seed-universities-hostels.sql -- 4. Verify installation (optional) -- Run: supabase/verify-setup.sql
-
Configure Authentication
- Enable Email provider in Authentication settings
- (Optional) Configure SMTP for email verification
- See Email Setup Guide for details
# Start the development server
npm run dev
# OR using bun
bun run devπ― Access the application at: http://localhost:8080
For a quick development setup without full Supabase configuration:
# 1. Clone and install
git clone https://github.com/Coder-MayankSaini/fretio.git
cd fretio
npm install
# 2. Use placeholder environment
cp .env.example .env
# Edit .env with placeholder values from SETUP_INSTRUCTIONS.md
# 3. Start development
npm run dev
β οΈ Note: This will show the UI but database features won't work without proper Supabase setup.
fretio/
βββ public/ # Static assets
β βββ favicon.ico
β βββ placeholder.svg # Default product image
β βββ robots.txt
β
βββ src/
β βββ components/ # React components
β β βββ ui/ # shadcn/ui components
β β βββ AdminPromotion.tsx # Admin product promotion
β β βββ CategoryGrid.tsx # Category display
β β βββ ContentModeration.tsx # Content moderation
β β βββ Header.tsx # Main navigation
β β βββ HeroSection.tsx # Landing page hero
β β βββ ProductCard.tsx # Product list item
β β βββ ProtectedRoute.tsx # Route authentication
β β βββ SystemAnalytics.tsx # Admin analytics
β β βββ UserRating.tsx # Rating display
β β
β βββ contexts/ # React contexts
β β βββ AuthContext.tsx # Authentication state
β β
β βββ hooks/ # Custom React hooks
β β βββ use-mobile.tsx # Mobile detection
β β βββ use-toast.ts # Toast notifications
β β βββ usePhoneVerification.ts # Phone verification
β β
β βββ integrations/ # External service integrations
β β βββ supabase/
β β βββ client.ts # Supabase client setup
β β βββ types.ts # Database types
β β
β βββ lib/ # Utility functions
β β βββ utils.ts # Helper functions
β β
β βββ pages/ # Route components
β β βββ AdminDashboard.tsx # Admin panel
β β βββ Auth.tsx # Authentication page
β β βββ CompleteProfile.tsx # Profile setup
β β βββ CreateProduct.tsx # Product creation
β β βββ DevTools.tsx # Development utilities
β β βββ Favorites.tsx # User favorites
β β βββ Index.tsx # Landing page
β β βββ Login.tsx # Login page
β β βββ Marketplace.tsx # Product listings
β β βββ Messages.tsx # Chat interface
β β βββ MyProducts.tsx # User's products
β β βββ NotFound.tsx # 404 page
β β βββ Notifications.tsx # Notifications page
β β βββ ProductDetail.tsx # Product details
β β βββ Profile.tsx # User profile
β β βββ Reviews.tsx # Product reviews
β β
β βββ services/ # Business logic
β β βββ sms/ # SMS service providers
β β β βββ providers/
β β β β βββ MockProvider.ts # Mock SMS (dev)
β β β β βββ TwilioProvider.ts # Twilio integration
β β β βββ SMSProviderFactory.ts # Provider factory
β β β βββ types.ts # SMS types
β β βββ notificationService.ts # Notification logic
β β βββ smsService.ts # SMS logic
β β
β βββ test/ # Test configuration
β β βββ setup.ts # Vitest setup
β β
β βββ App.tsx # Main app component
β βββ main.tsx # App entry point
β βββ index.css # Global styles
β
βββ supabase/ # Database scripts
β βββ config.toml # Supabase config
β βββ seed-categories.sql # Category data
β βββ seed-universities-hostels.sql # University data
β βββ setup-storage.sql # Storage bucket setup
β βββ verify-setup.sql # Verification queries
β
βββ .env.example # Environment template
βββ components.json # shadcn/ui config
βββ eslint.config.js # ESLint configuration
βββ package.json # Dependencies
βββ postcss.config.js # PostCSS config
βββ tailwind.config.ts # Tailwind config
βββ tsconfig.json # TypeScript config
βββ vite.config.ts # Vite configuration
βββ vitest.config.ts # Vitest configuration
Fretio uses Supabase (PostgreSQL) with the following main tables:
profiles: User profiles with phone, university, and rating infoproducts: Product listings with images, price, and detailscategories: Product categories (Electronics, Books, etc.)universities: University datahostels: Hostel data linked to universitiesmessages: Real-time chat messagesreviews: Product reviews and ratingsfavorites: User's saved productsnotifications: User notificationsnotification_preferences: User notification settings
profiles
ββ> products (seller_id)
ββ> messages (sender_id, receiver_id)
ββ> reviews (user_id)
ββ> favorites (user_id)
products
ββ> categories (category_id)
ββ> reviews (product_id)
ββ> favorites (product_id)
profiles
ββ> universities (university_id)
ββ> hostels (hostel_id)
product-images: Product photos (public access)avatars: User profile pictures (public access)
For detailed schema and setup scripts, see the supabase/ directory.
# Run tests in watch mode (development)
npm run test
# Run tests once
npm run test:run
# Run tests with coverage report
npm run test:coverage
# Run tests with UI
npm run test:uiTests are located in __tests__ directories next to the code they test:
// src/services/__tests__/notificationService.test.ts
import { describe, it, expect } from 'vitest';
import { notificationService } from '../notificationService';
describe('NotificationService', () => {
it('should send notification successfully', async () => {
const result = await notificationService.send({
userId: 'test-user',
type: 'message',
title: 'Test',
message: 'Test message'
});
expect(result.success).toBe(true);
});
});- Services: 80%+ coverage
- Components: 70%+ coverage
- Utilities: 90%+ coverage
| Command | Description |
|---|---|
npm run dev |
Start development server on port 8080 |
npm run build |
Build for production |
npm run build:dev |
Build with development mode |
npm run preview |
Preview production build |
npm run lint |
Run ESLint |
npm run test |
Run tests in watch mode |
npm run test:run |
Run tests once |
npm run test:coverage |
Generate coverage report |
npm run test:ui |
Run tests with UI |
npm run buildThe optimized build will be in the dist/ directory.
- Push your code to GitHub
- Import project in Vercel
- Add environment variables
- Deploy automatically on push
- Connect your repository
- Build command:
npm run build - Publish directory:
dist - Add environment variables
- Connect your repository
- Build command:
npm run build - Build output directory:
dist - Add environment variables
Ensure these are set in your deployment platform:
VITE_SUPABASE_URL=your_production_supabase_url
VITE_SUPABASE_ANON_KEY=your_production_anon_key
VITE_TWILIO_ACCOUNT_SID=your_twilio_account_sid
VITE_TWILIO_AUTH_TOKEN=your_twilio_auth_token
VITE_TWILIO_PHONE_NUMBER=your_twilio_phone
VITE_APP_URL=https://your-domain.comWe welcome contributions from the community! Whether it's:
- π Bug reports
- π‘ Feature requests
- π Documentation improvements
- π§ Code contributions
-
Fork the repository
-
Create a feature branch
git checkout -b feature/amazing-feature
-
Make your changes
- Follow the existing code style
- Write/update tests
- Update documentation
-
Commit your changes
git commit -m 'Add some amazing feature' -
Push to your branch
git push origin feature/amazing-feature
-
Open a Pull Request
- Code Style: Follow the ESLint configuration
- TypeScript: Use strict typing, avoid
any - Components: Use functional components with hooks
- Testing: Write tests for new features
- Commits: Use clear, descriptive commit messages
- Documentation: Update README for significant changes
For detailed contribution guidelines, see CONTRIBUTING.md.
We're currently focusing on:
- π§ͺ Increasing test coverage
- βΏ Improving accessibility
- π Internationalization (i18n)
- π± Progressive Web App (PWA) features
- π¨ UI/UX enhancements
This project is licensed under the MIT License - see the LICENSE file for details.
- React - UI framework
- Supabase - Backend infrastructure
- shadcn/ui - UI component library
- Tailwind CSS - Styling framework
- Vite - Build tool
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with β€οΈ by the Fretio team