DSGBase is a hybrid C backend + Flask frontend framework for working with user datasets. It provides efficient backend logic for data storage/search and a web frontend for user interaction.
-
Backend (C)
- Converts user records from JSON into a compact binary format.
- Supports filtered searches by name, surname, ID, or district.
- Provides utilities for loading, parsing, and printing user data.
-
Frontend (Flask)
- Simple web interface for interacting with the backend.
- Uses
Flask
,Flask-SQLAlchemy
,Flask-Login
, andFlask-WTF
. - Templates and static files are stored in
templates/
andstatic/
.
-
Dev Environment (Nix/Flakes)
- Reproducible setup including C libraries and Python tooling.
- Ready-to-use development shell with formatters, compilers, and libraries.
- JSON → Binary conversion
- Filtered search by multiple fields (
-n
,-s
,-i
,-r
) - Print user surnames (
-p
) - Flask-based web interface with templates/static assets
- Nix-based development environment (Linux)
- Makefile for simplified builds
If using the provided flake.nix
, the following dependencies are included automatically:
flask
flask-sqlalchemy
flask-login
flask-wtf
pip
uthash
— hash table utilitiescjson
— C JSON parserclang-tools
— linting, static analysisbear
— build tooling for C/C++black
— Python code formatteralejandra
— Nix code formatter
Using make
:
make
Manually:
gcc -o dsgbase main.c file_handling.c user_handling.c
Run:
./dsgbase [OPTIONS]
Activate the dev shell:
nix develop
Then run:
python app.py
Access the app at http://localhost:5000.
-b <json_file> Convert JSON file to binary
-f <binary_file> Specify binary file to search
-n <name> Search by name
-s <surname> Search by surname
-i <id> Search by ID
-r <district> Search by district
-p Print surnames
Convert a JSON file:
./dsgbase -b users.json
Search users by district:
./dsgbase -f users.bin -r Central
Run frontend server:
nix develop
python app.py
.
├── main.c # backend entrypoint
├── file_handling.c/.h # JSON/Binary I/O
├── user_handling.c/.h # User structs & search
├── app.py # Flask frontend
├── templates/ # HTML templates
├── static/ # CSS, JS, images
├── flake.nix # Nix dev environment
├── requirements.txt # Python deps (alt to flake)
├── Makefile
└── ...