7.1 KiB
7.1 KiB
🗺️ Project Navigation Guide
Welcome! Here's where to find everything you need.
📖 Documentation
Start Here:
- QUICKSTART.md ⭐ - Get up and running in 5 minutes
- README.md - Complete setup and feature guide
- PROJECT_OVERVIEW.md - Full completion checklist
Reference:
- API_DOCUMENTATION.md - All 30+ endpoints
- DATABASE.md - Database schema
📁 Folder Structure
Backend (/backend)
Start here:
.env.example- Copy to.envand update database URLrequirements.txt- Python dependenciesseed.py- Creates tables and sample data
Main app:
app/main.py- FastAPI applicationapp/config.py- Settings
Database:
app/database/database.py- SQLAlchemy setup
Data models:
app/models/user.py- User tableapp/models/product.py- Product tableapp/models/category.py- Category tableapp/models/cart.py- Cart tablesapp/models/order.py- Order tablesapp/models/wishlist.py- Wishlist tableapp/models/contact_message.py- Contact table
API schemas (validation):
app/schemas/user.pyapp/schemas/product.pyapp/schemas/category.pyapp/schemas/cart.pyapp/schemas/order.pyapp/schemas/wishlist.pyapp/schemas/contact.py
Business logic:
app/services/auth.py- Authenticationapp/services/product.py- Product operationsapp/services/cart.py- Cart operationsapp/services/order.py- Order operations
API Routes:
app/routers/auth.py- Registration, loginapp/routers/users.py- User profilesapp/routers/products.py- Product APIapp/routers/categories.py- Category APIapp/routers/cart.py- Shopping cartapp/routers/orders.py- Ordersapp/routers/wishlist.py- Wishlistapp/routers/contact.py- Contact form
Frontend (/frontend)
Start here:
.env.example- Copy to.envpackage.json- NPM dependenciesindex.html- HTML templatevite.config.js- Vite configuration
Main app:
src/App.jsx- Main component with routingsrc/main.jsx- Entry pointsrc/api.js- Axios API client
Layout components:
src/components/Navbar.jsx- Navigation barsrc/components/Footer.jsx- Footer
Product components:
src/components/ProductCard.jsx- Product cardsrc/components/CategoryCard.jsx- Category cardsrc/components/ProductFilters.jsx- Filter sidebarsrc/components/SearchBar.jsx- Search functionality
Pages:
src/pages/Home.jsx- Home pagesrc/pages/Products.jsx- Product listingsrc/pages/ProductDetail.jsx- Product detailssrc/pages/Cart.jsx- Shopping cartsrc/pages/Checkout.jsx- Checkout pagesrc/pages/Login.jsx- Login pagesrc/pages/Register.jsx- Registration pagesrc/pages/Profile.jsx- User profilesrc/pages/Orders.jsx- Order historysrc/pages/Wishlist.jsx- Wishlistsrc/pages/About.jsx- About pagesrc/pages/Contact.jsx- Contact pagesrc/pages/Sales.jsx- Sales page
State management:
src/context/AuthContext.jsx- Authentication statesrc/context/CartContext.jsx- Shopping cart state
Styling:
src/styles/global.css- All styles (responsive design)
🚀 Quick Commands
Backend
# Install dependencies
pip install -r requirements.txt
# Set up database
python seed.py
# Run server
uvicorn app.main:app --reload
# API docs at http://localhost:8000/docs
Frontend
# Install dependencies
npm install
# Run dev server
npm run dev
# Build for production
npm run build
🔑 Key Features by File
Authentication
- Backend:
app/routers/auth.py,app/services/auth.py - Frontend:
src/context/AuthContext.jsx,src/pages/Login.jsx
Shopping Cart
- Backend:
app/models/cart.py,app/services/cart.py - Frontend:
src/context/CartContext.jsx,src/pages/Cart.jsx
Products
- Backend:
app/models/product.py,app/services/product.py - Frontend:
src/components/ProductCard.jsx,src/pages/Products.jsx
Orders
- Backend:
app/models/order.py,app/services/order.py - Frontend:
src/pages/Orders.jsx,src/pages/Checkout.jsx
Search & Filter
- Frontend:
src/components/SearchBar.jsx,src/components/ProductFilters.jsx
Admin Features
- Product CRUD:
app/routers/products.py - Category CRUD:
app/routers/categories.py
🎯 Common Tasks
Add a New Product
Via API:
POST /api/products
{
"name": "Product Name",
"description": "...",
"price": 99.99,
"category_id": 1,
"gender": "men",
"brand": "Brand",
"sizes": ["8", "9", "10"],
"colors": ["Black", "White"],
"stock": 50,
"images": ["url"],
"is_featured": false,
"is_on_sale": false
}
Via database seed:
Edit backend/seed.py and add to products_data list, then run python seed.py
Change Styling
Edit frontend/src/styles/global.css - all styles are here (1200+ lines)
Add a New Page
- Create file in
frontend/src/pages/NewPage.jsx - Add route in
frontend/src/App.jsx:<Route path="/newpage" element={<NewPage />} /> - Add link in navbar or footer
Create New API Endpoint
- Create model in
backend/app/models/ - Create schema in
backend/app/schemas/ - Create service in
backend/app/services/ - Create route in
backend/app/routers/ - Include router in
backend/app/main.py
🐛 Troubleshooting
Can't connect to database?
- Check PostgreSQL is running
- Verify credentials in
.env - See README.md
Frontend not loading?
- Check backend is running on port 8000
- Check
VITE_API_URLin.env
Port already in use?
# Use different port
uvicorn app.main:app --port 8001
npm run dev -- --port 5174
For more: QUICKSTART.md
📚 Learning Resources
FastAPI:
- Official docs: https://fastapi.tiangolo.com/
- Tutorial: https://fastapi.tiangolo.com/tutorial/
React:
- Official docs: https://react.dev/
- Tutorial: https://react.dev/learn
Vite:
- Official docs: https://vitejs.dev/
- Guide: https://vitejs.dev/guide/
PostgreSQL:
- Official docs: https://www.postgresql.org/docs/
- Tutorials: https://www.postgresql.org/docs/current/tutorial.html
💡 Pro Tips
- Use FastAPI docs - Visit
http://localhost:8000/docsto test all endpoints - Browser DevTools - Use Network tab to debug API calls
- React DevTools - Install React extension for debugging
- Database client - Use pgAdmin or DBeaver to view database
📞 Questions?
- Check the relevant documentation file above
- Review comments in the code
- Look at similar implementations in the codebase
- Check API_DOCUMENTATION.md for endpoint details
✅ Next Steps
- Read QUICKSTART.md - 5-minute setup
- Set up backend and frontend following the guide
- Test with demo account (user@example.com / password123)
- Customize branding and content
- Deploy to production
You're all set! Happy coding! 🚀