A lightweight Redis-inspired database written in pure Python, designed for small-scale applications needing simple persistence.
- Redis-like commands:
SET
,GET
,DEL
,EXPIRE
, etc. - Auto-persistence: Saves data to JSON for more read (
tdb.json
). - Server/Client mode: Runs as a standalone service.
- Zero dependencies: Pure Python (≥ 3.6).
- Autosaving system: Saves automatically the database (by default every 15 minutes).
- Cookie's management system: Has a cookie's management system for logins and more!
pip install tinrux
Make a new db:
tinrux server localhost 5000 new
Start a saved server:
tinrux server localhost 5000
Interactive client:
tinrux client localhost 5000
Python example:
(localhost:5000)>>> SET greeting "Hello Tinrux"
OK
(localhost:5000)>>> GET greeting
Hello Tinrux
Tinrux uses JSON for persistance due to several key advantages:
- Human-readable format: JSON files are easy to inspect and modify manually, making debugging and testing more straightforward.
- Language interoperability: JSON is widely supported across programming languages, allowing easy data export or import into other systems.
- Lightweight and structured: Perfect for small-scale applications where full databse engines are overkill, but a clear and structured format is still needed.
- Built-in support in Python: Using Python's standard
json
module eliminates the need for external dependencies and ensures compatibility.
This choice aligns with Tinrux's philosophy of simplicity, transparency and minimalism.
Command | Description | Example |
---|---|---|
SET | Store a value | SET key value |
GET | Retrieve a value | GET key |
DEL | Delete a key | DEL key |
EXPIRE | Set key expiration (sec) | EXPIRE key 10 |
SAVE | Manual data persistence | SAVE |
HELP | Help command | HELP |
tinrux/
├── src/
│ └── tinrux/
│ ├── tinruxClient.py # Connection handler
│ ├── tinruxServer.py # Core database engine
│ ├── __about__.py # version
│ ├── __init__.py # packet
│ └── cli.py # Command-line interface
tinrux
is distributed under the terms of the GPLv3 license.
GNU General Public License v3.0 - See LICENSE.txt.
Make pull request to be here!