Skip to main content
The nile auth commands help you set up and manage authentication in your applications. These commands streamline the process of adding multi-tenant authentication to your projects and managing authentication-related configurations.

Overview

Quick Start Guide

The quickstart command helps you create a new application with Nile authentication pre-configured. Currently supports Next.js applications.

Creating a Next.js Application with Authentication

This command will:
  1. Create a new Next.js application
  2. Set up database credentials
  3. Install required Nile packages
  4. Configure API routes
  5. Add authentication components
  6. Start the development server

What Gets Created

The quickstart command sets up the following structure:

Authentication Components

The command sets up a basic authentication page with:

Environment Variables

The env command helps you generate and manage authentication-related environment variables.

Generating Environment Variables

Generated Variables

The command creates the following environment variables:

Best Practices

  1. Environment Variables
    • Always use --output flag to save variables to .env.local
    • Add .env.local to your .gitignore
    • Never commit sensitive credentials to version control
  2. Authentication Components
    • Customize the authentication UI to match your application’s design
    • Add additional fields to the sign-up form as needed
    • Implement proper error handling
  3. Security
    • Keep your database credentials secure
    • Regularly rotate credentials using nile auth env
    • Use environment variables for all sensitive information

Troubleshooting

Common Issues

  1. Quickstart Command Fails
  2. Environment Variables Not Working
  3. Authentication Components Not Showing
  • nile connect login - Connect to Nile using browser-based authentication
  • nile local start - Start local development environment
  • nile config - Configure workspace and database settings

Examples

Basic Authentication Setup

Custom Authentication Flow

  1. Create a new Next.js app manually
  2. Install Nile packages
  3. Generate environment variables
  4. Set up API routes and components manually

API Reference

nile auth quickstart

Options:
  • --nextjs - Create a Next.js application (required)

nile auth env

Options:
  • --output <file> - Save variables to a file (optional)

Further Reading