nectarinedb v1.1.0
š Nectarine
A YAML-driven API and Database Schema Library
Nectarine is a structured, YAML-based library designed to simplify API and database schema management. It provides a declarative approach for defining RESTful API routes, database queries, and schemas in a structured and human-readable format.
š Features
- YAML-Based API Definition ā Easily define API endpoints using YAML.
- Structured Query Definitions ā Write database queries in a declarative YAML format.
- Database Schema Management ā Define table structures, relationships, and constraints in YAML.
- Stack-Agnostic ā Supports various backends, including Node.js, Express, PostgreSQL, and more.
- Plug-and-Play ā Designed for seamless integration into projects.
š Project Structure
nectarine/
āāā api/ # API route definitions
ā āāā userAPI.yml # API endpoints for user-related operations
ā āāā orderAPI.yml # (Example) API endpoints for orders
ā āāā ...
āāā queries/ # Database queries in YAML format
ā āāā user.yml # User queries
ā āāā order.yml # (Example) Order queries
ā āāā ...
āāā schemas/ # Database schema definitions
ā āāā userSchema.yml # User table schema
ā āāā orderSchema.yml # (Example) Order table schema
ā āāā ...
āāā server.js # Main server file (Node.js/Express)
āāā README.md # Documentation
š§ API Endpoints
The userAPI.yml
file defines REST API endpoints for user operations:
GET Requests
- Retrieve all users:
GET /users
- Find user by ID:
GET /users/:id
- Find user by email:
GET /users/:email
- Find users by city:
GET /users/:city
- Find users by city & state:
GET /users/:state/:city
POST Requests
- Create a new user:
POST /users
PUT Requests
- Update user by ID:
PUT /users/:id
DELETE Requests
- Delete user by ID:
DELETE /users/:id
(See userAPI.yml
for more details)
š¢ļø Database Queries
The user.yml
file contains structured database queries:
Get users by age:
userByAge: type: SELECT fields: - id - name action: FROM table: users conditions: condition: 'WHERE' column: age operator: '>' value: $1
Retrieve all users:
AllUsers: type: SELECT table: users fields: '*'
Update user details by ID:
update: userById: type: UPDATE table: users updates: column: name, age value: $1, $2 conditions: condition: 'WHERE' column: id operator: '=' value: $3
(See user.yml
for more details)
šļø Database Schema
The userSchema.yml
defines table structures:
users:
columns:
- name: id
type: SERIAL
primary: true
- name: name
type: varchar(255)
nullable: false
- name: email
type: varchar(255)
unique: true
- name: age
type: INT
- name: address
type: varchar(255)
nullable: false
- name: city
type: varchar(50)
nullable: false
- name: state
type: varchar(50)
nullable: false
- name: zipcode
type: INT
nullable: false
- name: phone
type: INT
nullable: true
(See userSchema.yml
for more details)
šļø Installation & Usage
Prerequisites
- Node.js
>= 16.x
- PostgreSQL (or compatible database)
Install Dependencies
npm install
Run the Server
node server.js
šļø Future Roadmap
- Add GraphQL support
- Expand multi-database support (MySQL, MongoDB)
- Implement API validation & authentication
- Develop admin dashboard for schema management
š„ Contributing
We welcome contributions! Feel free to submit issues or pull requests.
š License
Nectarine is open-source under the MIT License.
Let me know if you need modifications or additions! š