Self-Hosting
Overview & Configuration

Deployment Overview & Configuration

ℹ️

Each service from Basestack is designed to be self-hosted and run independently. This page provides the necessary information to deploy and configure each service. While most configurations are common across all services, specific configurations unique to each service can be found at the end of this page.

Getting up and running is an easy with various options available. Simply ensure you have a Postgres database and a server that can run Node.js. Customize all the settings of the Basestack Platform by referring to the detailed configuration provided below.

App hosting

You have the flexibility to host the platform on any service capable of hosting NextJS ↗ (opens in a new tab) applications with serverless function support. Additionally, you'll need a separate database running elsewhere that the app can connect to. Some app hosting providers that support include Vercel, more coming, all of which offer a free tier option.

Managed databases

Ensure that the PostgreSQL service or instance supports serverless environments. Any traditional instance of PostgreSQL with connection pooling, such as PgBouncer ↗ (opens in a new tab), will work effectively.

Environment Variables

The platform has a straightforward configuration process, requiring a set of essential environment variables to configure the services and run the platform smoothly.

Database Configuration

PropertyDescriptionRequired
DATABASE_URLConnection URL to your database using PgBouncer.true
DIRECT_DATABASE_URLDirect connection URL to the database used for migrationstrue

Authentication Configuration

General

For the NEXTAUTH_SECRET variable you can use openssl rand -base64 32 or generate a random value (opens in a new tab).

PropertyDescriptionRequiredExample
NEXTAUTH_SECRETUsed to encrypt the NextAuth.js JWT, and to hash email verification tokens.truegenerate (opens in a new tab)
NEXTAUTH_URLSet to the canonical URL of your sitetruehttps://your-basestack-instance.com (opens in a new tab)

Providers

Authentication Providers in the Platform are services that you and your team can use for signing in. To find the list of supported providers, check below:

ℹ️

You can have multiple Auth providers on the platform, providing you with more options. However, it is essential to configure at least one Auth provider for the platform to function properly.

API Configuration

The configurations relevant to the API are associated with the endpoint from the REST API, which enables tasks like fetching the Flags. On the other hand, services concerning the dashboard, members, and permissions are safeguarded by Authentication and can only be accessed from the same origin (CORS).

CORS Configuration

We highly recommend securing the REST API requests to ensure they originate from the same domain as your services. You can modify the variables below to align with your product domains.

PropertyDescriptionRequiredExample
API_ACCESS_CONTROL_ALLOW_ORIGINIndicates whether the response can be shared with requesting code from the given originfalse*

Email Configuration

The Basestack Platform uses SMTP for sending emails. To configure SMTP, set the following environment variables:

ℹ️

You can use any transactional email service, such as SendGrid ↗ (opens in a new tab), Mailgun ↗ (opens in a new tab), or Resend ↗ (opens in a new tab) to send emails.

PropertyDescriptionRequiredExample
EMAIL_FROMSender email address used in outgoing emails.trueHello. <[email protected]>
EMAIL_SMTP_HOSTSMTP server hostname or IP address for sending emails.true
EMAIL_SMTP_PORTSMTP port number used for email transmission.true465
EMAIL_SMTP_SECUREBoolean indicating whether SMTP connection should be secured (e.g., true or false).truefalse
EMAIL_SMTP_AUTH_USERSMTP authentication username for authenticating to the SMTP server.true
EMAIL_SMTP_AUTH_PASSWORDSMTP authentication password for authenticating to the SMTP server.true

Platform-Specific Configuration

The above environment variables are common across all platforms. However, there are specific configurations unique to each platform. Below are the configurations for each platform:

No specific configurations are required for Feature Flags.