Installation
Looking to integrate Stringtale into your (existing) project? You’ve come to the right place! This guide will lead you through the required steps and get you up and running in minutes.
Before getting started
Introduction of components
Understanding the different components of Stringtale up front will aid your integration. Here’s a run down of the components.
- JavaScript libraries (for integration with the front- and back-end of your project)
- Command Line Utility (CLI) (for easier integration and local usage)
- Dashboard (for creating and managing projects, users as well as billing)
- Utilities such as a GitHub action (optional), a Visual Studio Code extension and an ESlint plugin
How does it work once integrated?
Stringtale works as a client side JavaScript library that activates either by either adding ?stringtale
to the URL
or by enabling it through the Chrome extension. When edited text gets saved, it makes
a call to the /api/stringtale
route of your back-end, which then passes it on to Stringtale for storage. Your back-end
will then in turn call the Stringtale API, authenticating using the Deploy key
.
Integrating Stringtale
Integrating Stringtale is easy. All you need to do is add an API route to your backend (which we provide) and expose it to
your codebase through the <StringtaleProvider>
. After that you can use it anywhere in your code.
Integrating Stringtale on your back-end
The fastest way to get started is to use our CLI for semi-automatic integration. If you prefer to do things manually, please refer to the documentation for your back-end framework. Our automatic integration is suited for both new and existing project. To use the CLI, follow the steps below.
-
Install the Stringtale CLI globally:
-
Login using with your Stringtale credentials
stringtale login
-
Run
stringtale init
, and follow the prompts.- Select your language (Typescript or JavaScript).
- Select which Stringtale project should be assigned to this project.
- Select which back-end framework you use (Next.js or Express.js).
- The CLI will then generate a
stringtale.config.json
for your project. - Depending on the selected back-end the CLI will perform the following steps:
- Attempt to locate your
next.config.js
to detect the root of your project or prompt you if it can’t find the correct one. - Create
app/api/stringtale.ts
to enable/api/stringtale
. - Add the required dependencies for your project.
- Instruct you to add
<StringtaleProvider>
and Stringtale’s CSS to yourRootLayout
inapp/layout.tsx
as such: For more information aboutRootLayout
see the NextJS documentation.
- Attempt to locate your
next.config.js
to detect the root of your project or prompt you if it can’t find the correct one. - Create
<PROJECT_DIRECTORY>/pages/api/stringtale.ts
to enable/api/stringtale
. - Add the required dependencies for your project.
- It will instruct you to customize your App component in
_app.tsx
and add the<StringtaleProvider>
For more information about customizing theApp
component see the NextJS documentation.
- Add the required dependencies for your project.
- Instruct you to add the
/api/stringtale
route. Because of how Express handles routing, we don’t add this automatically. Example: - Instruct you to add the
<StringtaleProvider>
withapiRoute
attribute to App component inapp.js
/app.tsx
. Example:
- Attempt to locate your
-
Once
stringtale init
has finished, it’s integrated with your back-end. To start using Stringtale in your front-end, check out the next section.
Integrating Stringtale on your front-end
In order to integrate Stringtale in your React front-end you can either start wrapping your strings manually, or make use of our Codemod.
Automated wrapping using Codemod
You can wrap all the static text in your sourcecode using our Codemod utility. By running stringtale codemod
our CLI will
automatically wrap all the static text in your codebase in <Value>
tags and generate name attributes for them.
Manual wrapping
To start using Stringtale on a subset of your strings, please refer to the documentation for the React framework.
Deploying Stringtale to your test environment
Deploying Stringtale to your test environment is very straight forward. Just deploy your application as usual, add STRINGTALE_API_KEY
to your
environment variables and you’re good to go. To obtain the STRINGTALE_API_KEY
you can follow the steps below:
- Go to the Stringtale Dashboard.
- Go to Projects
- Open the project (or click on Edit project settings) you want to deploy to your test / preview environment.
- Scroll down to
Tokens
- Click on
Add Token
and create a new token
- Save the token somewhere safe, you’ll need it later.
- Enable ‘Write’ permissions for the newly created token by checking the checkbox for ‘Can write’.
Now you can deploy your application and add STRINGTALE_API_KEY
to your environment variables. You can start using Stringtale by adding ?stringtale
to the URL or by using our browser extension.
For more information on how to use Stringtale once you’ve deployed it, checkout the workflow documentation.