A full-stack college-based used clothes marketplace where students can buy and sell gently used clothing. Built with FastAPI (Python) backend and Next.js (React/TypeScript) frontend.
- Dual Mode Interface: Toggle between buyer and seller modes
- Product Listings: Upload multiple photos, detailed descriptions, and pricing
- Search & Filter: Find items by category, condition, price range, and keywords
- Real-time Chat: Direct messaging between buyers and sellers
- Dummy Payment System: Simulated credit card checkout flow
- Order Management: Track purchases and sales with order status updates
- User registration and login (imported from email product)
- JWT-based authentication
- Profile management with college affiliation
- Real-time chat system (Alibaba-style)
- Conversation history
- Unread message notifications
- Product-specific inquiries
- Create, read, update, delete listings
- Multiple image uploads (up to 5 per product)
- Category and condition filtering
- View counts and seller statistics
- FastAPI: Modern Python web framework
- SQLAlchemy: ORM for database operations
- SQLite: Lightweight database (easily switchable to PostgreSQL)
- JWT: Token-based authentication
- Bcrypt: Password hashing
- Pydantic: Data validation
- Next.js 14: React framework with App Router
- TypeScript: Type-safe JavaScript
- Tailwind CSS: Utility-first CSS framework
- Axios: HTTP client
- React Hook Form: Form management
- React Hot Toast: Notifications
- Lucide React: Icon library
Sustainability project/
βββ backend/
β βββ routers/
β β βββ auth.py # Authentication endpoints
β β βββ products.py # Product CRUD operations
β β βββ orders.py # Order management & payments
β β βββ messages.py # Chat system
β βββ auth.py # Auth utilities
β βββ config.py # Configuration
β βββ database.py # Database connection
β βββ models.py # SQLAlchemy models
β βββ schemas.py # Pydantic schemas
β βββ main.py # FastAPI application
β βββ init_db.py # Database initialization
βββ frontend/
β βββ app/
β β βββ login/ # Login page
β β βββ register/ # Registration page
β β βββ marketplace/ # Main marketplace
β β β βββ add-product/ # Product creation
β β β βββ product/[id]/# Product detail
β β β βββ checkout/[id]/# Checkout flow
β β β βββ messages/ # Chat interface
β β β βββ orders/ # Order history
β β βββ page.tsx # Landing page
β βββ lib/
β βββ api.ts # API client
β βββ auth.ts # Auth utilities
βββ requirements.txt # Python dependencies
βββ README.md
- Python 3.10+
- Node.js 18+
- npm or yarn
-
Navigate to project directory:
cd "/Users/jb/Desktop/pastor_ai/Sustainability project"
-
Create and activate virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Create environment file:
cp .env.example .env
Note: Email configuration is optional and currently disabled
-
Initialize database:
python -m backend.init_db
-
Run backend server:
uvicorn backend.main:app --reload --port 8000
Backend will be available at:
http://localhost:8000API docs:http://localhost:8000/docs
-
Navigate to frontend directory:
cd frontend -
Install dependencies:
npm install
-
Create environment file:
cp .env.local.example .env.local
-
Run development server:
npm run dev
Frontend will be available at:
http://localhost:3000
- Register/Login: Create an account with your college email
- Browse Products: View all available items on the marketplace
- Search & Filter: Use search bar and filters to find specific items
- View Details: Click on products to see full details and photos
- Contact Seller: Message sellers directly to ask questions
- Purchase: Click "Buy Now" and complete checkout with dummy credit card
- Track Orders: View purchase history in Orders section
- Toggle to Sell Mode: Use the Buy/Sell toggle in the header
- Add Product: Click "Add New Product" button
- Upload 1-5 photos
- Add title, description, price
- Select category, condition, size, brand
- Manage Listings: View all your products and their status
- Respond to Messages: Chat with interested buyers
- Update Order Status: Mark orders as shipped/delivered
- Track Sales: View sales history and statistics
- Use any 16-digit number as a credit card
- Example:
1234 5678 9012 3456 - All payments are simulated and will succeed
POST /api/auth/register- Register new userPOST /api/auth/login- Login userGET /api/auth/me- Get current user infoPUT /api/auth/me- Update profile
GET /api/products/- List all products (with filters)GET /api/products/{id}- Get product detailsGET /api/products/my-products- Get user's listingsPOST /api/products/- Create new productPUT /api/products/{id}- Update productDELETE /api/products/{id}- Delete product
POST /api/orders/- Create order (purchase)GET /api/orders/my-purchases- Get purchase historyGET /api/orders/my-sales- Get sales historyPUT /api/orders/{id}/status- Update order status
POST /api/messages/- Send messageGET /api/messages/conversations- Get all conversationsGET /api/messages/with/{user_id}- Get messages with userGET /api/messages/unread-count- Get unread count
β Buyer and seller modes β Product listings with images β Direct chat between buyers and sellers β Search and filtering β Order management β User profiles β Payment processing (dummy)
- Email verification (currently disabled)
- Real payment gateway integration (Stripe, PayPal)
- Image optimization and CDN
- Push notifications
- Rating and review system
- College-based filtering
- Advanced search with Elasticsearch
- Mobile app (React Native)
- Real-time WebSocket chat
- Admin dashboard
- Import errors: Make sure you're in the project root and virtual environment is activated
- Database errors: Delete
marketplace.dband runpython -m backend.init_dbagain - Port already in use: Change port in uvicorn command
- Module not found: Run
npm installagain - API connection failed: Ensure backend is running on port 8000
- Image upload fails: Check
uploads/directory exists
- Authentication logic imported from email product as requested
- Email verification temporarily disabled (email config left blank)
- SQLite used for easy setup (production should use PostgreSQL)
- Images stored locally (production should use cloud storage like AWS S3)
- Chat polling every 3 seconds (production should use WebSockets)
MIT License - Feel free to use for educational purposes
For issues or questions, please check the troubleshooting section or review the API documentation at http://localhost:8000/docs
Built with β€οΈ for college sustainability