You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Campus Hub 2.0 is a modern, production-grade web application for campus communities, built with Flask, SQLAlchemy ORM, and Supabase (PostgreSQL for data, Supabase Storage for images). It is designed with best practices for security, scalability, and maintainability, and is fully cloud-native and container-ready. The app is deployed on Render with automated CI/CD, secret management, and robust error handling.
Key Platforms
Lost & Found: Report, search, and manage lost or found items.
Marketplace: Post, browse, and manage items for sale or rent.
Industry-Grade Features
Authentication & Authorization:
Secure registration and login with hashed passwords (Werkzeug)
Email verification via Flask-Mail
Role-based access control (admin, student, guest)
Persistent sessions with Flask-Session
Cloud-Native Storage:
PostgreSQL (Supabase) for all data
Supabase Storage for all images (no local storage)
Image Handling:
Direct upload to Supabase Storage
Strict validation (PNG, JPG, JPEG, WEBP)
Public URLs for images
Feedback & Comments:
Users can comment and rate items on both platforms
Admin Utilities:
Category management
Default admin account (admin/admin123)
User and item moderation
Security:
Password hashing (Werkzeug)
CSRF protection (Flask-WTF)
Session security (Flask-Session, secret key)
Email credentials and secrets managed via environment variables or Render Secret Files
No sensitive data in codebase
Error Handling:
Custom 404 and 500 error pages
Logging for startup, DB connection, and errors
Deployment:
Dockerized for local and cloud deployment
Infrastructure-as-code with render.yaml
Automated deployment to Render on every push
Secret management and environment variables via Render dashboard
Extensibility:
Modular Flask blueprints
Easily add new features (e.g., events, forums, notifications)
Documentation:
Well-structured, developer-friendly codebase
Clear setup, configuration, and extension instructions
All configuration values are managed in .env and config.py. Key settings include:
Key
Description
POSTGRES_URI
PostgreSQL connection string (Supabase)
SUPABASE_URL
Supabase project URL
SUPABASE_KEY
Supabase service key
SUPABASE_LOSTFOUND_BUCKET
Supabase Storage bucket for lost/found images
SUPABASE_MARKETPLACE_BUCKET
Supabase Storage bucket for marketplace images
MAIL_SERVER, MAIL_PORT
SMTP server and port
MAIL_USERNAME, MAIL_PASSWORD
Email credentials for Flask-Mail
SECRET_KEY
Flask secret key (change for production)
SESSION_TYPE, SESSION_FILE_DIR, SESSION_PERMANENT
Flask-Session settings
Database Schema (PostgreSQL via SQLAlchemy ORM)
Tables & Fields
1. user
Column
Type
Description
id
INTEGER
Primary key
username
TEXT
Unique username
password
TEXT
Hashed password
email
TEXT
Unique user email
role
TEXT
User role (admin, student, guest)
created_at
DATETIME
Timestamp of registration
is_admin
BOOLEAN
True if user is an admin
is_confirmed
BOOLEAN
True if email is verified
2. lost_found_item
Column
Type
Description
id
INTEGER
Primary key
name
TEXT
Name/title of the item
description
TEXT
Detailed description
category
TEXT
Category name
status
TEXT
"lost" or "found"
priority
INTEGER
Priority level
date
DATE
Date when reported
location
TEXT
Location details
contact_info
TEXT
Contact details
latitude
REAL
Latitude coordinate (optional)
longitude
REAL
Longitude coordinate (optional)
user_id
INTEGER
Foreign key to user.id
found_by
INTEGER
User ID who found the item
claimed_by
INTEGER
User ID who claimed the item
is_deleted
BOOLEAN
Soft delete flag
3. marketplace_item
Column
Type
Description
id
INTEGER
Primary key
name
TEXT
Name/title of the item
description
TEXT
Detailed description
price
NUMERIC
Price of the item
category
TEXT
Category name
condition
TEXT
Condition (e.g., "New", "Used")
status
TEXT
"available", "sold", or "rented"
date
DATE
Date when posted
location
TEXT
Location details
contact_info
TEXT
Contact details of seller
user_id
INTEGER
Foreign key to user.id
is_deleted
BOOLEAN
Soft delete flag
4. category
Column
Type
Description
id
INTEGER
Primary key
name
TEXT
Category name
type
TEXT
Either lost_found or marketplace
description
TEXT
Category description (optional)
5. item_image
Column
Type
Description
id
INTEGER
Primary key
item_type
TEXT
'lost_found' or 'marketplace'
item_id
INTEGER
ID of the associated item
image_url
TEXT
Public URL in Supabase Storage
uploaded_at
DATETIME
Timestamp of upload
6. feedback
Column
Type
Description
id
INTEGER
Primary key
user_id
INTEGER
Foreign key to user.id
item_type
TEXT
Either lost_found or marketplace
item_id
INTEGER
ID of the associated item
comment
TEXT
Userβs feedback or comment
rating
INTEGER
Optional rating
date
DATETIME
Timestamp when comment was posted
Core Functionality
All database operations and core logic are implemented in models.py using SQLAlchemy ORM. All image uploads are handled via Supabase Storage. The app is structured for maintainability and extensibility, following best practices for separation of concerns and modularity.
Usage Guide
1. User Registration & Login
Register a new account or use the default admin:
Username: admin
Password: admin123
Email verification is required β check your inbox for the confirmation link.
Log in to access both Lost & Found and Marketplace platforms.
2. Lost & Found Platform
Add Item: Click βAdd Lost/Found Itemβ, fill in details (name, description, category, status, location), and upload an image.
Browse/Search: Use filters (category, status) and sorting to find items.
Comment: Click on an item to view details and add feedback/comments.
3. Marketplace Platform
Add Item: Navigate to βAdd Marketplace Itemβ, fill in details (name, description, price, category, condition), and upload an image.
Browse/Search: Filter by category, price range, or condition to find listings.
Comment: Click on a listing to view details and leave feedback or inquiries.
4. Admin Dashboard
Log in as admin to access special utilities:
Manage categories and users.
Edit or delete any user, lost/found item, or marketplace item.
Security & Best Practices
Password Hashing: Passwords are securely hashed using Werkzeug.
Session Security: Sessions are stored on the filesystem (Flask-Session) with a secret key.
CSRF Protection: Enabled via Flask-WTF for all forms.
Image Uploads:
Restricted to allowed extensions (png, jpg, jpeg, webp).
Images are uploaded directly to Supabase Storage.
Email Verification: SMTP credentials are kept in environment variables or .env (never committed).
Configuration Management: All sensitive data is managed via environment variables or Render Secret Files.
Error Handling: Custom error pages and logging for all critical operations.
Cloud-Native Deployment: Fully containerized, with automated deployment and secret management on Render.
Extending the App
Add New Blueprints: Create additional Flask blueprints for new features (e.g., Events, Forums).
Extend Models & Templates:
Add new fields or tables in models.py and update related templates.
Customize HTML/CSS in templates/ and static/.
Advanced Search & Analytics: Integrate full-text search or analytics tools.
Notifications: Add real-time notifications using WebSockets (Flask-SocketIO).
REST API Endpoints: Expose CRUD operations via a RESTful API (Flask-RESTful or Flask-API).
Deployment
Render (Recommended)
Cloud-native deployment using Render, with infrastructure-as-code via render.yaml.
Automated builds and deploys on every push to the main branch.
Secret management via Render dashboard or Secret Files.
Health checks and logging via Render dashboard.
Scalable and production-ready out of the box.
Steps:
Commit and push your code (including render.yaml) to GitHub.
Create a new Web Service on Render and connect your repo.
Set environment variables and/or upload your .env as a Secret File.
An enhanced, industry-grade version of my DBMS project with: πΉ Modular Flask backend using Blueprints π³ Docker & docker-compose for deployment ποΈ Supabase for database & media storage βοΈ Email support via Gmail SMTP π .env for secure config management π Ready for cloud deployment (Render)