Configuration

The following documents the possible configurations of Stackpress.

1. Admin Config

The admin configuration is used to brand the admin, change the base URL, and customize the admin menu.
Copy
The following describes the admin configuration options.
Option
Notes
Name of the admin that will be found on the top left of each admin page. It's recommended to use a short name for mobile responsive purposes. Defaults to .
The base URL for the admin section. Defaults to .
A list of menu items to be displayed in the left side of each admin page. Each item is an object with the following properties.
Menu item display name
Menu item icon
Menu item link path URL
Compares the current URL pathname with the given .

2. API Config

The API configuration acts as a gateway between routes and events without any extra coding necessary.
Copy
The API config includes the following options.
Option
Notes
When API sessions expire. This is used with created column in the session table.
Map of scopes to be used with the API following the OAuth specificaitons.
List of API endpoint configurations.
List of webhook configurations.

2.1. Scope Config

Scopes are used to limit access to certain endpoints and can be toggled per application.
Copy
The scope configuration, mainly used for documentation purposes, are as follows.
Option
Notes
Readable friendly name of the scope.
Readable friendly description of the scope.

2.2. Endpoint Config

API endpoints over configuraton act as a gateway that collects the input, calls events and returns its response.
Copy
Each endpoint configuration requires the following parameters.
Option
Notes
The HTTP method to listen to.
The route pattern to listen to.
  • - An open endpoint that does not require any tokens.
  • - An endpoint that requires a client token for GET endpoints and a client token/secret for anything else. (2-legged)
  • - An endpoint that requires a session for GET endpoints and a token/secret for anything else. Auto populates the in the request data based on the session. (3-legged)
A list of scope names that can access this endpoint.
The name of the event to emit when the endpoint is requested.
An object of static data that will add to and override the input keys (if they exist).

2.3. Webhook Config

Webhooks are automated notifications sent from one application to another when a specific event occurs, like a new order, a user signup, or a payment transaction. They act as a lightweight, event-driven communication method, similar to reverse APIs. Instead of constantly polling for updates, the receiving application gets notified instantly when something happens in real-time.
Copy
Each webhook configuration requires the following parameters.
Option
Notes
The event to listen to.
The external URL to call when the event is triggered.
The HTTP method to use when calling the URL.
Checks the results of the event against the validity object. If the results are not valid, the webhook will not be called. The validity object is a map of keys to values. The keys are the names of the columns in the results object. The values are the values to check against.
Data to include in the results of the event. This adds and overrides the output keys (if they exist).

3. Auth Config

The auth configuration is used to customize the functionality of the default auth pages from the Stackpress toolkit.
Copy
The auth config requires the following parameters.
Option
Notes
The base route for the auth pages. This is used to determine the base route for the auth pages. For example, if you set this to , then the signin page will be at .
The default roles for new users. For example, if you set this to , then new users will be assigned the role by default.
Whether to allow signin with username. If this is set to, then users will be able to signin with their username.
Whether to allow signin with email address. If this is set to , then users will be able to signin with their email address.
Whether to allow signin with phone number. If this is set to , then users will be able to signin with their phone number.
The minimum length of the password. For example, if you set this to , then the password must be at least 8 characters long.
The maximum length of the password. For example, if you set this to , then the password must be at most 32 characters long.
When this is set to , the password must contain at least one uppercase letter.
When this is set to , the password must contain at least one lowercase letter.
When this is set to , the password must contain at least one number.
When this is set to , the password must contain at least one special character. For example, .

4. Brand Config

Brand Config is used on all auth and admin pages allowing you to white label everything. This includes the name, logo, icon and favicon.
Copy
The following describes the brand configuration options.
Option
Notes
Brand name of the project. Defaults to .
Brand logo (long) of the project. Defaults to .
Brand icon (square) of the project. Defaults to .
The favicon of the project. Defaults to .

5. Client Config

The client configuration is used to customize the client build process. This includes the build path, the client, language, module name, revision path and tsconfig filepath.
Copy
The following describes the client configuration options.
Option
Notes
Where to save the generated client files. Defaults to .
Language to compile to (ts, js). Defaults to .
Name of the client module. Defaults to .
Pathname of where to save schema revisions. Defaults to .
Filepath to a tsconfig file. This is used to compile the client code. Defaults to .

6. Cookie Config

The cookie configuration is used to customize the cookie settings. This is used by the sessions, theme and i18n toolkit.
Copy
The following describes the cookie configuration options.
Option
Notes
The domain to set the cookie for. This is used to determine the domain for the cookie. For example, if you set this to , then the cookie will be set for .
The expiration date of the cookie. This is used to determine when the cookie will expire. For example, if you set this to , then the cookie will expire on .
When this is set to , the cookie will be marked as HTTP only. This means that the cookie will not be accessible from JavaScript. This is used to prevent cross-site scripting attacks.
The maximum age of the cookie. This is used to determine how long the cookie will be valid for. For example, if you set this to , then the cookie will be valid for 1 hour.
The path to set the cookie for. This is used to determine the path for the cookie. For example, if you set this to , then the cookie will be set for the root path.
The priority of the cookie. This is used to determine the priority of the cookie. For example, if you set this to , then the cookie will be set with high priority.
The same site setting of the cookie. This is used to determine the same site setting for the cookie. For example, if you set this to , then the cookie will be set with strict same site setting.
When this is set to , the cookie will be marked as secure. This means that the cookie will only be sent over HTTPS.

7. Database Config

The database configuration is used to help encrypt/decrypt, generate migrations, and configure the overall database constraints.
Copy
The following describes the database configuration options.
Option
Notes
The seed phrase used to encrypt/decrypt certain values in the database. These columns are marked with either the or property in the schema. Where as represents a one-way hash and represents a two-way hash.
Pathname of where to save the generated migration files. Defaults to .
The default constraint for the database. This is used to determine what happens when a row is deleted. For example, if you set this to , then the row will be deleted from all tables that reference it. Defaults to .
The default constraint for the database. This is used to determine what happens when a row is updated. For example, if you set this to , then the row will be updated in all tables that reference it. Defaults to .

8. Email Config

The email configuration is used by the send event found in the email plugin of the Stackpress toolkit.
Copy
The following describes the email configuration options.
Option
Notes
The host of the email server. This is used to determine the host for the email server. For example, if you set this to , then the email server will be set to .
The port of the email server. This is used to determine the port for the email server. For example, if you set this to , then the email server will be set to.
When this is set to , the email server will be set to use SSL. This is used to determine if the email server should use SSL or not. For example, if you set this to , then the email server will be set to use SSL.
The username of the email server. This is used to determine the username for the email server. This is usually the email address of the user.
The password of the email server. This is used to determine the password for the email server. This is usually the password of the user.

9. Language Config

desc
Copy
The language config accept the following options.
Option
DefaultNotes
URL flag (ie. ?locale) used to change the user's locale this is also the name of the cookie used to store the locale while visiting the application.
The default language used by the application.
A map of possible languages and translations its correlating translations.
Each language has the following required properties.
Option
Notes
The name of the language used by the frontend.
A key value of translations.

10. Server Config

The server config is generally used the Stackpress toolkit.
Copy
The server config accept the following options.
Option
Notes
Pathname of where to generally save the build files. Defaults to .
Pathname of the current working directory. This defaults to
Used to determine the mode for the server. This can be any string value but the Stackpress toolkit only cases for and not .
The port to run the server on. This is used to determine the port for the server. Defaults to .

11. Session Config

The session configuration is used to customize the session settings. This is used by auth and roles & permissions in the Stackpress toolkit.
Copy
The session config required are the following parameters.
Option
Notes
The name of the session cookie. This is used to identify the session cookie in the browser.
The seed used to generate the session ID. This is used to create a unique session id for each user. This should be a random string that is kept secret.
List of access routes for each role.
WARNING: By default all routes are open to all users, but setting the parameter will automatically blacklist all the routes that are not specified on the access list.
Each access config required are the following parameters.
Option
Notes
The HTTP method of the route to white-list.
The route pattern to white-list.
For example, the following configuration describes that admins have access to the home page, and all auth, admin, API routes. Regular users have access to the home page, and all auth, API routes. Guests have access to the home page, and all auth routes.
Copy

12. View Config

The view configuration is used to customize everything specifically related to views.
Copy
The view config accept the following options.
Option
Notes
URL query flag (ie. ?json) used to disable template rendering and show the raw json data instead. Defaults to .
Used by vite and in development mode to determine the root of the project. Defaults to .
One of , , , , ,
Delay in ms to close the toast. If set to false, the notification needs to be closed manually.
Display or not the progress bar below the toast (remaining time).
Dismiss toast on click
Keep the timer running or not on hover
Allow toast to be draggable
One of , ,
Pathname where to save assets (css, images, etc)
Base pathname (used in vite).
Pathname where to save the client scripts (js)
Client script route prefix used in the document markup.
Template wrapper for the client script (tsx)
List of CSS files to include in all views.
Style route prefix used in the document markup.
Template wrapper for the document markup (html)
Pathname where to save and load the server script (js).
Template wrapper for the page script (tsx).
Vite plugins
Original vite options (overrides other settings related to vite).
Ignore files in watch mode

13. Typings

The following describes the configuration typings.
Copy