niledatabase

repository·main·Indexed 22 days ago

https://github.com/niledatabase/niledatabase

A tenant-aware, serverless, and globally distributed Postgres platform designed for B2B applications. It features decoupled storage and compute, tenant virtualization, and built-in support for multi-tenancy and AI vector embeddings.

Tokens
305.8K
Snippets
827
Records
1.2K
Agent score
73%

What's inside niledatabase

  1. Introduction to Postgres concepts in Nile

    main
    Nile provides documentation to help developers understand Postgres and common relational database concepts. This includes learning basic data structures, operations, tools, and best practices for working with Postgres within the Nile ecosystem. Key topics covered include table management, data types, indexing, joins, views, and the Postgres ecosystem tools.
  2. Overview of SupplyAI Use Case

    main

    SupplyAI is a Supply Chain Management (SCM) application designed to streamline procurement, shipping, and sales. It provides end-to-end visibility and incorporates AI features to optimize costs, manage delays, and suggest new vendors or strategies.

    Key capabilities include:

    • Order Management: Placing and tracking orders from global vendors.
    • Shipping Management: Choosing shipment options and tracking progress via fulfillment services (e.g., FedEx, UPS).
    • Sales Integration: Managing sales through channels like Amazon or Shopify.
    • AI-Powered Insights: Optimizing shipping costs, answering queries about shipment delays, and proposing cost-reduction strategies.
  3. Overview of Nile Auth for B2B Applications

    main

    Nile Auth is an open-source B2B authentication solution designed specifically for multi-tenant applications. Unlike traditional auth providers that store user data in isolated third-party APIs, Nile Auth stores user and customer data directly in your Nile Postgres database. This allows for seamless SQL joins between user data and your application's business tables using standard foreign key constraints.

    Key features include:

    • Multi-tenancy support: Built-in management for the entire tenant lifecycle (invitations, tenant-specific settings, domains, etc.).
    • Data Ownership: User and organization data reside in your primary database, avoiding synchronization issues and consistency delays.
    • Scalability: Supports unlimited active users; you only pay for the underlying PostgreSQL database.
    • Security: Uses server-side authentication with Secure, HttpOnly cookies, CSRF protection, and session-backed authentication.
    • Deployment Flexibility: You can use the managed cloud version or self-host the auth service.
  4. Overview of Nile components

    main

    Nile is a Postgres platform designed specifically for multi-tenant B2B applications. Its core components include:

    • Multi-tenant Postgres: A re-engineered Postgres engine optimized for B2B workloads.
    • Tenant Virtualization: Provides isolation and management for individual customer/organization data.
    • Nile Auth: A drop-in B2B authentication solution that stores customer data directly within your Nile Postgres instance.
    • AI Toolkit & Vector Database: A massively scalable vector database supporting customer-specific vector embeddings.
  5. Introduction to Nile

    main

    Nile is a PostgreSQL-based database re-engineered specifically for multi-tenant B2B applications. It provides built-in tenant virtualization, allowing developers to scale to millions of customers and billions of vector embeddings without managing complex Row Level Security (RLS) or manual permission logic in the application layer.

    Key capabilities include:

    • Tenant Virtualization: Built-in isolation for data and vector embeddings.
    • AI-Native Features: Vector embedding with RAG support that auto-scales across customers.
    • Managed Multi-tenancy: Single database usage with tenant-level backups, schema management, and customer insights.
    • Flexible Scaling: Seamless autoscaling (including scaling to zero with no cold start) and the ability to place specific tenants on dedicated compute or in different regions for compliance and latency requirements.
  6. Getting started with pgvector in Nile

    main

    Nile supports the pgvector extension (version 0.8.0) out of the box. This extension allows you to store and perform vector operations directly within your PostgreSQL database alongside your other data. It provides ACID compliance, point-in-time recovery, and seamless integration with Nile's multi-tenant isolation, sharding, and placement rules.

    Key capabilities include:

    • Exact and approximate nearest neighbor search (using HNSW or IVFFlat indexes).
    • Support for single-precision, half-precision, binary, and sparse vectors.
    • Multiple distance metrics: L2, inner product, cosine, L1, Hamming, and Jaccard.
  7. Use the `prefix` extension for efficient prefix search

    main

    The prefix extension provides efficient prefix (starts-with) search functionality in PostgreSQL. It is particularly useful for implementing autocomplete, prefix-based filtering, and telephony applications (e.g., matching phone numbers to carrier prefixes, determining routing paths, or calculating costs).

    Your Nile database arrives with the prefix extension already enabled.

  8. Available Nile SDK Modules

    main

    The Nile JavaScript SDK provides several specialized modules for interacting with the Nile service. Depending on your requirements, you can use these modules to manage authentication, database operations, users, tenants, and routing:

    • Auth: Securely authenticating users.
    • DB: Tenant-aware querying of your database.
    • Users: Managing user profiles and identities.
    • Tenants: Managing tenant entities and multi-tenant structures.
    • Routes: Utilizing built-in or custom routes.
  9. Use the Xicor extension for incremental correlation

    main
    The xicor extension is pre-enabled in your Nile database. It provides the Xi correlation coefficient, which is a robust measure of correlation designed to handle non-linear and monotonic relationships better than traditional Pearson correlation. It returns values between 0 (no correlation) and 1 (perfect monotonic correlation).
  10. PostgreSQL 18 New Features Overview

    main

    PostgreSQL 18 introduces several significant performance and functional improvements, including:

    • Async I/O (with io_uring): Provides 2-3x speedups on sequential scans and vacuums.
    • UUIDv7 Support: Native functions for generating and extracting data from UUIDv7.
    • Skip scan: Optimization for multi-column B-tree indexes and smarter OR/IN optimizations.
    • Virtual generated columns.
    • Enhanced EXPLAIN ANALYZE: Now displays I/O, CPU, and WAL metrics.
    • New Wire Protocol: Version 3.2.
    • Temporal constraints and casefolding for LIKE on nondeterministic collation.
    • OAuth login support.