Skip to content

Quick Start Guide

This guide will get you up and running with OstrichDB quickly, covering the basic operations you need to start using the database.

Make sure you have completed the Installation guide and have OstrichDB running on your system.

OstrichDB organizes data in a hierarchical structure:

Projects
└── Collections
└── Clusters
└── Records

Each level serves a specific purpose:

  • Projects: Top-level containers for organizing related data
  • Collections: Groups of related clusters, can be encrypted
  • Clusters: Groups of related records
  • Records: Individual data items with types and values

Projects are the top-level containers in OstrichDB:

Terminal window
curl -X POST http://localhost:8042/api/v1/projects/my-first-project

View all projects:

Terminal window
curl http://localhost:8042/api/v1/projects

Collections group related data within a project:

Terminal window
curl -X POST http://localhost:8042/api/v1/projects/my-first-project/collections/users

Clusters organize records within collections:

Terminal window
curl -X POST http://localhost:8042/api/v1/projects/my-first-project/collections/users/clusters/active-users

Records store the actual data with specified types and values:

Terminal window
# Create a string record
curl -X POST "http://localhost:8042/api/v1/projects/my-first-project/collections/users/clusters/active-users/records/username?type=STRING&value=john_doe"
# Create an integer record
curl -X POST "http://localhost:8042/api/v1/projects/my-first-project/collections/users/clusters/active-users/records/age?type=INTEGER&value=25"
# Create a boolean record
curl -X POST "http://localhost:8042/api/v1/projects/my-first-project/collections/users/clusters/active-users/records/is_active?type=BOOLEAN&value=true"

Get records from a cluster:

Terminal window
curl http://localhost:8042/api/v1/projects/my-first-project/collections/users/clusters/active-users/records

Get a specific record:

Terminal window
curl http://localhost:8042/api/v1/projects/my-first-project/collections/users/clusters/active-users/records/username

OstrichDB supports various data types:

Terminal window
# String
curl -X POST "http://localhost:8042/api/v1/projects/demo/collections/test/clusters/data/records/name?type=STRING&value=Alice"
# Integer
curl -X POST "http://localhost:8042/api/v1/projects/demo/collections/test/clusters/data/records/count?type=INTEGER&value=42"
# Float
curl -X POST "http://localhost:8042/api/v1/projects/demo/collections/test/clusters/data/records/price?type=FLOAT&value=19.99"
# Boolean
curl -X POST "http://localhost:8042/api/v1/projects/demo/collections/test/clusters/data/records/enabled?type=BOOLEAN&value=false"
Terminal window
# Date
curl -X POST "http://localhost:8042/api/v1/projects/demo/collections/test/clusters/data/records/created_date?type=DATE&value=2024-01-15"
# DateTime
curl -X POST "http://localhost:8042/api/v1/projects/demo/collections/test/clusters/data/records/timestamp?type=DATETIME&value=2024-01-15T10:30:00Z"

OstrichDB provides powerful search and filtering capabilities:

Terminal window
curl "http://localhost:8042/api/v1/projects/my-first-project/collections/users/clusters/active-users/records?type=STRING"
Terminal window
curl "http://localhost:8042/api/v1/projects/my-first-project/collections/users/clusters/active-users/records?search=user"
Terminal window
curl "http://localhost:8042/api/v1/projects/my-first-project/collections/users/clusters/active-users/records?value=true"
Terminal window
# Sort by name, descending order
curl "http://localhost:8042/api/v1/projects/my-first-project/collections/users/clusters/active-users/records?sortBy=name&sortOrder=desc"
# Pagination
curl "http://localhost:8042/api/v1/projects/my-first-project/collections/users/clusters/active-users/records?limit=10&offset=0"
Terminal window
curl -X PUT "http://localhost:8042/api/v1/projects/my-first-project/collections/users/clusters/active-users/records/age?value=26"
Terminal window
curl -X DELETE http://localhost:8042/api/v1/projects/my-first-project/collections/users/clusters/active-users/records/age
Terminal window
curl -X DELETE http://localhost:8042/api/v1/projects/my-first-project/collections/users/clusters/active-users

Here’s a complete example of creating a simple user management system:

Terminal window
# 1. Create project
curl -X POST http://localhost:8042/api/v1/projects/user-management
# 2. Create collections
curl -X POST http://localhost:8042/api/v1/projects/user-management/collections/profiles
curl -X POST http://localhost:8042/api/v1/projects/user-management/collections/settings
# 3. Create clusters
curl -X POST http://localhost:8042/api/v1/projects/user-management/collections/profiles/clusters/admins
curl -X POST http://localhost:8042/api/v1/projects/user-management/collections/profiles/clusters/regular-users
# 4. Add admin user data
curl -X POST "http://localhost:8042/api/v1/projects/user-management/collections/profiles/clusters/admins/records/name?type=STRING&value=Administrator"
curl -X POST "http://localhost:8042/api/v1/projects/user-management/collections/profiles/clusters/admins/records/email?type=STRING&value=admin@example.com"
curl -X POST "http://localhost:8042/api/v1/projects/user-management/collections/profiles/clusters/admins/records/role?type=STRING&value=admin"
curl -X POST "http://localhost:8042/api/v1/projects/user-management/collections/profiles/clusters/admins/records/created?type=DATETIME&value=2024-01-15T09:00:00Z"
# 5. Query admin data
curl http://localhost:8042/api/v1/projects/user-management/collections/profiles/clusters/admins/records

Now that you understand the basics:

  1. Explore the Architecture to understand how OstrichDB works internally
  2. Read the API Reference for complete endpoint documentation
  3. Learn about Security features for production use
  4. Review Configuration options for customizing your setup