Getting Started
  • Introduction
  • Installation
  • About
Core Concepts
  • Routing System
  • Page Functions
  • Data Fetching
  • Server Components
  • Client Components
Features
  • Dynamic & Query Parameters
  • Navigation
  • Styles & CSS
  • Images
  • Favicons
Configuration
  • Environment Variables
  • Import Aliases
  • Ejecting
dinou logodinou
docs
npmGitHub

Environment Variables

Learn how to use environment variables in dinou.

Overview

dinou is ready to manage env vars in the code that runs on the Server side (Server Functions, Server Components, and getProps function).

Setup

Create an .env file in your project (and add it to your .gitignore file to not expose sensitive data to the public) and define there your env variables:

# .env
# define here your env vars
MY_VAR=my_value

Usage Example

// In Server Components, Server Functions, or getProps
export async function getProps() {
  const myVar = process.env.MY_VAR;
  
  return {
    page: { myVar },
    layout: { title: "My App" }
  };
}

On This Page

OverviewSetup