yamlDB is a lightweight, API-based NoSQL database that stores data in YAML format. It is designed for simplicity and ease of use, allowing developers to quickly store, retrieve, and manage structured data without requiring a full-scale database server. The database can be interacted with using HTTP APIs.
- File-Based Storage: Data is stored locally in YAML files, making it easy to read and manage.
- No External Dependencies: No need for external servers or installations.
- Platform Support: Works seamlessly on Linux, macOS (Darwin), and Windows.
- API-Driven: Expose REST APIs to interact with the database.
- Pre-Built Binaries: Use ready-made binaries for Darwin, Linux, and Windows for quick and easy setup.
-
Clone the repository:
git clone https://github.com/yash-raj10/yamlDB.git cd yamlDB
-
Build the binary for your platform:
Linux:
GOOS=linux GOARCH=amd64 go build -o yamlDBLI
macOS (Darwin):
GOOS=darwin GOARCH=amd64 go build -o yamlDBDAR
Windows:
GOOS=windows GOARCH=amd64 go build -o yamlDBWIN.exe
-
Move the binary to a directory in your
PATH
(optional):mv yamlDB /usr/local/bin
-
Alternatively, download the pre-built binaries directly from the repository for quick use:
- macOS:
yamldbDAR
- Linux:
yamldbLI
- Windows:
yamldbWIN.exe
Simply download and execute the appropriate binary for your system.
- macOS:
Run the binary to start the database server locally:
./yamldb...
The server will start on http://localhost:8080
by default. You can configure the port in the source code or through flags (if implemented).
-
Find the process ID (PID) of the running instance:
ps aux | grep yamldbLI # For Linux ps aux | grep yamldbDAR # For macOS ps aux | grep yamldbWIN # For Windows
-
Use the kill command to stop the process:
kill <PID>
Verify if the server is running:
GET /
Response:
{
"Update": "working"
}
Endpoint: POST /postData
Headers:
database
: Name of the database.collection
: Name of the collection.
Body:
{
"key": "value",
"anotherKey": "anotherValue"
}
Response:
{
"message": "data saved successfully!",
"Id": "<unique-id>"
}
Endpoint: GET /getData/:database/:collection
Example:
GET /getData/myDatabase/myCollection
Response:
[
{ "id": "123", "key": "value" },
{ "id": "124", "anotherKey": "anotherValue" }
]
Endpoint: GET /getData/:database/:collection/:id
Example:
GET /getData/myDatabase/myCollection/123
Response:
{
"id": "123",
"key": "value"
}
Endpoint: DELETE /delete/:database/:collection/:id
Example:
DELETE /delete/myDatabase/myCollection/123
Response:
{
"message": "item deleted with ID 123"
}
The data is stored in a directory structure like this:
Databases/
myDatabase/
myCollection.yaml
Each collection file contains an array of objects stored in YAML format:
- id: "123"
key: "value"
- id: "124"
anotherKey: "anotherValue"
This project is licensed under the MIT License.