Code Snippets and ChatGPT Project Context

This file documents how we used ChatGPT as an assistant throughout the coding of the Rent Tracker project. We had access to ChatGPT Plus, and during the project we used the ChatGPT Projects feature to create a dedicated project titled “Rent Tracker”, which allowed persistent memory and context-aware assistance.

The memory stored in this ChatGPT project enabled contextually rich conversations across weeks of development. We actively fed project-specific details into memory, and referenced them during prompts related to Flask, SQLite, Telegram bots, architecture, and design decisions.

Table of contents

Why We Used ChatGPT Projects

  • We needed a consistent assistant that understood the scope and stack of our project without repeating the same context every time.
  • The persistent memory allowed us to quickly prototype, refactor, or troubleshoot code while keeping all architectural and business logic in mind.
  • We primarily used ChatGPT for ideation, refactoring suggestions, implementation strategies, and debugging – always reviewing and adapting results ourselves.

What Was Stored in Memory

Below is the exact list of memory entries that were added to the ChatGPT Rent Tracker project and used during code development.

These entries served as context for our prompts, and the assistant had access to them whenever we asked for coding help or implementation advice.

Denis is starting a new university project for the module 'Full Stack Web Development.' 
The app must be written in Python using Flask, have at least 10 routes (including different HTTP methods),
a relational database (e.g., SQLite), user roles (e.g., anonymous and identified), Jinja2-rendered frontend, 
one headless API delivering JSON, and use the built-in development web server. 
Denis is considering four project ideas: (1) Ping Pong Club Tournament System, (2) Rent Tracking System, 
(3) World Flight Map Tracker, and (4) Instagram Content Planner.
Denis is creating a GitHub repository for the Rent Tracking
System project and has chosen the name 'Rent Tracker.'
Denis values good documentation and is a big fan of well-written README 
files for their projects.
Denis's rent tracking system must account for rental agreements
with start and end dates per tenant per apartment. 
Owners should receive reminders:

1. For current tenants' unpaid past and current months.
2. For new tenants starting next month.
3. But not if there is a gap month with no tenant.'
Denis and their colleague are now implementing the signup 
and login functionality in the Rent Tracker project. 
They want to refactor the existing implementation to match their 
current style without using packages like SQLAlchemy or itsdangerous 
if avoidable.'
Denis and Caren are now implementing the Rent Tracker project in code. 
They have completed login, signup, and password reset functionality. 
The dashboard and rent month logic have already been implemented. 
The next focus is on building a reminder system using Telegram integration. 
They plan to add a 'Settings' button in the base template 
where users can manage profile settings and 
connect Telegram without manually entering chat IDs. 
Currently, they are focusing on the apartments and tenants screens.'
Denis is now creating an architecture.md file for the 
Rent Tracker Flask app, following professional open-source practices, 
with sections like Overview, Codemap, and Cross-Cutting Concerns.
Denis and Caren are now preparing the main README.md file 
for their GitHub repository for the Rent Tracker project. 
The README should include: a short intro with university context 
and deadlines (start: 10.04, presentation: 03.07.2025, submission: 20.07.2025), 
setup instructions, links to GitHub Pages documentation 
(architecture, data model, etc.), and a download link 
to their final project presentation.
Denis and Caren's Rent Tracker project uses Python (Flask), SQLite, 
Jinja2, Bootstrap, WTForms, SendGrid, and a lightweight ORM. 
The project includes two Telegram bots: 
one for daily reminders (can be extended to cron/GitHub Actions) 
and another for user registration (currently run locally with polling, 
will use webhooks in production). 
The project includes separate pages for data model and design decisions. 
Testing is done manually.

How ChatGPT Was Used for Code Assistance

ChatGPT was used in an assistant role, not as a generator of final code. Its support focused on:

Clarifying syntax and library usage

  • Flask route decorators, before_request, and url_for best practices
  • Setting up WTForms validators and CSRF protection
  • Creating modular Blueprints for routes and templates

Supporting decisions and scaffolding

  • Comparing lightweight ORM patterns without SQLAlchemy
  • Designing Telegram bot workflows (polling vs. webhook)
  • Understanding best practices for storing file paths vs. BLOBs
  • Structuring GET-based filtering of rent payments

Refactoring or rewriting parts for better readability

  • Simplifying login/signup logic with ORM SQLAlchemy
  • Organizing code in reusable utility modules
  • Improving security via password hashing

Debugging assistance

  • Helping resolve SQLite foreign key bugs
  • Tracing WTForms errors in templates
  • Fixing jinja2.exceptions.UndefinedError messages
  • Managing circular imports in Flask blueprint setup

Example Prompts Used

Can you help me refactor the login function in Flask without using itsdangerous or Flask-SQLAlchemy?
We have a table 'rental_agreement' that links tenants and apartments. How should we structure the reminder logic to skip empty months between agreements?
What’s a good way to implement GET filtering for rent payments by month and apartment using Flask and WTForms?
We want to avoid storing BLOBs and instead store file paths to documents. How to organize upload folders securely and link them in the database?

Where Code Support Was Applied

Area Example Features
Authentication Login, Signup, Logout using Flask-Login
Data Modeling SQLite schema design, foreign key setup
Blueprints Modularization of routes: users, dashboard, payments, reminders
Forms & Validation WTForms setup for rent input, filtering, tenant info
Telegram Integration Sending reminders, registering users via bot
Email Notifications SendGrid integration for password resets
Cron / Automation Collecting ideas about future hosting on GitHub Actions with trigger for autonomous reminders
Error Handling 404, 403 pages, server error debugging
Dashboard Ideas of representing the cashflow projection logic based on rent data
Filtering GET method filters with tenant/month select fields

Important Notes

All AI-generated snippets were manually reviewed, edited, and tested before being added to the codebase. ChatGPT was used as a pair programming assistant, not as an automated coding engine. Its contributions improved our coding speed, clarity, and adherence to best practices, especially under tight academic deadlines.

For non-code assistance (e.g., phrasing explanations or design documentation), see AI Assistance in Documentation.md.

Selected ChatGPT Conversations

We kept a record of ChatGPT chats that directly supported development. Below is a list of specific discussions with a short description of their focus and how they contributed to the Rent Tracker project.

These conversations were part of the same ChatGPT Project with memory enabled. Each discussion helped us understand trade-offs, debug issues, or explore features. All outcomes were reviewed and decided by the human team.

#1 Multi-Topic Chat : Implementation Support and Best Practices

Chat Link: ChatGPT – RentTracker Session
Summary: This conversation covered a wide range of implementation topics, many of which were directly used or documented in our project. Topics included:

  1. Stripe Payment – How Difficult Is It?

Purpose: To assess the complexity of integrating Stripe for rent payments.
Used For: Understanding what would be required to support payments in a future version of Rent Tracker.

  1. Feature Enhancements Brainstorm (UX, Security, Permissions, Multilingual Support)

Purpose: Exploring optional improvements that go beyond MVP, including role-based access, multilingual UI, and better UX polish.
Used For: Creating a backlog of possible features for post-submission refinement.

  1. SendGrid Evaluation (Post-Professor Discussion)

Purpose: Evaluating SendGrid as an alternative to Flask-Mail or SMTP after discussing with our professor.
Used For: Documented in design decision on email delivery method.

  1. SendGrid Setup Help (Single Sender, DNS, Domain)

Purpose: Step-by-step setup help with SendGrid: verifying sender, configuring DNS, resolving domain validation issues.
Used For: Email integration setup during development.

  1. Hosting a Flask Project

Purpose: Exploring options for hosting the Flask app for the future (Render, Railway, PythonAnywhere, etc.).
Used For: Deployment planning.

  1. File Uploads – BLOBs vs Uploads Folder with URL

Purpose: Understanding the pros and cons of storing uploaded files as BLOBs in SQLite vs. storing file paths and serving from a static folder.
Used For: Designing the file upload and download flow.

  1. File Download + Secure Viewing

Purpose: How to allow file download/viewing by authorized users only.
Used For: Document access features for owners.

  1. Debug Mode in Flask

Purpose: Understanding Flask debug mode, how it works, and its risks in production.
Used For: Documentation and temporarily .flaskenv setup.

  1. Debugging Circular Imports in Flask

Purpose: Help with solving circular import errors between models and Blueprints.
Used For: Modularization and blueprint setup.


#2 Multi-Topic Chat: Web Concepts and Authentication Flows

Chat Link: ChatGPT – RentTracker Session Nr. 2
Summary: This conversation focused on understanding core browser and Flask concepts, as well as exploring possible future extensions such as third-party authentication. Topics included:

  1. Cookies vs. Cache – What’s the Difference?

Purpose: Clarifying the difference between client-side browser cookies and cache, especially in the context of login sessions.
Used For: Better understanding of how authentication states persist in Flask apps.

  1. Flask Memory & Sessions – How Does It Work?

Purpose: Understanding how Flask keeps track of sessions between routes, and how current_user works internally with Flask-Login.
Used For: Debugging session behavior and improving access control logic.

  1. Sharing current_user Across Routes

Purpose: Making sure current_user data (e.g. name, ID) can be accessed on all pages, and how to structure before_request logic for authenticated users.
Used For: Implementing global access guards and user-specific route logic.

  1. Google / Facebook Login – How It Works?

Purpose: Exploring how third-party OAuth sign-in via Google or Facebook works in Flask.
Used For: Understanding what would be required to add this in a future version of the project, including key libraries (e.g. Flask-Dance, Authlib), and OAuth flow basics.


#3 Multi-Topic Chat: README, Architecture Planning, and Terminology

Chat Link: ChatGPT – RentTracker Session
Summary: This conversation focused on project documentation refinement and planning. It included early ideation for technical documentation files, terminology clarification, and polishing of the main README.md. Topics included:

  1. README – Rephrasing and Enhancing

Purpose: Improving the tone, clarity, and structure of the main project README.md.
Used For: Rewriting sections like the project description, setup instructions, feature overview, and technology stack in a more professional and GitHub-friendly format.

  1. Architecture.md – First Drafting Ideas

Purpose: Brainstorming what kind of sections should go into a high-quality architecture.md file (e.g., overview, codemap, technologies used).
Used For: Planning the content and structure for a technical architecture overview page, following open-source best practices.

  1. Cross-Cutting Concerns – What Does It Mean?

Purpose: Clarifying the term “cross-cutting concerns” in software architecture and how it applies to a Flask app.
Used For: Filling in the “Cross-Cutting Concerns” section of architecture.md, including topics like logging, error handling, authentication, and configuration.


#4 Focused Chat: How Flask Blueprints Work

Chat Link: ChatGPT – RentTracker Session
Summary: This focused conversation helped us understand the concept and use of Flask Blueprints to structure a modular web application.

  1. Blueprint Basics

Purpose: Understanding what Blueprints are in Flask, how they relate to the main app object, and why they are useful for larger projects.
Used For: One big app.py or many smaller .py_s? Justifying the use of Blueprints in our project structure, especially to separate concerns like users, tenants, reminders, and auth.

#5 Multi-Topic Chat: Debugging, Integration, and Development Support

Chat Link: ChatGPT – RentTracker Session
Summary: This extended session included practical help with debugging, integration setup, Git workflow, task scheduling, and UI improvements. Many of the assistant’s responses helped resolve real issues we encountered during development.

  1. Jinja Template Render Debugging

Purpose: Solving issues with Jinja template rendering, such as UndefinedError, missing variables, or context errors.
Used For: Debugging HTML template logic and fixing server errors.

  1. Git – Fetching, Stashing, History

Purpose: Understanding how to safely fetch and stash changes in the same branch without losing work.
Used For: Fixing merge issues and preserving progress while switching between tasks.

  1. Refactoring Login/Register Flow

Purpose: Adapting a basic login/register Flask tutorial to our project structure, including proper form handling and redirects.
Used For: Replacing the original prototype code with a modular, production-ready version.

  1. Email Sending Troubleshooting

Purpose: Debugging email delivery and configuration issues with various services:

  • Flask-Mail with SMTP
  • Local mail catcher
  • Mailtrap sandbox
  • Gmail SMTP
  • Brevo (Sendinblue) setup
    Used For: Achieving consistent working email delivery for password reset and bot registration.
  1. Building the Settings Page

Purpose: Guidance on how to create a user settings page in Flask with editable profile data and Telegram linking.
Used For: Frontend + backend logic for the /settings route.

  1. Commit / PR Naming Best Practices

Purpose: Suggestions for clear and semantic commit messages and pull request titles/descriptions.
Used For: Keeping the Git history readable and collaborative.

  1. Sample Data SQL

Purpose: Guidance on how to write seed SQL data for testing the app during development.
Used For: Creating and importing dummy apartments, tenants, and agreements.

  1. Telegram Bot Integration (Polling vs Webhook)

Purpose: Comparing polling vs. webhook approach for the registration bot.
Used For: Choosing polling during development, with plans to switch to webhook for production.

  1. API Basics and Project Use Cases

Purpose: Understanding what an API is and where it would fit into our app (e.g. JSON endpoint, internal API, Telegram bot).
Used For: Drafting the one headless API route and integrating the Telegram workflow.

  1. Virtual Environment Reinstallation

Purpose: How to safely reinstall the virtual environment (venv) after switching laptops.
Used For: Recreating the dev environment without breaking dependencies.

  1. Python Version Conflicts

Purpose: Testing and switching between Python 3.10 and 3.11 due to python-telegram-bot version compatibility.
Used For: Ensuring that Telegram integration works with selected dependencies.

  1. Flask login_required Errors

Purpose: Help debugging why @login_required routes weren’t redirecting properly.
Used For: Fixing access control across routes.

  1. Task Scheduling: Celery, Redis, APScheduler, Cron

Purpose: Comparing options for running scheduled tasks like reminders.
Used For: Choosing GitHub Actions and daily Telegram bot script for reminder automation.

  1. CSS/UI Fixes

Purpose: Advice on small frontend polish for Bootstrap layout issues.
Used For: Finalizing UI layout in tenants, dashboard, and rent views.

  1. Data Model Documentation

Purpose: Help transcribing the ERD manually into markdown + fixing inconsistencies in relationships.
Used For: Creating the data_model.md page and spotting bugs in FK structure.


#6 Focused Chat: Git Merge vs. Rebase

Chat Link: ChatGPT – RentTracker Session
Summary: This conversation focused on understanding the difference between git merge and git rebase, and when to use each in collaborative projects like RentTracker.

  1. Git Merge vs Rebase – Which one to choose?

Purpose: Comparing pros and cons of each approach, especially in the context of pull requests, solo branches, and small team projects.
Used For: Deciding on a workflow where:

  • merge is used when integrating into shared branches
  • rebase is used locally to keep branches tidy before merging

This discussion helped clarify our Git workflow strategy during collaborative coding and testing phases.


#7 Focused Chat: Preparing Questions for Professor (English + German)

Chat Link: ChatGPT – RentTracker Session
Summary: This session focused on improving the phrasing and structure of questions Denis and Caren wanted to ask their professor regarding their Flask-based project. The conversation included both English drafting and German translation to support in-class communication or formal email writing.

  1. Formulating Clear Technical Questions

Purpose: Rewriting rough ideas into well-structured and polite questions, suitable for academic or professional communication.
Used For: Preparing questions related to naming conventions, feature choices, and evaluation criteria.

  1. Translating the Final Questions into German

Purpose: Making it easy to bring the questions into the classroom or email communication with the professor in the language of instruction.


#8 Focused Chat: Prompt Engineering for Better AI Assistance

Chat Link: ChatGPT – RentTracker Session
Summary: This session focused on crafting expert-level prompts to improve future ChatGPT interactions for different areas of the project.

We developed structured, role-based prompts for:

  • WTForms refactoring (clean forms, validators, rendering)
  • Writing high-quality documentation (e.g. README.md)
  • Documenting design decisions based on course expectations
  • SQLAlchemy migration from raw SQL
  • Full project folder reorganization (Blueprints, modular layout)

These prompts helped us get consistent, high-quality answers in future chats by clearly defining goals, roles, and expectations.


#9 Multi-Topic Chat: Email Reminder Refactoring, API Design, Bug Fixing

Chat Link: ChatGPT – RentTracker Session
Summary: This conversation included practical help with extending and restructuring parts of the app, plus early API design considerations.

Topics discussed:

  • Refactoring the Reminder System
    Updating the logic to enable email reminders in addition to Telegram, reusing shared logic and maintaining clean separation.

  • API Ideation
    Discussed where API logic should live in the folder structure, when to use API calls vs. direct Python functions, and how to separate public vs. internal endpoints.

  • Bug Fixing Support
    Included troubleshooting small issues during the refactor and logic updates.

This session helped restructure core logic and prepare for better extensibility.


#10 Multi-Topic Chat: Debugging, Refactoring, and Environment Issues

Chat Link: ChatGPT – RentTracker Session
Summary: This session focused on resolving technical bugs, working around networking issues, improving user experience, and exploring partial ORM migration.

Topics included:

  • sqlite3.IntegrityError Debugging – Understanding foreign key and NOT NULL constraint violations
  • Telegram Issues – Troubleshooting app vs. browser differences caused by VPN and blocked ports on company laptop
  • First-Time Dashboard Welcome – Designing and fixing logic for showing a welcome message only on first login
  • Query Rewriting – Adjusting SQL queries to fetch correct user-specific and tenant-specific data
  • Flask before_request Debug – Updating logic and marking routes as “safe” for unauthenticated access
  • Branch Naming Help – Suggestions for semantic, clean Git branch names
  • Bootstrap Debug – Fixing layout and responsiveness issues in templates
  • Tokenizer Explanation – Discussed how token counting works in ChatGPT contexts
  • SQLAlchemy Refactor (Full or Partial) – Explored which parts of the project could benefit from ORM use
  • SendGrid & SSL Certificate Debug – Helped with issues sending email using self-signed certs on local HTTPS

This session helped resolve both low-level bugs and higher-level design questions across multiple parts of the stack.


#11 Focused Chat: User Model ORM Migration and Git Workflow

Chat Link: ChatGPT – RentTracker Session
Summary: This session focused on transitioning the user model from raw SQL to SQLAlchemy ORM, with additional Git and debugging support.

Topics included:

  • Migration from Raw SQL to SQLAlchemy ORM – Help structuring the User class using ORM syntax
  • Flask-SQLAlchemy vs. Raw SQLAlchemy – Clarified differences in setup, session handling, and convenience
  • Bug Fixing – Help debugging integration issues during the model switch
  • Pull Request Help – Suggestions for writing a clear PR title and descriptive message for the ORM refactor

This session was a key step in starting ORM integration while maintaining the project’s modular structure.


#12 Multi-Topic Chat: UI Design, Formatting, and Code Style

Chat Link: ChatGPT – RentTracker Session
Summary: This session focused on improving the user interface, handling data formatting, and standardizing some logic and naming in the project.

Topics included:

  • Settings UI Updates – Suggestions for improving layout and interaction in the user settings page
  • Welcome Message Ideation – Discussed options like flash messages, modal popups, and multi-step user tours
  • HTTP Status Codes vs. JSON Status Messages – Clarified when to rely on status codes vs. sending status info in the response body
  • Commit Message Style – Recommendations for semantic and consistent commit message patterns
  • Rent Payment Duplicates – Advice for checking and resolving accidental duplicate rent entries
  • Hidden Input Fields – Proper use of <input type="hidden"> for passing non-editable data in forms
  • Readable Data Formatting – Converting timestamps and enums into user-friendly display formats in templates

This session contributed to a cleaner and more polished UI, better UX patterns, and more maintainable code structure.


#13 Focused Chat: Jinja Template Debugging After Merge

Chat Link: ChatGPT – RentTracker Session
Summary: This session addressed template rendering issues that appeared after a Git merge, along with clarification on Jinja syntax.

Topics included:

  • Post-Merge Template Bug Fixing – Help debugging broken templates due to mismatched or conflicting edits after merging branches
  • Jinja Comments vs. HTML Comments – Clarified the difference between {# ... #} (Jinja) and <!-- ... --> (HTML), and their use cases during debugging and development

This conversation helped resolve rendering problems and improved awareness of template syntax during collaborative development.


#14 Multi-Topic Chat: WTForms Integration, Debugging, and Workflow

Chat Link: ChatGPT – RentTracker Session
Summary: This session focused on integrating WTForms into the project and improving related workflows around validation, debugging, and Git.

Topics included:

  • WTForms Implementation Strategy – Where to introduce forms, how to refactor views, and whether tenant-related views are enough for demonstrating form usage
  • WTForms Pros and Trade-offs – Why WTForms improve structure and validation despite making code longer
  • WTForms Macros – When it makes sense to use Jinja macros for form fields to reduce repetition
  • Form Field Validation – Setup for email and password fields, with built-in validators
  • Debugging WTForms Errors – Techniques to print or log field errors when debugging form submissions
  • Virtual Environment Cleanup – Cleaning up Python paths and environments after switching versions
  • Branch Naming Suggestions – Naming conventions for feature branches related to forms
  • Pull Request Help – Writing a clear PR title and description for the WTForms integration

This session helped formalize our WTForms usage and streamline the associated dev workflow.


#15 Focused Chat: Bootstrap Refactoring and Theming

Chat Link: ChatGPT – RentTracker Session
Summary: This session explored Bootstrap-based layout improvements and visual polishing through refactoring and experimentation.

Topics included:

  • Refactoring with Bootstrap – General layout improvements and styling experiments using Bootstrap 5 components
  • base.html vs. base1.html – Testing multiple base templates to explore structure and layout inheritance
  • base1.css – Custom styles used alongside Bootstrap to test visual tweaks
  • Bootstrap Theme Variations – Discussed options for switching between different Bootstrap color schemes and UI components
  • Image-Based Buttons in Tables – Help fixing alignment and spacing issues for buttons with icons or images inside table rows

This session helped us improve the UI consistency and flexibility across different templates.