Lost-It is a full-stack web app that helps students get lost things back, built as a campus Lost & Found Office:
- ๐ฆ The Found Room. Found items are sorted into 3D cardboard boxes, one per category. Hover a box and its flaps lift while the items peek out. Click it to open the box and browse a catalogue of everything inside.
- ๐ The Wanted Board. Lost items become bounty-style WANTED posters nailed to a wooden wall, with a reward.
- ๐ Smart matching links posters to boxed items automatically, and people message each other inside the app.
- โ Admins moderate posts, block users, manage categories and places, and see dashboard charts.
- โ๏ธ / ๐ Day & Night themes. One click swaps the whole palette: a sunny notebook-paper look by day, an indigo late-night-library look by night (the Found Room's bulb even switches on).
Tech stack: Python ยท Flask (REST API) ยท MySQL ยท React (Vite) ยท pure CSS 3D (no 3D libraries)
Click the button to run the whole app (Flask + MySQL + React) in your browser. Nothing to install. See Run it in GitHub Codespaces below.
| Feature | What it does |
|---|---|
| ๐ Accounts & roles | Sign up / log in, passwords hashed with Werkzeug, JWT tokens, two roles: user and admin |
| ๐ฆ Found Room | Category boxes built from 6 CSS faces; flaps animate open; a catalogue per box with search and filters |
| ๐ Wanted Board | Parchment bounty posters with photo, last-seen place, date and reward |
| ๐ Report form | Live preview of your poster or claim tag as you type, plus optional photo upload |
| ๐ค Smart matching | Scores lost โ found items by category, place, date and shared keywords |
| ๐ฌ Messaging | Contact the finder or owner without sharing phone numbers, with an unread badge |
| โ Case closed | Owners (or admins) mark items returned, and they get a RECOVERED / CLAIMED stamp |
| โ Admin desk | Stats, charts by category and location, block/unblock users, promote admins, moderate items, manage categories and places |
| โ๏ธ๐ Themes | Day/Night toggle with its own colour palette for each mode, remembered per browser; follows the device setting on first visit |
| ๐ฑ Mobile | App-style bottom tab bar on phones |
| User | Admin | |
|---|---|---|
| Post, browse, search, see matches, message | โ | โ |
| Close / delete own items | โ | โ |
| Close / delete any item | โ | โ |
| Block / unblock users, make admins | โ | โ |
| Add / delete categories and places | โ | โ |
| Admin dashboard | โ | โ |
| Read other people's messages | โ | โ (privacy) |
Roles are enforced in the backend with two custom Python decorators in backend/auth_utils.py:
@bp.post("")
@user_required # logged in AND not blocked
def create_item(): ...
@bp.get("/stats")
@admin_required # logged in, not blocked, AND role == 'admin'
def dashboard(): ...The role and blocked status are read from the database on every request, so blocking someone takes effect immediately, even if they're already logged in.
For every item, Lost-It looks at open items of the opposite type in the same category within 30 days, then scores them:
| Rule | Points |
|---|---|
| Same category (required) | 40 |
| Same location | 30 |
| Shared keywords in title/description | up to 20 (7 per word) |
| Dates within 3 days / 7 days | 10 / 5 |
Items scoring 50 or more are shown, best first, with the reasons listed. See backend/routes/matching.py.
flowchart LR
U[Browser<br/>React app] -- "fetch /api/... (JSON + JWT)" --> F[Flask REST API]
F -- "@user_required / @admin_required" --> F
F -- "SQL via PyMySQL" --> D[(MySQL<br/>lost_it)]
F -- "save / serve" --> I[/uploads folder<br/>item photos/]
erDiagram
USERS ||--o{ ITEMS : posts
CATEGORIES ||--o{ ITEMS : groups
LOCATIONS ||--o{ ITEMS : "lost/found at"
ITEMS ||--o{ MESSAGES : "is about"
USERS ||--o{ MESSAGES : sends
USERS ||--o{ MESSAGES : receives
USERS {
int id PK
varchar name
varchar email UK
varchar password_hash
varchar phone
enum role "user | admin"
boolean is_active
timestamp created_at
}
CATEGORIES {
int id PK
varchar name UK
varchar icon
}
LOCATIONS {
int id PK
varchar name UK
}
ITEMS {
int id PK
int user_id FK
enum type "lost | found"
varchar title
text description
int category_id FK
int location_id FK
date item_date
varchar image
varchar reward
enum status "open | resolved"
timestamp created_at
}
MESSAGES {
int id PK
int item_id FK
int sender_id FK
int receiver_id FK
text body
boolean is_read
timestamp created_at
}
Full SQL: backend/schema.sql
lost-it/
โโโ backend/ Flask + MySQL API (Python)
โ โโโ app.py App setup, blueprints, image serving
โ โโโ config.py Settings loaded from .env
โ โโโ db.py MySQL connection + query helpers
โ โโโ auth_utils.py @user_required / @admin_required decorators
โ โโโ schema.sql Tables + categories/locations
โ โโโ init_db.py Creates the database from schema.sql
โ โโโ seed.py Demo students, items, messages + the admin from .env
โ โโโ make_admin.py Promote an account to admin
โ โโโ routes/
โ โ โโโ auth.py /api/auth register, login, me
โ โ โโโ items.py /api/items browse, post, matches, resolve, delete
โ โ โโโ matching.py Match-scoring logic
โ โ โโโ messages.py /api/messages private chat
โ โ โโโ meta.py /api/meta, /api/stats, /api/found-room
โ โ โโโ admin.py /api/admin dashboard, users, categories, places
โ โโโ uploads/ Uploaded photos
โโโ frontend/ React (Vite)
โโโ src/
โโโ api.js fetch wrapper (adds JWT token)
โโโ AuthContext.jsx Logged-in user state
โโโ confetti.js ๐ when an item is marked returned
โโโ components/ CrateBox (3D box), WantedPoster, FoundCard, MatchBadge,
โ Navbar, ThemeToggle, PageHeader
โโโ pages/ Home, FoundRoom, FoundBox, WantedBoard, ItemDetail,
โ PostItem, MyItems, Messages, Admin, Login, Register
โโโ styles/
โโโ tokens.css fonts, spacing, and the Day + Night colour themes
โโโ base.css buttons, form fields, chips, stamps
โโโ layout.css top bar, mobile tab bar, page headers, scenes, footer
โโโ home.css home page
โโโ crate.css the 3D cardboard box
โโโ poster.css the WANTED poster
โโโ cards.css found-item cards + match badges
โโโ pages.css item page, report form, login pass, chat
โโโ admin.css admin desk + charts
- On the repo page click Code โ Codespaces โ Create codespace on main (or the button at the top of this README).
- Wait 2โ4 minutes the first time. The Codespace installs Python, Node and MySQL, creates the database and loads the demo data (
.devcontainer/setup.sh). - Flask and React start by themselves in two terminals, and the site opens on port 5173.
- To share it: open the Ports tab, right-click port 5173 โ Port Visibility โ Public, and copy the link.
The Codespace stops itself after about 30 minutes of inactivity. Reopen it from the Code โ Codespaces menu and everything is still there.
Admin password in Codespaces: add a Codespaces secret named ADMIN_PASSWORD (GitHub Settings โ Codespaces โ Secrets, allowed for this repo) before creating the Codespace. If you don't, a random admin password is generated. It's printed at the end of the creation log and saved in backend/.env inside the Codespace.
You need: Python 3.10+, Node.js 18+, MySQL 8 running locally.
cd backend
python -m venv .venv
.venv\Scripts\activate # Windows (macOS/Linux: source .venv/bin/activate)
pip install -r requirements.txt
copy .env.example .env # macOS/Linux: cp .env.example .env
# open .env and set your MySQL password (and port, if it isn't 3306),
# plus ADMIN_NAME / ADMIN_EMAIL / ADMIN_PASSWORD for the admin account
python init_db.py # creates the lost_it database and tables
python seed.py # adds demo students + creates the admin from .env
python app.py # API runs on http://localhost:5000In a second terminal:
cd frontend
npm install
npm run dev # open http://localhost:5173The React dev server forwards /api and /uploads to Flask, so both run together without extra setup.
| Name | Password | Role | |
|---|---|---|---|
| admin1 | admin1@campus.edu | whatever ADMIN_PASSWORD is in your .env |
admin |
| Asha Menon | asha@campus.edu | demo1234 | user |
| Rahul Nair | rahul@campus.edu | demo1234 | user |
| Fathima K | fathima@campus.edu | demo1234 | user |
| Arjun Das | arjun@campus.edu | demo1234 | user |
The admin password lives only in .env, which is git-ignored, so it never ends up on GitHub. Change it in .env and run python seed.py again to update it.
To make any other account an admin: python make_admin.py someone@campus.edu
Try this: open the Found Room and click the Electronics box. Then log in as Asha (the login page has a "Fill in a demo student" button), open the Black JBL wireless earphones poster, and scroll to Possible sightings. Rahul's found earbuds are a 100% match. Flip the โ๏ธ/๐ switch in the top bar to see both themes.
| Method | Endpoint | Access | Description |
|---|---|---|---|
| POST | /api/auth/register |
public | Create account โ token |
| POST | /api/auth/login |
public | Log in โ token (blocked users refused) |
| GET | /api/auth/me |
user | Current user |
| GET | /api/items?type=&category=&location=&q=&status= |
public | Browse / search items |
| POST | /api/items |
user | Report item (multipart, optional image, reward) |
| GET | /api/items/mine |
user | My items |
| GET | /api/items/<id> |
public | Item details |
| GET | /api/items/<id>/matches |
public | Suggested matches with score and reasons |
| PATCH | /api/items/<id>/status |
owner / admin | {"status": "resolved" | "open"} |
| DELETE | /api/items/<id> |
owner / admin | Delete item |
| GET | /api/found-room |
public | Boxes per category with counts and previews |
| GET | /api/meta ยท /api/stats |
public | Categories, places, home page counts |
| GET | /api/messages |
user | My conversations |
| POST | /api/messages |
user | Send {item_id, body, receiver_id?} |
| POST | /api/messages/read |
user | Mark a chat as read |
| GET | /api/messages/unread-count |
user | Unread badge count |
| GET | /api/admin/stats |
admin | Totals, by-category and hotspot data |
| GET | /api/admin/users |
admin | All users with item counts |
| PATCH | /api/admin/users/<id> |
admin | {"is_active": false} or {"role": "admin"} |
| POST | /api/admin/categories ยท /api/admin/locations |
admin | Add a category / place |
| DELETE | /api/admin/categories/<id> ยท /api/admin/locations/<id> |
admin | Delete one that is unused |
- Email notifications when a new match appears
- Image-based matching
- QR-code stickers for valuables
- Mobile app