How abdullahhasan42/streamlit-team-activity-crud works
Summary / Project type and purpose
• This is a small single-repository web application (monolith) implemented with Streamlit that provides a CRUD interface for logging team activities.
• Purpose: authenticated users open the Streamlit UI, fill forms and view/update team activity records which are persisted in a Google Sheets spreadsheet. The app is hosted on Render. Authentication is handled with streamlit-authenticator.
Analysis of the file tree and README
• Files:
• login.py — responsibility: authentication UI / login flow (Streamlit + streamlit-authenticator).
• team.py — responsibility: the main app pages / CRUD forms and Views for activities.
• requirements.txt — lists runtime libraries (not shown, but expect streamlit, streamlit-authenticator, Google Sheets client libs, pandas, etc.).
• img/ — static images used in README and UI (branding/screenshots).
• README.md — describes the architecture: Streamlit front-end, Google Sheets backend, hosted on Render.
• Architectural inference:
• Single-process Streamlit server serves browser UI to users.
• The Streamlit app calls Google Sheets API (via a Python client library or gspread/pygsheets) for persistence.
• Authentication occurs in-process using streamlit-authenticator.
• Deployment is handled by Render; secrets (Google credentials, auth config) are expected to be supplied as environment variables / Render secrets.
Main components
• Users (Browsers / Clients)
• Streamlit App (single server process in the repo)
• Authentication module (login.py + streamlit-authenticator)
• UI / Presentation layer (forms, pages — team.py)
• Business logic / CRUD handlers (functions that validate input and call storage)
• External assets (img directory)
• Persistence: Google Sheets (spreadsheet(s) storing activities)
• Hosting / Infrastructure: Render (app host that runs the Streamlit server)
• Source repository (GitHub) — optional but useful to show code origin / CI
• Secrets & Config store (Render environment variables / service account JSON)
• External services & APIs: Google Sheets API / Google OAuth (token endpoint) — show as distinct external service
Relationships and interactions (show these
• User -> HTTPS -> Render-hosted Streamlit app: browser sends requests, receives HTML/JS stream.
• Streamlit app (authentication module) -> streamlit-authenticator (internal lib) — validate credentials (local hash or credentials config).
• Streamlit app -> Google Sheets API (via client library) using OAuth/service account credentials — read/write CRUD operations.
• Streamlit app -> Render (runtime environment) for environment variables/secrets access (show as the app reading secrets).
• Data flow for CRUD:
• Create/Register Activity: User fills form -> Streamlit UI -> Business logic validates -> Google Sheets API write -> confirmation to UI.
• Read/List Activities: UI requests -> Google Sheets API read -> UI displays table.
• Update/Delete: same pattern via row index / ID in sheet.
Important architectural patterns & design principles used
• Monolithic single-process server: UI, auth and persistence code run in same Streamlit process.
• Thin UI / server-side app model: Streamlit keeps state server-side; the browser is a thin client.
• Externalized persistence: uses Google Sheets as a remote store (not a traditional DB). This implies eventual consistency, limited query abilities, and rate limits.
• Secret management: Authorization credentials (service account JSON or OAuth tokens) must be kept out of source and provided via environment variables or a secret manager at deployment.
• Streamlit (frontend / app server)
• streamlit-authenticator (authentication)
• Google Sheets API (persistence) — implemented via a Python client library such as gspread or google-api-python-client (check requirements.txt)
• Hosting: Render
• Python runtime (requirements.txt)
• Optional: pandas for data handling; OAuth / service account credential mechanism (google-auth)
• Tools (repo): GitHub (README and images in repo)
• Boundaries:
• Client boundary: browser clients vs server (Streamlit).
• Deployment boundary: Render-hosted runtime vs external Google services.
• Separation of concerns even inside the single-process app:
• Authentication module (login.py) clearly separated from the CRUD pages (team.py).
• Operational and security concerns:
• Where secrets/config reside (Render secrets / environment variables).
• Network protocol (HTTPS) between client and Streamlit server, and HTTPS/TLS to Google APIs.
• Layout:
• Left: Users (Browsers)
• Top/Bottom: Git repo/CI and Monitoring/Logs
• UI / client components: light blue
• App components (auth, business logic): green
• Data stores / persistence: orange/yellow
• External cloud services / hosting: purple/gray
• login.py -> Authentication module (Streamlit UI + streamlit-authenticator)
• team.py -> UI pages and CRUD handlers (forms + business logic)
• README.md -> documentation (annotate as repo-level artifact)
• Secrets and config:
• How are Google credentials provided? (service account JSON stored as Render secret or environment variable)
• How are user credentials or auth config provided for streamlit-authenticator? (YAML/ENV/config)
• Scalability & limitations:
• Google Sheets as DB: low write throughput, limited concurrent edits, limited query capabilities.
• Introduce a Storage Adapter interface between business logic and Google Sheets (makes swap to a SQL DB easier).
• Clear, human-readable labels for all components (match names in the repo: login.py, team.py).
• Notes for secrets and config (where they live and who can access them).
Closing guidance