### Get started with Node.js Source: https://thenile.dev/docs/getting-started/getting-started Provides a link to the Node.js getting started guide for The Nile. ```HTML } > Get started with Node ``` -------------------------------- ### Get started with Python Source: https://thenile.dev/docs/getting-started/getting-started This section provides an introduction to getting started with Python, a versatile programming language. It likely covers installation and basic Python syntax. ```python print("Hello, World!") def greet(name): print(f"Hello, {name}!") greet("Alice") ``` -------------------------------- ### Get started with NextJS Source: https://thenile.dev/docs/getting-started/getting-started This section offers a guide to starting with NextJS, a popular React framework for building server-rendered applications. It covers project setup and basic usage. ```javascript npx create-next-app@latest my-app cd my-app npm run dev ``` -------------------------------- ### Clone Example Prisma Project Source: https://thenile.dev/docs/getting-started/schema_migrations/prisma Command to clone the example Prisma project from GitHub for migration scenarios. ```bash git clone https://github.com/niledatabase/niledatabase cd niledatabase/examples/migrations/prisma ``` -------------------------------- ### Get started with Python Source: https://thenile.dev/docs/getting-started/getting-started Provides a link to the Python getting started guide for The Nile. ```HTML } > Get started with Python ``` -------------------------------- ### Initialize New Prisma Project Source: https://thenile.dev/docs/getting-started/schema_migrations/prisma Steps to create a new project, install TypeScript and Prisma, and initialize Prisma with a PostgreSQL datasource provider. ```bash mkdir hello-prisma cd hello-prisma # Initialize a new npm project npm init -y # Install and initialize typescript npm install typescript tsx @types/node --save-dev npx tsc --init # Install and initialize Prisma npm install prisma --save-dev npx prisma init --datasource-provider postgresql ``` -------------------------------- ### Get started with Prisma Source: https://thenile.dev/docs/getting-started/getting-started This section guides users on how to begin using Prisma, a next-generation ORM for Node.js and TypeScript. It covers schema definition and client generation. ```bash npm install prisma --save-dev npx prisma init npx prisma generate ``` -------------------------------- ### Get started with SQL Source: https://thenile.dev/docs/getting-started/getting-started This section provides guidance on getting started with SQL. It likely covers basic SQL commands and concepts for database interaction. ```SQL SELECT column1, column2 FROM table_name; INSERT INTO table_name (column1, column2) VALUES (value1, value2); UPDATE table_name SET column1 = value1 WHERE condition; DELETE FROM table_name WHERE condition; ``` -------------------------------- ### Clone Nile Repository and Setup Environment (Bash) Source: https://thenile.dev/docs/getting-started/examples/task_genius Provides bash commands to clone the Nile database repository, navigate to the Python quickstart example, and set up the project environment. This includes copying the environment file and installing dependencies. ```bash git clone https://github.com/niledatabase/niledatabase cd niledatabase/examples/quickstart/python ``` -------------------------------- ### Basic Authentication Setup Example Source: https://thenile.dev/docs/cli/using_auth A step-by-step example demonstrating a basic authentication setup using Nile CLI for a Next.js application. ```bash # Create new Next.js app with authentication nile auth quickstart --nextjs # Generate environment variables nile auth env --output .env.local # Start the development server cd nile-app npm run dev ``` -------------------------------- ### PostgreSQL Connection String Source: https://thenile.dev/docs/getting-started/postgres_docker Example of a PostgreSQL connection string using default or configured environment variables for the Nile Docker container. ```bash psql postgres://00000000-0000-0000-0000-000000000000:mypassword@127.0.0.1:5432/mydatabase ``` -------------------------------- ### Nile CLI Quick Start Source: https://thenile.dev/docs/cli/introduction Basic commands to verify installation, log in, and list databases. ```bash # Verify installation nile --version # Login to Nile nile connect login # List your databases nile db list ``` -------------------------------- ### Get started with Drizzle Source: https://thenile.dev/docs/getting-started/getting-started This section provides instructions for getting started with Drizzle, a lightweight SQL ORM for Node.js. It focuses on setting up Drizzle with your database. ```javascript npm install drizzle-orm # Followed by database-specific setup ``` -------------------------------- ### Environment Setup and Dependencies Source: https://thenile.dev/docs/integrations/lambda Bash commands to clone the Nile serverless example repository, set up the environment variables by renaming and configuring .env, and install project dependencies using npm. ```bash git clone https://github.com/niledatabase/niledatabase cd niledatabase/examples/serverless/lambda-drizzle ``` ```bash npm install ``` -------------------------------- ### Project Setup and Environment Configuration Source: https://thenile.dev/docs/integrations/nextauth Guides through cloning the NextAuth example project, setting up the environment variables in `.env.local`, and configuring database credentials and authentication provider details (SMTP for email, GitHub for OAuth). ```bash npx create-next-app -e https://github.com/niledatabase/niledatabase/tree/main/examples/user_management/NextAuth todo-nextauth cd nile-todo # Rename .env.local.example to .env.local and update with: # NEXTAUTH_SECRET # SMTP_USER, SMTP_PASSWORD, SMTP_HOST, SMTP_PORT, EMAIL_FROM (for email auth) # GITHUB_ID, GITHUB_SECRET (for GitHub OAuth) # NILE_DB_HOST, NILE_USER, NILE_PASSWORD, NILE_DATABASE ``` -------------------------------- ### Clone Repository and Set Up Environment Source: https://thenile.dev/docs/getting-started/languages/drizzle Provides bash commands to clone the Nile database examples repository, navigate to the Drizzle quickstart directory, rename the environment file, and install project dependencies using npm. ```bash git clone https://github.com/niledatabase/niledatabase cd niledatabase/examples/quickstart/drizzle ``` ```bash npm install ``` -------------------------------- ### Local Nile Setup with Docker Source: https://context7_llms Instructions for getting started with Nile's PostgreSQL platform locally using Docker. This documentation guides users through setting up a development environment. ```APIDOC Nile_Docker_Setup: Environment: Local development Tool: Docker Objective: Set up Nile PostgreSQL locally. Steps: 1. Install Docker. 2. Pull the Nile Docker image. 3. Run a Nile container. 4. Connect to the local PostgreSQL instance. ``` -------------------------------- ### Run Nile Docker Container Source: https://thenile.dev/docs/getting-started/postgres_docker Starts a Docker container with Nile extensions and Auth enabled. It automatically pulls the latest image and sets up the 'test' database and a default user if it's the first run. ```bash docker run -p 5432:5432 -p 3000:3000 -ti ghcr.io/niledatabase/testingcontainer:latest ``` -------------------------------- ### Installing Nile SDK Dependencies (Bash) Source: https://thenile.dev/docs/auth/quickstart This command installs the required npm packages for integrating Nile Auth into a React/Next.js application. `@niledatabase/server` provides server-side functionalities for authentication, while `@niledatabase/react` offers React components for UI integration. ```bash npm install @niledatabase/server @niledatabase/react ``` -------------------------------- ### Clone Example Project and Install Dependencies Source: https://thenile.dev/docs/getting-started/schema_migrations/drizzle Clones the Drizzle Kit example project and installs necessary npm packages including `drizzle-kit`, `drizzle-orm`, `dotenv`, and `pg-node`. Requires a PostgreSQL database connection string in a `.env` file. ```bash git clone https://github.com/niledatabase/niledatabase.git cd examples/migrations/drizzle npm i ``` -------------------------------- ### Configure Environment Variables Source: https://thenile.dev/docs/getting-started/schema_migrations/prisma Instructions to create a .env file and add the DATABASE_URL for database connection. ```bash # Create a .env file touch .env # Add your database connection string to the .env file echo "DATABASE_URL='postgresql://user:password@host:5432/dbname'" >> .env ``` -------------------------------- ### Project Setup and Environment Configuration Source: https://thenile.dev/docs/getting-started/examples/sales_insight Instructions for setting up the project environment, including cloning the repository, creating a `.env` file with database connection details, and installing dependencies. ```bash git clone https://github.com/niledatabase/niledatabase.git cd niledatabase/examples/sales_insight ``` ```bash DATABASE_URL=postgresql://user:password@us-west-2.db.thenile.dev:5432/mydb ``` ```bash pip install -r requirements.txt ``` -------------------------------- ### Nile CLI Initial Tenant Setup Workflow Source: https://thenile.dev/docs/cli/managing_tenants Illustrates a common workflow for setting up initial tenants in Nile, including creating a main tenant, additional tenants, and verifying their creation. ```bash # 1. Create main tenant nile tenants create --name "Main Customer" # 2. Create additional tenants nile tenants create --name "Customer A" nile tenants create --name "Customer B" # 3. Verify creation nile tenants list ``` -------------------------------- ### Clone Repository and Set Up Environment Source: https://thenile.dev/docs/getting-started/languages/python Provides bash commands to clone the Nile database repository, navigate to the Python quickstart example, and configure environment variables by copying and editing the .env.example file. ```Bash git clone https://github.com/niledatabase/niledatabase cd niledatabase/examples/quickstart/python ``` ```Bash DATABASE_URL=postgresql://user:password@db.thenile.dev:5432/mydb LOG_LEVEL=DEBUG SECRET_KEY = "09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7" ALGORITHM = "HS256" ACCESS_TOKEN_EXPIRE_MINUTES = 30 # for AI estimates AI_API_KEY=your_api_key_for_openai_compatible_service AI_BASE_URL=https://api.fireworks.ai/inference/v1 AI_MODEL=accounts/fireworks/models/llama-v3p1-405b-instruct EMBEDDING_MODEL=nomic-ai/nomic-embed-text-v1.5 ``` ```Bash python -m venv venv source venv/bin/activate ``` ```Bash pip install -r requirements.txt ``` -------------------------------- ### Example API Request Source: https://thenile.dev/docs/getting-started/languages/prisma An example `curl` command to demonstrate making a GET request to an API endpoint that utilizes tenant context for data retrieval. ```bash curl -X GET \ 'http://localhost:3001/api/tenants/108124a5-2e34-418a-9735-b93082e9fbf2/todos' ``` -------------------------------- ### Define Custom Prisma Model Source: https://thenile.dev/docs/getting-started/schema_migrations/prisma Example of how to define a custom model, 'posts', in the schema.prisma file, including fields and constraints. ```prisma model posts { id String @default(dbgenerated("public.uuid_generate_v7()")) @db.Uuid tenant_id String @db.Uuid title String content String? authorId String @@id([id, tenant_id]) } ``` -------------------------------- ### Getting Started with Nile: Schema Migrations Source: https://context7_llms Guides on implementing schema migrations using various tools and frameworks with Nile. This includes Alembic, Django, Drizzle, and Prisma. ```English Schema Migrations with Alembic Schema Migrations with Django Schema Migrations with Drizzle Schema Migrations with Prisma ``` -------------------------------- ### Install Dependencies Source: https://thenile.dev/docs/auth/contributing/develop Installs all necessary project dependencies using npm. This command should be run after cloning the repository. ```bash npm install ``` -------------------------------- ### Create Tenants and Insert Data Source: https://thenile.dev/docs/getting-started/postgres_docker SQL commands to insert data into the 'tenants' and 'todos' tables, demonstrating tenant creation and data association. ```sql -- Creating the first tenant insert into tenants (id, name) values ('d24419bf-6122-4879-afa5-1d9c1b051d72', 'my first customer'); select * from tenants; -- adding a todo item for this tenant insert into todos (tenant_id, title, estimate, embedding, complete) values ('d24419bf-6122-4879-afa5-1d9c1b051d72', 'feed my cat', '1h', '[1,2,3]', false); select * from todos; -- creating my second tenant insert into tenants (id, name) values ('7e93c45f-fe65-4f26-8ab6-922850fa4c7a', 'second customer'); select * from tenants; insert into todos (tenant_id, title, estimate, embedding, complete) values ('7e93c45f-fe65-4f26-8ab6-922850fa4c7a', 'take out the trash', '2h', '[0.8,0.2,0.6]', false); select * from todos; ``` -------------------------------- ### Troubleshooting: Changing Port Mapping Source: https://thenile.dev/docs/getting-started/postgres_docker Provides an example of how to change the port mapping for the Docker container to avoid conflicts with other PostgreSQL instances and connect to the new port. ```bash docker run -p 5433:5432 -ti ghcr.io/niledatabase/testingcontainer:latest psql postgres://00000000-0000-0000-0000-000000000000:password@localhost:5433/test ``` -------------------------------- ### Clone Repository and Set Environment Variables Source: https://thenile.dev/docs/getting-started/languages/prisma Provides bash commands to clone the Nile database repository, navigate to the Prisma quickstart example, and set up the .env file with database connection details and AI vendor configurations. ```bash git clone https://github.com/niledatabase/niledatabase cd niledatabase/examples/quickstart/prisma ``` ```bash DATABASE_URL=postgres://018b778a-30df-7cdd-b55c-2f9664db39f3:ff3fb983-683c-4616-bbbc-519d8ddbbce5@db.thenile.dev:5432/gwen_db # for AI estimates AI_API_KEY=your_api_key_for_openai_compatible_service AI_BASE_URL=https://api.fireworks.ai/inference/v1 AI_MODEL=accounts/fireworks/models/llama-v3p1-405b-instruct EMBEDDING_MODEL=nomic-ai/nomic-embed-text-v1.5 ``` -------------------------------- ### Set Up Environment Variables Source: https://thenile.dev/docs/auth/contributing/develop Copies the example environment file to create a new environment file for local development. This is crucial for configuring the application's settings. ```bash cp .env.example .env ``` -------------------------------- ### Start Development Server Source: https://thenile.dev/docs/auth/contributing/develop Starts the local development server, allowing you to see your changes in real-time. This command is used for running the project locally. ```bash npm run dev ``` -------------------------------- ### Generate Prisma Client Source: https://thenile.dev/docs/getting-started/schema_migrations/prisma Command to generate the Prisma client, which provides type-safe database access. ```bash npx prisma generate ``` -------------------------------- ### Running the Next.js Development Server (Bash) Source: https://thenile.dev/docs/auth/quickstart This command starts the Next.js development server, making the application accessible locally, typically at `localhost:3000`. It enables hot-reloading and provides a development environment for testing the integrated Nile Auth functionalities. ```bash npm run dev ``` -------------------------------- ### Docker Container Configuration Source: https://thenile.dev/docs/getting-started/postgres_docker Configure the Nile Docker container using environment variables for database name, ID, username, and password. The example shows how to set custom values for database name and password. ```bash docker run -p 5432:5432 -ti \ -e NILE_TESTING_DB_NAME=mydatabase \ -e NILE_TESTING_DB_PASSWORD=mypassword \ ghcr.io/niledatabase/testingcontainer:v0.0.2 ``` -------------------------------- ### Install Dependencies and Run Application (Bash) Source: https://thenile.dev/docs/integrations/stripe These bash commands install the necessary Node.js dependencies for the Next.js application using npm and then start the development server. Ensure you have Node.js version 18 or above. ```bash npm install npm run dev ``` -------------------------------- ### Install and Setup Modal CLI Source: https://thenile.dev/docs/integrations/modal Bash commands to install the Modal Python package and set up the Modal command-line interface. This is a prerequisite for using Modal for serverless compute. ```Bash pip install modal modal setup ``` -------------------------------- ### Nile Examples Overview Source: https://thenile.dev/docs/getting-started/getting-started This section provides an overview of various AI-native B2B application examples built with Nile. Each example is a fully functional application that can be forked for learning or used via a live demo. ```N/A } /> } /> <g id="task"> <circle cx={26} cy={46} r={3.648} className="cls-1" /> <path d="M7 59h38V5H7Zm29.884-11.407a1 1 0 0 1-.777.832l-1.288.28a9.285 9.285 0 0 1-.67 1.618l.713 1.109a1 1 0 0 1-.04 1.138 10.975 10.975 0 0 1-2.252 2.252 1 1 0 0 1-1.138.04l-1.108-.714a9.259 9.259 0 0 1-1.619.671l-.28 1.288a1 1 0 0 1-.832.777 10.971 10.971 0 0 1-3.186 0 1 1 0 0 1-.832-.777l-.28-1.288a9.289 9.289 0 0 1-1.618-.67l-1.109.713a1 1 0 0 1-1.138-.04 10.974 10.974 0 0 1-2.252-2.252 1 1 0 0 1-.04-1.138l.714-1.108a9.259 9.259 0 0 1-.671-1.619l-1.288-.28a1 1 0 0 1-.777-.832 10.971 10.971 0 0 1 0-3.186 1 1 0 0 1 .777-.832l1.288-.28a9.287 9.287 0 0 1 .67-1.618l-.713-1.109a1 1 0 0 1 .04-1.138 10.975 10.975 0 0 1 2.252-2.252 1 1 0 0 1 1.138-.04l1.108.714a9.254 9.254 0 0 1 1.619-.671l.28-1.288a1 1 0 0 1 .777.832 10.975 10.975 0 0 1 0 3.186ZM11 8a1 1 0 0 1 1-1h28a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H12a1 1 0 0 1-1-1Zm1 15h28a1 1 0 0 1 0 2H12a1 1 0 0 1 0-2Zm0 4h28a1 1 0 0 1 0 2H12a1 1 0 0 1 0-2Zm0 4h28a1 1 0 0 1 0 2H12a1 1 0 0 1 0-2Z" className="cls-1" /> <path d="M46 3H6a1 1 0 0 0-1 1v56a1 1 0 0 0 1 1h40a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1Zm-1 56H7V5h38Z" /> <path d="M51 17h6v34h-6z" className="cls-2" /> <path d="M51 56a3 3 0 0 0 6 0v-3h-6Z" style={{ fill: "#f03800", }} /> <path d="M51.387 15h5.226L54 7.162 51.387 15z" style={{ fill: "#ffcebf", }} /> </svg>} /> </CardGroup> ``` -------------------------------- ### Build UI Assets and Run FastAPI Application Source: https://thenile.dev/docs/getting-started/languages/python Contains bash commands to build the frontend UI assets using npm and then start the FastAPI backend application using uvicorn. This is the final step to get the application running. ```Bash cd ui npm install npm run build ``` ```Bash uvicorn main:app --reload ``` -------------------------------- ### Custom Nile Postgres Connection String Source: https://thenile.dev/docs/getting-started/postgres_docker This `psql` connection string demonstrates how to connect to the Nile Postgres instance when its database name and password have been customized via environment variables during Docker container setup. It reflects the new `mydatabase` and `mypassword`. ```bash psql postgres://00000000-0000-0000-0000-000000000000:mypassword@127.0.0.1:5432/mydatabase ``` -------------------------------- ### Prisma ORM Authentication Example Source: https://thenile.dev/docs/auth/examples Illustrates how to authenticate with Nile Database using Prisma ORM. This example would cover Prisma schema setup and connection configuration for Nile. ```SVG <svg xmlns="http://www.w3.org/2000/svg" width={36} height={36} viewBox="0 0 32 32" > <title>{"file_type_prisma"} ``` ```TypeScript {"file_type_prisma"} } > Auth with Prisma ``` -------------------------------- ### Custom Authentication Flow Example Source: https://thenile.dev/docs/cli/using_auth Example for setting up a custom authentication flow in a Next.js application using Nile, including manual package installation and configuration. ```bash 1. Create a new Next.js app manually ```bash npx create-next-app@latest my-app cd my-app ``` 2. Install Nile packages ```bash npm install @niledatabase/server @niledatabase/react @niledatabase/client ``` 3. Generate environment variables ```bash nile auth env --output .env.local ``` 4. Set up API routes and components manually ```bash mkdir -p app/api/[...nile] # Add nile.ts and route.ts files # Customize authentication components ``` ``` -------------------------------- ### Deploy Prisma Migrations to Nile Source: https://thenile.dev/docs/getting-started/schema_migrations/prisma This command deploys all pending Prisma migrations to the Nile database, applying the schema changes. ```bash npx prisma migrate deploy ``` -------------------------------- ### Create Tenant-Aware Table Source: https://thenile.dev/docs/getting-started/postgres_docker SQL statement to create a 'todos' table with a tenant_id column, suitable for tenant-aware data management in Nile. ```sql CREATE TABLE IF NOT EXISTS "todos" ( "id" uuid DEFAULT gen_random_uuid(), "tenant_id" uuid, "title" varchar(256), "estimate" varchar(256), "embedding" vector(3), "complete" boolean, CONSTRAINT todos_pkey PRIMARY KEY ("tenant_id","id") ); ``` -------------------------------- ### Push Schema Changes Source: https://thenile.dev/docs/getting-started/schema_migrations/prisma Command to push local schema changes to the database. ```bash npx prisma db push ``` -------------------------------- ### Configuration Precedence Example Source: https://thenile.dev/docs/cli/setting_configs Demonstrates the order of precedence for configuration settings: command-line flags > environment variables > configuration file > default values. ```bash # Environment variable set export NILE_WORKSPACE=production # Command-line flag overrides environment nile config --workspace development # Result: workspace is set to "development" ``` -------------------------------- ### Install Nile Packages Source: https://thenile.dev/docs/auth/getting-started/installation Installs the Nile database server and client packages using different package managers. ```bash npm install @niledatabase/server @niledatabase/client ``` ```bash yarn add @niledatabase/server @niledatabase/client ``` ```bash pnpm add @niledatabase/server @niledatabase/client ``` -------------------------------- ### Install Nile CLI Source: https://thenile.dev/docs/cli/introduction Instructions for installing the Nile CLI using npm, yarn, or bun. ```bash # Using npm (recommended) npm install -g niledatabase # Using yarn yarn global add niledatabase # Using bun bun install -g niledatabase ```