The API is live and accessible here:
π https://studentmarketplace-peog.onrender.com
PLEASE NOTE:
β οΈ This is a pre-release version (v0.1.0-beta)
β οΈ URL may change in future production deployments
graph TD
A[StudentMarketPlace] --> B[Core Features]
A --> C[Tech Stack]
A --> D[Architecture]
A --> E[Deployment]
style A fill:#4e89ae,stroke:#333,stroke-width:2px,color:#fff
style B fill:#ed6663,stroke:#333
style C fill:#ffa372,stroke:#333
style D fill:#44a1a0,stroke:#333
style E fill:#ffd166,stroke:#333
StudentMarketPlace is a university-focused marketplace platform that enables students to buy, sell, and trade items within their campus community. Built with modern security practices and a scalable architecture, this platform helps students save money while promoting sustainability through reuse of textbooks, electronics, furniture, and other campus essentials.
This diagram gives a quick overview of how different parts of the system interact:
- π Smart Listings - Create listings with rich descriptions, multiple images, and category tagging
- π Intelligent Search - Filter by price range, condition, category, and campus proximity
- π¬ In-App Messaging - Secure communication between buyers and sellers
- π Analytics Dashboard - Real-time insights for administrators
- π Auth System - JWT-based authentication with password recovery
graph LR
A[User] --> B[JWT Auth]
B --> C[RBAC]
C --> D[API Validation]
D --> E[Rate Limiting]
E --> F[Encrypted Storage]
- Role-Based Access Control (RBAC)
- JWT token revocation system
- Input validation for all API endpoints
- Rate limiting and brute-force protection
- Secure password storage with bcrypt
graph LR
A[Flask] --> B[SQLAlchemy ORM]
A --> C[Marshmallow Schemas]
A --> D[Flask-JWT-Extended]
A --> E[Flask-RESTful]
B --> F[PostgreSQL]
D --> G[Redis Token Blocklist]
style A fill:#44a1a0,stroke:#333
style B fill:#ffa372,stroke:#333
style C fill:#ed6663,stroke:#333
style D fill:#ffd166,stroke:#333
style E fill:#4e89ae,stroke:#333
Core Components:
- Python 3.11+ - Primary backend language
- Flask - Lightweight web framework
- SQLAlchemy - Database ORM and migration management
- PostgreSQL - Primary relational database
- Redis - Token revocation store and caching
- Docker - Containerization for consistent environments
π¦ API-Core/
βββ π app/
β βββ π blueprints/ # π¦ Modular route groups
β β βββ π auth/ # π Auth routes
β β βββ π items/ # π Item listing routes
β β βββ π messages/ # π¬ Messaging routes
β βββ π schemas/ # π Marshmallow schemas (validation)
β βββ π services/ # π§ Business logic layer
β βββ π models/ # ποΈ SQLAlchemy models
β βββ π extensions.py # π Init db, jwt, cors
β βββ π __init__.py # π οΈ create_app() factory
βββ π infra/
β βββ π docker-compose.yml # π³ Docker services config
β βββ π nginx.conf # π Reverse proxy config
βββ π postman/
β βββ π MarketplaceAPI.postman_collection.json # π¬ API collection for testing
βββ π run.py # π App runner
βββ π requirements.txt # π¦ Python dependenciesπ¦ Required Tools
βββ π Python 3.11+
βββ π PostgreSQL 14+
βββ π§ Redis 6+
βββ π³ Docker 20.10+
βββ π¦ Node.js 18+ (for frontend)# Clone the repository
git clone https://github.com/Flow-Pie/StudentMarketPlace.git
cd StudentMarketPlace
# Set up backend environment
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
# Configure environment
cp .env.example .envCreate .env file with:
# π Application Settings
APP_ENV=development
DEBUG=True
# ποΈ Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_NAME=marketplace
DB_USER=marketplace_user
DB_PASSWORD=secure_password
# π JWT Configuration
JWT_SECRET_KEY=your_secure_secret_here
JWT_ACCESS_TOKEN_EXPIRES=3600 # 1 hour
JWT_REFRESH_TOKEN_EXPIRES=2592000 # 30 days
# π§ Redis Configuration
REDIS_URL=redis://localhost:6379/0# Initialize database
flask db upgrade
# Start backend server
flask run --host=0.0.0.0 --port=5000
# Start Redis service
docker run -d -p 6379:6379 redis:alpinegraph TD
A[Testing Pyramid] --> B1[Unit Tests: 60%]
A --> B2[Integration Tests: 30%]
A --> B3[E2E Tests: 10%]
# Run Python tests with coverage
pytest --cov=app --cov-report=html
# Run security scans
bandit -r app
safety check
# Generate code quality report
flake8 appπ Code Linters
βββ Flake8 (Python)
βββ ESLint (JavaScript)
βββ MarkdownLint (Documentation)
π¨ Code Formatters
βββ Black (Python)
βββ Prettier (Frontend)
π‘οΈ Security Scanners
βββ Bandit
βββ SafetyExplore our interactive API documentation at http://localhost:5000/ after starting the server.
POST /api/auth/login
Content-Type: application/json
{
"email": "student@university.edu",
"password": "securePassword123!"
}GET /api/items?category=BOOKS&min_price=10&max_price=50
Authorization: Bearer <access_token>sequenceDiagram
Client->>API: POST /items/123/images (invalid token)
API->>Client: 401 Unauthorized (TOKEN_INVALID)
Client->>API: POST /items/123/images (valid token)
API->>DB: Check item ownership
DB->>API: Item belongs to user B
API->>Client: 403 Forbidden (PERMISSION_DENIED)
# docker-compose.yml
version: '3.8'
services:
web:
build: .
command: flask run --host=0.0.0.0 --port=5000
volumes:
- .:/app
ports:
- "5000:5000"
environment:
- DB_HOST=db
- REDIS_URL=redis://redis:6379/0
depends_on:
- db
- redis
db:
image: postgres:14
environment:
POSTGRES_DB: marketplace
POSTGRES_USER: marketplace_user
POSTGRES_PASSWORD: db_password
volumes:
- postgres_data:/var/lib/postgresql/data
redis:
image: redis:6
volumes:
postgres_data:# Deploy to Heroku
heroku create
heroku addons:create heroku-postgresql:hobby-dev
heroku addons:create heroku-redis:hobby-dev
git push heroku main
# Deploy to AWS ECS
ecs-cli configure --cluster marketplace-cluster
ecs-cli compose --project-name marketplace service up# π Contributing Guide
*Crafting Excellence in Our Second-Hand Marketplace API*
+ π First time contributor? Start with "Good First Issue" tasks!
- βΌοΈ Never push to main/dev directly graph TD
A[GitHub Issue] --> B[Create Branch from DEV]
B --> C[Feature Work]
B --> D[Hotfix Work]
C --> E[Open PR β DEV]
D --> E
E --> F[Code Review]
F --> G[CI/CD Pipeline]
G --> H[QA Testing]
H --> I[PROD]
| Label Type | Branch Format | Example |
|---|---|---|
Feature |
feature/[LABEL]-desc |
feature/auction-bid-system |
Bug |
hotfix/[LABEL]-issue |
hotfix/user-auth-401 |
Experiment |
spike/[LABEL]-poc |
spike/redis-caching |
Refactor |
refactor/[LABEL]-area |
refactor/item-search |
git commit -m "feat(notifications): β¨ add push notification service" -m "
- Integrated Firebase Cloud Messaging
- Added rate limiting
- Created documentation in /docs/notifications.md
"| Emoji | Type | Description |
|---|---|---|
| β¨ | feat | New feature |
| π | fix | Bug fix |
| π | docs | Documentation improvements |
| π | perf | Performance optimization |
| π | security | Security-related changes |
This project is licensed under the Apache License - see the LICENSE file for details.
π¬ Contact Options βββ βοΈ Email: startabase@gmail.com βββ π¬ Slack: #student-marketplace-support βββ π GitHub Issues: GitHub Issues
π¬ Contact Options
βββ βοΈ Email: startabase@gmail.com
βββ π¬ Slack: #student-marketplace-support
βββ π GitHub Issues