Starts the Slicknode GraphQL API and serves HTTP requests.
- PostgreSQL: You need to have a running PostgreSQL database server that can be accessed from the computer that runs the Slicknode GraphQL API. Check out the PostgreSQL Documentation to learn how to setup PostgreSQL for your operating system.
- S3 File Storage: If you need asset storage in your project, for example for the
filemodule, you need to add the storage bucket configuration. Slicknode uses S3 (or an S3 compatible storage) for object storage. You can either configure credentials for an AWS S3 bucket that is hosted in the cloud, or use something like Minio if you want to host the files yourself or locally.
To start the Slicknode GraphQL API in production mode on port 3000 for example, run the following command:
slicknode start -p 3000 --database-url postgresql://user:secret@localhost/dbname
Adjust the credentials in the database URL to point to your PostgreSQL server.
For development, you can start the server in watch mode by adding the
-w) option. This automatically reloads all code and schema files and updates the GraphQL API without restarting the server.
slicknode start -p 3000 --database-url postgresql://user:secret@localhost/dbname --watch
If you want to automatically apply database migrations as soon as any schema file in your system is saved, you can add the option
--force-migrate. This allows you to quickly iterate on your schema.
Important: Only use this during development as all database migrations will be applied immediately without warning. Deleting a field or type will remove all data irreversibly.
slicknode start -p 3000 --database-url postgresql://user:secret@localhost/dbname --watch --force-migrate
The server can be configured and customized in several ways. The configuration options are evaluated in the following order:
- Command Arguments: Configuration options passed as command arguments have the highest priority. You can pass them to the
slicknode start --option-name value
Environment Variables: You can configure Slicknode options via environment variables.
Example for setting them explicitly in the terminal:
bash export SLICKNODE_OPTION_NAME=value slicknode start
Using environment variables is the recommended way to pass configuration to Slicknode that is running in a docker container for example.
.env File: Options can also be configured in a
.envfile that needs to be placed in the root directory of the project:
Make sure you don't commit this file to your git repository if it contains sensitive credentials.
This is a list of all available configuration options and their corresponding environment variable names:
|PostgreSQL DB connection url, for example:
See the PostgreSQL docs for details
|The database schema in which the project data is stored
|Path to the directory that contains the Slicknode project configuration.
|The network port on which the server listens for HTTP requests
|Automatically apply DB migrations on start.
WARNING: Applies migrations immediately when watch mode is on, which can lead to accidental data loss.
|Watch for filesystem changes and automatically reload handler code, GraphQL schema etc.
|Admin secret to connect the Slicknode project to the Slicknode console. (min 20 characters)
|The S3 service endpoint for the image bucket, for example:
|Public endpoint for the images. If no CDN is used, should point to
|S3 bucket where images are stored
|Secret to generate unguessable URLs to image thumbnails
|AWS access key ID for S3 storage
|AWS secret access key for S3 storagestorage
|Maximum number of nodes that can be returned in a relay connection
|Number of nodes that is being returned in relay connections if no limit is provided
|Storage bucket name for private files
|The S3 service endpoint for the file bucket, for example:
|Storage bucket name for public files
|The S3 service endpoint for the bucket of public files, for example:
|The CDN URL where the public files are accessible
|Maximum number of nodes that can be returned in one request