Skip to main content

Set Up .env

Requirements

Before you begin, ensure that your computer has the following software installed.

Environment Variables

Before initiating the installation process, ensure all environment variables are added. If you don't set all the environment variables, some of the features may not work as expected.

NODE_ENV=
PURCHASE_CODE=
NEXT_PUBLIC_BASE_URL=
NEXT_PUBLIC_UPLOAD_URL=

SITE_URL=
DATABASE_URL=

# Email
SMTP_HOST=
SMTP_PORT=
SMTP_USER=
SMTP_PASSWORD=
SMTP_FROM_EMAIL=


# Google
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_REDIRECT_URI=http://localhost:3000/login/google/callback

# Stripe
PAYMENTS_SECRET_KEY=

# File Upload
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
BUCKET_NAME=
AWS_REGION=
UPLOAD_URL=

#Stripe
NEXT_PUBLIC_STRIPE_PUBLIC_KEY=
STRIPE_SECRET_KEY=
STRIPE_WEBHOOKS_SECRET=

NEXT_PUBLIC_RECAPTCHA_SITE_KEY=
RECAPTCHA_SECRET_KEY=
NEXT_PUBLIC_APP_NAME=

# Toogle Teams
NEXT_PUBLIC_ENABLE_TEAMS=true

# Clouflare R2 file upload

NEXT_PUBLIC_CLOUDFLARE_URL=
CLOUDFLARE_ENDPOINT=
CLOUDFLARE_ACCESS_KEY_ID=
CLOUDFLARE_SECRET_ACCESS_KEY=
R2_BUCKET_NAME=


Setting Environment Variables

Open your terminal, navigate to the root directory of the project and execute the following command:

cp .env.example .env

This command copies the provided example file for local environment variables. Now, proceed to fill in the values for the following environmental variables in the newly created .env file. You may use AWS S3 bucket as your file upload or you may use Cloudflare R2 bucket for file upload .Depanding on your integration fill up those environment values.

After environment set up kindly run you Docker desktop app and run docker-compose up -d command

Environment Variables

Here are the environment variables used in the project:

General Configuration

  • NODE_ENV: Environment mode of the application.NODE_ENV should be development or production based on your application runtime environment
  • PURCHASE_CODE: Copy and paste your item purchase code for filekit
  • NEXT_PUBLIC_BASE_URL: Base URL of the application.NEXT_PUBLIC_BASE_URL should be set to your project's base URL. During development, it commonly defaults to http://localhost:3000. However, in a production environment, ensure to update it to match the URL of your deployed application.
  • NEXT_PUBLIC_UPLOAD_URL: Upload URL for file uploads.NEXT_PUBLIC_UPLOAD_URL should be the link you provided in your project's AWS S3 UPLOAD_URL or Cloudflare R2 NEXT_PUBLIC_CLOUDFLARE_URL .
  • SITE_URL: URL of the site or http://localhost:3000.
  • DATABASE_URL: URL of your postgress database.usually the URL should look something like this postgresql://root:root@127.0.0.1/filekit

Email Configuration

  • SMTP_HOST: Hostname of the SMTP server for sending emails.
  • SMTP_PORT: Port number of the SMTP server.
  • SMTP_USER: Username for SMTP authentication.
  • SMTP_PASSWORD: Password for SMTP authentication.
  • SMTP_FROM_EMAIL: Default sender email address for outgoing emails.

Make sure that in .env file configuration for your SMTP server is properly filled up .

SMTP_HOST=your-smtp-host
SMTP_PORT=your-smtp-port
SMTP_USER=your-username
SMTP_PASSWORD=your-password
SMTP_FROM_EMAIL=no-reply@localhost.dev

Google OAuth Configuration

  • GOOGLE_CLIENT_ID: Client ID for Google OAuth authentication.GOOGLE_CLIENT_ID is your project's Google API client ID. During development, use a test ID, and for production, obtain the official ID from the Google Developer Console
  • GOOGLE_CLIENT_SECRET: Client secret for Google OAuth authentication.GOOGLE_CLIENT_SECRET is your project's confidential key for secure communication with the Google API. During development, use a test secret; for production, obtain the official one from the Google Developer Console
  • GOOGLE_REDIRECT_URI: Redirect URI for Google OAuth callback.This should be http://localhost:3000/login/google/callback or http://your-site-link/login/google/callback

Follow documentation for Google Developer Console

Stripe Configuration

  • PAYMENTS_SECRET_KEY: Secret key for Stripe payment processing.

  • NEXT_PUBLIC_STRIPE_PUBLIC_KEY: Public key for Stripe.

  • STRIPE_SECRET_KEY: Secret key for Stripe.

  • STRIPE_WEBHOOKS_SECRET: Secret for verifying Stripe webhooks.

Follow Stripe Documentation

File Upload Configuration using Cloudflare R2

  • NEXT_PUBLIC_CLOUDFLARE_URL: URL for Cloudflare.
  • CLOUDFLARE_ENDPOINT: Endpoint for Cloudflare.
  • CLOUDFLARE_ACCESS_KEY_ID: Access key ID for Cloudflare.
  • CLOUDFLARE_SECRET_ACCESS_KEY: Secret access key for Cloudflare.
  • R2_BUCKET_NAME: Name of the R2 bucket.

Follow Cloudflare R2 Documentation

File Upload Configuration using AWS S3

  • AWS_ACCESS_KEY_ID: Access key ID for AWS S3.
  • AWS_SECRET_ACCESS_KEY: Secret access key for AWS S3.
  • BUCKET_NAME: Name of the AWS S3 bucket.
  • AWS_REGION: AWS region.
  • UPLOAD_URL: URL for file uploads.

AWS S3 Documentation

reCAPTCHA Configuration

  • NEXT_PUBLIC_RECAPTCHA_SITE_KEY: Site key for reCAPTCHA.
  • RECAPTCHA_SECRET_KEY: Secret key for reCAPTCHA.

Other Configuration

  • NEXT_PUBLIC_APP_NAME: Name of the application.

  • NEXT_PUBLIC_ENABLE_TEAMS: Toggle for enabling teams feature.