How 7hsk/car_rental works
1. Project type and runtime
- This is a desktop C application for car-rental management, not a web service.
- The README says it uses GTK/GTK4 for the UI, and the build tree shows a single CMake-built executable: car_rental.exe.
2. Top-level application structure
- main.c is the entry point and likely owns startup, screen switching, and role dispatch.
- The codebase is split into small feature modules: login, signup, admin, client, user, car, mod, req, plus shared utils.
3. Role-based architecture
- The app has two primary user roles:
- Admin: manage vehicles, brands, and rental requests.
- Client: submit and track rental requests.
- The role boundary is a major architectural split: after authentication, the app routes users into different UI and business flows.
4. Authentication and account lifecycle
- login.c/.h and signup.c/.h handle credential entry and account creation.
- signup_data.txt suggests user credentials or registration records are persisted locally rather than in an external database.
- The README’s fixed admin account indicates a built-in or special-case admin login path.
5. Domain model boundaries
- user.h, car.h, and req.h likely define the core data structures for the system:
- user/account data
- car inventory and metadata
- rental request records
- admin.h and client.h likely encapsulate operations available to each role.
- mod.c/.h appears to handle update/modify operations on stored records.
6. Persistence layer
- The application uses a filesystem-backed storage model, not a database server.
- There are three clear storage areas:
- DataBase/ with many .bin files for general records
- DataBase_cars/ for car-related reference data
- DataBase_txt/ with many user-data*.txt files
- This suggests custom serialization and manual file I/O are central to the architecture.
7. Car catalog storage
- DataBase_cars/DataBase_brands/*.bin stores brand records.
- DataBase_cars/DataBase_models/*.bin stores model records.
- brands_list.txt and models.txt look like index or lookup files used to validate or populate UI selections.
- Brand/model lookup is therefore separated from transactional request data.
8. Request and inventory flow
- A client likely creates a rental request through the UI.
- That request is persisted into one of the local data files, then reviewed or updated by an admin.
- Admin actions probably include approval/rejection, status updates, and price or inventory changes.
- The README explicitly mentions automated request processing and status updates, so request state is a key workflow.
9. Validation and utility layer
- utils.c/.h likely contains shared helpers for:
- file access
- string manipulation
- input validation
- formatting or UI support
- utils_png suggests image assets or image-processing support for the GTK interface.
10. Build and dependency management
- The project is built with CMake.
- The build directory shows a vendored dependency for cJSON, so JSON parsing/serialization is probably used in at least part of the workflow.
- This matters architecturally because some data interchange or config handling may be structured through JSON even though the main persistence is file-based.
11. Data organization pattern
- The large number of .bin and user-data*.txt files implies a many-file storage scheme rather than a single consolidated database.
- That usually means each entity or record type is stored independently, which affects how diagrammed flows should show read/write access to specific folders.
12. What to show in an architecture diagram
- Draw the system as a single GTK desktop client with these internal subsystems:
- UI/bootstrap
- authentication
- admin workflows
- client workflows
- shared utilities/validation
- file-based persistence
- Show local filesystem storage as the only backend boundary, with separate folders for users, cars, brands/models, and request/customer data.
Main entry points: car.c Car Model · main.c Main · login.c Login · admin.c Admin
Components 18
Desktop App
GTK desktop client, startup, and role-based screen flow.
- Main · Application entry point and startup router.
main.c - GTK Assets · Image or GTK UI asset support used by the desktop interface.
utils_png - cJSON · Vendored JSON library used for structured data handling.
cmake-build-debug/_deps/cjson-subbuild
Domain Logic
Authentication, role workflows, and record management.
- Login · Credential entry and sign-in handling.
login.c - Signup · Account creation and registration flow.
signup.c - Admin · Administrative screens and management actions.
admin.c - Client · Customer-facing request and tracking flow.
client.c - User Model · Shared user/account data structures and logic.
user.c - Car Model · Vehicle data structures and catalog operations.
car.c - Request · Rental request data and status handling.
req.h - Modify · Update and modify operations on stored records.
mod.c - Utils · Common helpers for validation, formatting, and file access.
utils.c
Local Storage
Filesystem-backed persistence and lookup data.
- User Files · Local text-backed user and registration records.
DataBase_txt - Record DB · Binary record storage for application data.
DataBase - Brands DB · Brand lookup and reference files.
DataBase_cars/DataBase_brands - Models DB · Model lookup and reference files.
DataBase_cars/DataBase_models - Brand Index · Brand list file used for selection or validation.
DataBase_cars/brands_list.txt - Model Index · Model list file used for selection or validation.
DataBase_cars/models.txt
Connections 23
- Main → Login: opens · Startup routes into authentication.
- Main → Signup: registration · Launches account creation when needed.
- Login → Admin: admin path · Authenticated admin users enter management workflows.
- Login → Client: client path · Authenticated customers enter request workflows.
- Signup → User Model: creates · Registration produces shared account data.
- Login → User Model: reads · Sign-in validates against stored account records.
- Admin → Car Model: manages · Admin workflows update vehicle inventory.
- Admin → Request: reviews · Admin approves, rejects, or updates rental requests.
- Client → Request: submits · Client workflow creates and tracks requests.
- Client → Car Model: browses · Client views available cars and catalog data.
- Admin → Modify: modifies · Admin changes stored records through update logic.
- Client → Modify: updates · Client-side request changes may pass through shared modify logic.
- User Model → User Files: persists · Account and signup data is stored locally.
- Request → Record DB: persists · Requests and status records are written to binary storage.
- Car Model → Brands DB: reads · Brand metadata is loaded from local catalog storage.
- Car Model → Models DB: reads · Model metadata is loaded from local catalog storage.
- Car Model → Brand Index: indexes · Brand selection uses a lookup file.
- Car Model → Model Index: indexes · Model selection uses a lookup file.
- Utils → User Files: helps · Shared helpers support file and text processing.
- Utils → Record DB: helps · Shared helpers support binary I/O and validation.
- Utils → cJSON: parses · Utilities may serialize or parse structured JSON data.
- Main → Utils: uses · Bootstrap relies on shared helper routines.
- Main → GTK Assets: loads · UI startup references image or GTK asset support.