Skip to content

mutungapeter/Custom-RDMS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Pesapal Junior Dev Challenge ’26 – Custom RDBMS Playground

This repository contains my submission for the Pesapal Junior Developer Challenge 2026. It demonstrates a lightweight relational database management system (RDBMS) built from scratch, with a web interface for CRUD operations.

Both backend and frontend live in the same repository for ease of execution and review.


Challenge Overview

The goal of this challenge was to:

  • Design and implement a simple RDBMS

  • Support:

    • Table creation with data types
    • Primary keys and unique constraints
    • Basic CRUD operations
    • Indexing
    • Joins (basic)
  • Include an interactive REPL

  • Build a web app demonstrating database CRUD

Backend – RDBMS & API

Features

  • In-memory relational tables

  • Supported data types:

    • INT – integer values
    • STR – string values
  • Primary keys

  • Auto-incrementing IDs

  • CRUD operations via REST API:

    • Create (POST)
    • Read (GET)
    • Update (PUT / PATCH)
    • Delete (DELETE)
  • JSON persistence for tables (<table_name>_table.json)

Why FastAPI?

I chose FastAPI because:

  • Lightweight and fast
  • Built-in validation via Pydantic
  • Auto-generated interactive documentation
  • Easy integration with JSON-based RDBMS
  • Allows me to focus on database logic

Run Backend

  1. Create a Python virtual environment:
git clone https://github.com/mutungapeter/Custom-RDMS.git
cd Custom-RDMS
python -m venv venv
source venv/bin/activate      
cd backend
pip install -r requirements.txt
  1. Start FastAPI server:
uvicorn api.main:app --reload
  1. API will be available at:
http://127.0.0.1:8000/docs/

API Endpoints

Tables

Method Endpoint Description
POST /tables/{name} Create a table
DELETE /tables/{name} Delete a table

Records

Method Endpoint Description
GET /tables/{name}/records List all records in table
POST /tables/{name}/records Insert new record(s)
PUT /tables/{name}/records/{id} Replace entire record
PATCH /tables/{name}/records/{id} Update specific fields
DELETE /tables/{name}/records/{id} Delete a record

Interactive REPL

The RDBMS includes a REPL for direct database interaction.

Run REPL

cd backend
python -m db_engine.repl

Example Commands

> CREATE TABLE users
> INSERT INTO users name=John
> INSERT INTO users name=Mary
> SELECT * FROM users
> UPDATE users SET name=Jane WHERE id=1
> DELETE FROM users WHERE id=2

The REPL shows real-time table manipulation without the frontend.


##Frontend – React Web App

The frontend demonstrates CRUD operations using the RDBMS API:

  • Table creation & selection
  • Record creation
  • Record editing (PUT / PATCH)
  • Record deletion
  • Live updates from backend

Built using:

  • React + TypeScript
  • Vite (fast dev server)
  • Tailwind CSS for styling

Run Frontend

  1. Install dependencies:
cd frontend
npm install
  1. Start development server:
npm run dev
  1. Access the app at:
http://localhost:5173

Example Workflow

  1. Create or select a table from the UI
  2. Insert records (auto-increment IDs)
  3. View records in the table
  4. Update records using PUT / PATCH
  5. Delete records
  6. All changes are persisted in JSON files on backend

AI Usage

AI tools were used for:

  • Refactoring code
  • Debugging minor issues

All database design, integration, and frontend logic were implemented and fully understood by me.

Built for the Pesapal Junior Developer Challenge ’26 By: Peter Sikuku

About

A custom relation management system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors