GSBooks is a billing and accounting single-page application (SPA). It was built to solve the strict data persistence challenges associated with hosting database-driven Python backend systems on ephemeral cloud infrastructure, while maintaining absolute user data ownership.
Production URL: gsbooks.dhirendraautomation.com
(Note: System access is actively restricted via a strict OAuth email whitelist. Public access is disabled.)
Cloud hosts operating on free tiers utilize ephemeral file systems that permanently delete local data when the server spins down. To solve this without migrating to a paid managed database, this application implements a custom cloud-sync bridge.
- Initialization: Upon successful Google OAuth login, the backend calls the Google Drive API (
drive.filescope) to locate and download the user's specific SQLite.dbfile into the temporary container. - Termination: Upon logout, or via the manual UI trigger, the updated
.dbbinary is streamed back to Google Drive, ensuring total data persistence across server restarts.
Security is handled via centralized dependency injection at the routing middleware level, protecting against unauthorized API access and file system attacks.
- OAuth 2.0 & Whitelisting: Integrated Google identity services for token-based authentication. The OAuth callback verifies the user's email against a strict
.envwhitelist. Unauthorized attempts are blocked (403 HTTP) before any session variables or database engines are initialized. - Centralized Gatekeeping: All data endpoints require a validated session dependency, eliminating the risk of unauthenticated direct API queries.
- Path Traversal Protection: File ingestion routes utilize UUID-based deterministic hashing for temporary storage, preventing malicious payload execution during imports.
The system utilizes a multi-tenant architecture where each user operates on an isolated SQLite database.
- Alembic Migrations: Schema evolution is managed via Alembic.
- SQLite Batch Mode: Configured with
render_as_batch=Trueto bypass SQLite's nativeALTER TABLElimitations, allowing seamless column additions and removals across all user databases without data loss.
The application handles bulk financial data through various ingestion methods, relying on the pandas library for normalization.
- Smart Paste: Parses raw clipboard text (tab-separated values from Excel/Google Sheets) directly into structured JSON payloads for the FastAPI backend.
- File Uploads: Processes bulk CSV/XLSX imports for both sales and purchases ledgers.
- Export Generation: Aggregates database records and outputs correctly formatted
.xlsxfiles usingopenpyxl, categorized specifically for GSTR-1 (Outward Supplies) and ITC (Inward Supplies) filing formats.
The user interface avoids heavy JavaScript framework build steps, focusing on lightweight reactivity and modern styling.
- Styling: Tailwind CSS is used to implement a custom "Liquid Glass" macOS-inspired UI (frosted glassmorphism, deep backgrounds).
- Reactivity: Alpine.js handles DOM manipulation, modal toggling, tab switching, and sidebar state management directly within the HTML markup.
- Templating: FastAPI's
Jinja2Templatesinjects backend session data directly into the frontend components before serving.
- Backend: Python 3.12+, FastAPI, SQLAlchemy (ORM)
- Migrations: Alembic
- Frontend: HTML5, Tailwind CSS, Alpine.js, Jinja2
- Database: SQLite (Local/Ephemeral), Google Drive API (Persistent Remote)
- Data Processing: Pandas, OpenPyXL
- Authentication: Authlib, Starlette Sessions
- Deployment: Render (with custom domain DNS routing and automatic TLS/SSL)
Unlike traditional SaaS applications that hoard financial data on centralized servers, GSBooks is built on a User-Owned Data Architecture inspired by "Local-First" principles.
- Absolute Data Ownership: Your entire database (
.sqlitefile) lives exclusively in your own personal or corporate Google Drive. We do not store, hoard, or analyze your financial data on our servers. - Zero Vendor Lock-In: Because your data is saved as a standard SQLite database, you are never locked into our ecosystem. You have full agency to download, archive, or query your data using third-party tools.
- Enterprise-Grade Cloud Security: By leveraging Google Drive for cloud storage, your database inherits Google's security infrastructure (256-bit SSL/TLS encryption in transit and 128-bit AES encryption at rest).
- Immunity to Centralized Breaches: By decentralizing storage and isolating your data within your own Google account, the centralized "honeypot" is eliminated, drastically reducing vulnerability to massive data breaches.
Application Interface & Screenshots (All data in the screenshots displayed is dummy data generated with the help of AI)
The primary control center displaying aggregated Total Sales, Total Purchases, Net Payable GST, and interactive financial charts based on the selected Financial Year.
Structured data tables for tracking inward and outward supplies. Details include invoice numbers, taxable values, and calculated CGST/SGST/IGST, complete with inline edit and delete capabilities.
A clean, intuitive modal form for logging individual sales or purchases. Features dynamic dropdowns and auto-populates party details to ensure data consistency across the database.
The system control center featuring dynamic user profile rendering via Google OAuth, database reset controls, and the manual trigger for Google Drive cloud synchronization.