A simple tool used to let the student know which clgs one can take admission based on EAMCET Ranks
''' A lightweight user-to-user ticket resale marketplace built with Streamlit (frontend) and Supabase (database). Users can sign up, add tickets for sale, view marketplace listings, buy tickets, and view their purchased tickets. The app stores ticket records, updates wallets on purchase, and supports simple affiliate bonuses.
This README explains the project structure, how to set up the Supabase database (including the tickets
table you requested), and how to run the app locally.
'''
/
├─ frontend/
│ └─ app.py # Streamlit UI
├─ src/
│ ├─ logic.py # Business logic (Supabase queries)
│ └─ db.py # Helper/CLI DB utilities and samples
├─ requirements.txt # Python dependencies
├─ readme.md # Project documentation (this file)
└─ .env # (not checked in) environment variables
- User management: sign up, login
- Movies: add and view movies (poster URL supported)
- Marketplace: add tickets for sale (seller sets quoted price)
- Buy flow: users can buy tickets (wallet updates) and record purchased tickets
- My Tickets: users can view tickets they've bought (stored in
tickets
table) - Simple affiliate bonus support when adding tickets to the marketplace
- Python 3.8+
- A Supabase account (Postgres + REST API)
- Git (recommended)
- Clone the repo:
git clone <repository-url>
cd instant
- Install Python dependencies:
pip install -r requirements.txt
- Create a
.env
file in the project root and add your Supabase credentials:
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your-service-role-or-anon-key
Security note: keep service role keys secret and never commit .env
to source control.
Create the database tables used by the app. Below are example SQL statements for the core tables. Adjust column types and constraints to match your Supabase/Postgres setup.
- Users (example)
create table users (
id serial primary key,
name text,
mail text,
phone text,
pwd text,
interests text,
wallet integer default 0
);
- Movies
create table movies (
id serial primary key,
name text,
genre text,
release_date date,
url text -- poster url
);
- Marketplace (
mart
)
create table mart (
id serial primary key,
uid integer references users(id) on delete cascade,
movie_name text,
no_of_tickets integer,
official_price integer,
quoted_price integer,
affiliate boolean default false,
refund boolean default false,
showtime timestamp
);
- Tickets (purchased tickets) — per your requested schema
CREATE TABLE tickets (
id SERIAL PRIMARY KEY,
uid INTEGER NOT NULL,
name TEXT NOT NULL,
no_of_tickets INTEGER NOT NULL CHECK (no_of_tickets > 0),
showtime TIMESTAMP NOT NULL,
FOREIGN KEY (uid) REFERENCES users(id) ON DELETE CASCADE
);
Notes:
- Run these SQL statements in the Supabase SQL editor or your Postgres client.
- The application will attempt inserts into these tables; if a table is missing, insert operations will quietly fail (the app continues), so make sure you create them before testing purchases.
SUPABASE_URL
— your Supabase project URLSUPABASE_KEY
— the anon or service key used to access Supabase
Place them in a .env
file at the project root.
- Start the Streamlit frontend (from the project root):
streamlit run "frontend/app.py" --server.port 8502
Open the Local URL displayed (e.g., http://localhost:8502).
- (Optional) CLI helpers
The src/db.py
file contains helper functions and example flows for directly interacting with Supabase (add user, add movie, etc.). It is not a web API.
- Sign up from the sidebar (or use an existing account).
- Log in using the sidebar login (name + password) — note: current implementation uses plaintext passwords stored in Supabase; consider upgrading to hashed passwords for production.
- Home: shows movie poster cards (suggestions if logged in, otherwise all movies).
- Add Movie: add a movie and include a
url
for poster images. - Add Tickets: logged-in sellers can add tickets to the marketplace (quote must be less than official price).
- View Mart: browse tickets offered by others.
- Buy Ticket: when buying you are prompted for movie name, ticket count, and show date/time — the app updates wallets and records purchased tickets in the
tickets
table. - My Tickets: view tickets you purchased.
- Password security: store hashed passwords (bcrypt) instead of plaintext.
- Add proper authentication tokens instead of name-based login.
- Improve image handling: thumbnail generation or signed URLs for private storage.
- Pagination & search on movie listing pages.
- Unit tests for business logic in
src/logic.py
.
- Deprecation warnings from Streamlit: update calls like
use_column_width
→use_container_width
(already updated in this repo). - If images do not show: ensure
movies.url
contains public image URLs or use Supabase signed URLs. - If purchases do not record in
tickets
: verifytickets
table exists and your Supabase key has insert privileges. - If you get Supabase connection errors: check
SUPABASE_URL
andSUPABASE_KEY
in.env
and that environment variables are loaded.
If you want, I can add a small SQL migration file (e.g., migrations/create_tables.sql
) to the repo containing the table statements above.
If you need help setting up Supabase or wiring secure auth, open an issue or contact: