A full-stack web application to help students find lost items and return found items on campus.
- User Authentication: JWT-based registration, login, email verification, and password reset
- Item Reporting: Report found or lost items with photos and details
- Item Claims: Students can claim items they lost; admins approve/reject claims
- Search & Filter: Search by name, category, location, or status
- Admin Dashboard: Manage claims, view audit logs, approve/reject claims
- Audit Logging: Track all claim approvals and status changes
- Responsive UI: Modern, mobile-friendly interface with Tailwind CSS
- Docker Support: Complete Docker & docker-compose setup for easy deployment
- CI/CD: GitHub Actions workflow for automated testing and builds
Backend:
- Django 4.2 + Django REST Framework
- JWT Authentication (simplejwt)
- SQLite (dev) / PostgreSQL (production)
- Gunicorn WSGI server
Frontend:
- React 18 with TypeScript
- Vite (fast build tool)
- Tailwind CSS (styling)
- React Router (routing)
- Axios (HTTP client)
- Zustand (state management)
DevOps:
- Docker & Docker Compose
- Nginx (reverse proxy)
- GitHub Actions (CI/CD)
- PostgreSQL 15 (production database)
campusfind/
βββ backend/ # Django project root
β βββ main_core/ # Django settings & URL config
β βββ users/ # User authentication app
β βββ items/ # Lost/found items app
β βββ claims/ # Claims management app
β βββ reports/ # Item reports app
β βββ categories/ # Item categories
β βββ locations/ # Campus locations
β βββ audit/ # Audit logging
β βββ manage.py
β βββ requirements.txt
β βββ tests/ # Test files
βββ frontend/ # React app
β βββ src/
β β βββ pages/ # Page components
β β βββ components/ # Reusable components
β β βββ services/ # API client
β β βββ stores/ # State management
β β βββ styles/ # Global styles
β β βββ App.tsx
β βββ package.json
β βββ vite.config.ts
β βββ Dockerfile
βββ sql/ # Database schema & seed data
β βββ campusfind_schema_and_seed.sql
βββ .github/workflows/ # CI/CD workflows
β βββ ci.yml
βββ docker-compose.yml # Multi-container setup
βββ Dockerfile # Backend container
βββ nginx.conf # Nginx reverse proxy
βββ .env.example
βββ README.md
-
Clone & navigate
git clone <repo-url> cd campusfind
-
Create virtual environment
python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Create .env file
cp .env.example .env # Edit .env with your settings -
Run migrations
python manage.py migrate
-
Load sample data
python manage.py load_sample_data
-
Create superuser
python manage.py createsuperuser
-
Start backend
python manage.py runserver
Backend: http://localhost:8000
-
Navigate to frontend
cd frontend -
Install dependencies
npm install
-
Create .env.local
cp .env.example .env.local
-
Start dev server
npm run dev
Frontend: http://localhost:5173
# Build and run all services
docker-compose up -d
# View logs
docker-compose logs -f backend
docker-compose logs -f frontend
# Stop services
docker-compose downServices:
- Backend: http://localhost:8000/api/
- Frontend: http://localhost:5173
- Admin: http://localhost:8000/admin/
- Database: PostgreSQL on localhost:5432
- Swagger UI: http://localhost:8000/api/docs/
- ReDoc: http://localhost:8000/api/redoc/
- OpenAPI Schema: http://localhost:8000/api/schema/
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/users/ |
Register new user |
| POST | /api/token/ |
Get JWT tokens |
| GET | /api/items/ |
List all items |
| POST | /api/items/ |
Create new item |
| GET | /api/items/found_items/ |
List found items |
| POST | /api/claims/ |
Create claim |
| GET | /api/claims/pending/ |
List pending claims (admin) |
| POST | /api/claims/{id}/approve/ |
Approve claim (admin) |
| GET | /api/audit/ |
View audit logs (admin) |
- Login: Send email/password β get access & refresh tokens
- Authenticated Requests: Include
Authorization: Bearer <access_token>header - Token Refresh: When access token expires, use refresh token to get new one
- Logout: Clear tokens from client storage
Current Implementation: Tokens stored in localStorage
- β Easy to implement
- β Vulnerable to XSS attacks
Recommended for Production:
- Use httpOnly cookies (backend sets, browser doesn't expose to JS)
- Implement CSRF protection
- Add token rotation
To implement httpOnly cookies, modify:
- Backend: Set cookies in response instead of returning tokens
- Frontend: Remove manual token management; browser handles cookie automatically
- Axios: Configure to send cookies with requests
- student: Student user accounts
- admin: Administrator accounts
- category: Item categories (Electronics, Books, etc.)
- location: Campus locations/buildings
- item: Lost/found items
- report: Reports for items
- claim: Student claims on items
- audit: Audit log of actions
- lost_items_view: All lost items with details
- student_history_view: Student's reported items
- unclaimed_found_items_view: Found items with pending claims count
python manage.py testcd frontend
npm run test:unitTests run automatically on push/PR to main/develop branches. See .github/workflows/ci.yml
# Django
SECRET_KEY=your-secret-key-here
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1
# JWT
JWT_SECRET_KEY=your-jwt-secret-key
# Database
DATABASE_URL=sqlite:///db.sqlite3
# For PostgreSQL: postgresql://user:pass@localhost/dbname
# Email (Gmail example)
EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=your-email@gmail.com
EMAIL_HOST_PASSWORD=your-app-password
DEFAULT_FROM_EMAIL=noreply@campusfind.com
# CORS
CORS_ALLOWED_ORIGINS=http://localhost:5173,http://localhost:3000VITE_API_URL=http://localhost:8000/api- Update SQL schema: Add to
item_typeenum - Backend: No change needed (already supports custom types)
- Frontend: Update filter options
- Add field to
Studentmodel - Run migration:
python manage.py makemigrations - Run migration:
python manage.py migrate - Update serializers and forms
python manage.py createsuperuser
# Access at http://localhost:8000/admin/# Remove old database
rm db.sqlite3
# Migrate and seed
python manage.py migrate
python manage.py load_sample_data# Set environment variables in platform dashboard
# Run migrations on deploy
python manage.py migrate
# Use Gunicorn
gunicorn main_core.wsgi:application
# Collect static files
python manage.py collectstatic --noinput# Build
npm run build
# Deploy dist/ folder
# Set environment variables in platform dashboard:
# VITE_API_URL=https://your-backend.com/api- Backend: Change
DATABASE_URLto PostgreSQL connection string - Update Django settings: Already configured in settings.py
- Create database:
createdb campusfind - Run migrations:
python manage.py migrate
Uncomment HTTPS section in nginx.conf and provide certificates.
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push:
git push origin feature/amazing-feature - Open Pull Request
This project is licensed under the MIT License - see LICENSE file for details.
| Issue | Solution |
|---|---|
| Backend won't connect | Ensure Django running on 8000, check CORS settings |
| Can't login | Verify user exists in DB, check JWT_SECRET_KEY |
| 404 on API | Check URL routing in urls.py |
| Migrations conflict | Delete migrations, start fresh |
| CORS errors | Update CORS_ALLOWED_ORIGINS in .env |
| Docker build fails | Delete docker images, rebuild: docker-compose build --no-cache |
For issues or questions:
- Check GitHub Issues
- Review API documentation
- Check logs:
docker-compose logs backend
Happy coding! π