Skip to content

Latest commit

 

History

History
151 lines (124 loc) · 6.09 KB

File metadata and controls

151 lines (124 loc) · 6.09 KB

Recycle logo Recycle Marketplace

A modern fullstack web application for buying and selling bicycles. Users can browse products, manage favorites, send messages to sellers, and more.

Live Demo: https://recycle-marketplace.vercel.app/

Features

  • User authentication with JWT tokens
  • Rate limiting for security (5 login attempts/minute)
  • User profiles and product management
  • Product listing and browsing
  • Seeding scripts for test data with Unsplash API images
  • Favorites system
  • Stored Procedures for optimized database operations
  • Audit data for tracking changes
  • Messaging between users
  • Advanced search and filtering
  • Admin dashboard with analytics and CRUD operations
  • Responsive design for mobile and desktop

Tech Stack

Frontend

React Vite TailwindCSS MUI React Router Zustand Eslint

Backend & Database

Python FastAPI Uvicorn MySQL SQLAlchemy Alembic Pydantic JWT

DevOps & Cloud

Docker Azure Github GitHub Actions Vercel

Getting Started

Prerequisites

  • Docker and Docker Compose installed
  • Node.js 20+ (for local frontend development)
  • Python 3.13+ (for local backend development)

Copy .env.example to .env and set your environment variables for BOTH /frontend and /backend.

Start the Application

# Start whole platform (frontend, backend, and database)
docker-compose up --build -d

# Stop all services
docker-compose down

Seed the Database

The MySQL database is automatically seeded with test data during application startup:

  • 👤 Sample users ([email protected] / admin123)
  • 📦 Product categories and details
  • 🚴 Test products with images and price history
  • 💬 Sample conversations and favorites

Manual seeding (if needed):

cd backend
poetry install
poetry run python scripts/seed.py

Access Points

Service URL Description
Frontend http://localhost:5173 React application
Backend API http://localhost:8000 FastAPI server
API Docs (Swagger) http://localhost:8000/docs Interactive API documentation
API Docs (ReDoc) http://localhost:8000/redoc Alternative API docs

Project Structure

├── frontend/          # React application with Vite, Tailwind and MUI
│   └── src/
│
├── backend/           # Python FastAPI app
│   ├── app/
│   │   ├── main.py         # Application entry point
│   │   ├── db/             # Database configuration
│   │   ├── models/         # Database models
│   │   ├── repositories/   # Data access layer
│   │   ├── routers/        # API routes
│   │   ├── schemas/        # Pydantic schemas
│   │   └── services/       # Business logic
│   ├── alembic/            # Database migrations
│   ├── scripts/            # Utility scripts (seeding, etc.)
│   └── tests/              # Backend tests
│
└── docker-compose.yml      # Container orchestration

🔐 Default Credentials

For testing purposes, use these credentials:

Static tests

Kør disse inden push

poetry run safety scan
poetry run bandit -r app
poetry run ruff check .
poetry run mypy app

End-to-end test

  • Cd \frontend
  • Kør:npm run test:e2e
  • Kør en fil: npm run test:e2e -- e2e/messaging.spec.js
  • Kør en test: npm run test:e2e -- e2e/messaging.spec.js -g "User can contact seller and send a quick message"

Performance tests (k6)

  • Kræver backend kørende (default http://localhost:8000, kan overstyres med BASE_URL).

  • Lokal k6:

    • k6 run --env BASE_URL=http://localhost:8000 performance-tests/load.js
    • k6 run --env BASE_URL=http://localhost:8000 performance-tests/spike.js
    • k6 run --env BASE_URL=http://localhost:8000 performance-tests/stress.js
    • k6 run --env BASE_URL=http://localhost:8000 performance-tests/soak.js
  • Nuværende mål:

    • Load: p95 < 2s @ 50 VU
    • Spike: p95 < 6s @ 150 VU
    • Stress: p95 < 4.5s @ 150 VU
    • Soak: 20 VU i 1 time (overvåg for fejlrate/drift)

Code Coverage

  • Backend: poetry run pytest --cov=app --cov-report=html --cov-report=term and `poetry run coverage
  • Frontend: npx vitest --run --coverage