Skip to content

Deployment

You can deploy your Crowdin app to any hosting provider that supports Node.js. Below you can find examples of how to deploy your Crowdin app to Vercel and AWS Lambda.

Vercel

Vercel can deploy your Crowdin app from existing repo (GitHub, Gitlab, Bitbucket).

Vercel Configuration

Go to Vercel and proceed with next steps:

  • Create a new project.
  • Under the Environment Variables section, define following variables:
    • CLIENT_ID - Crowdin App Client ID.
    • CLIENT_SECRET - Crowdin App Client Secret.
    • NPM_RC (//registry.npmjs.org/:_authToken=%token% where %token% is your npm token to install @crowdin/app-project-module package).
  • Add Postgres SQL Storage.
  • Storage -> Connect Store -> Create New -> Select Postgres.
  • Deploy.

Example of the Crowdin app

Project structure:

  • Directoryroot
    • index.js
    • logo.png
    • package.json
    • package-lock.json
    • vercel.json
    • .gitignore

App configuration:

index.js
const crowdinModule = require('@crowdin/app-project-module');
crowdinModule.createApp({
baseUrl: `https://${process.env.VERCEL_URL}`,
clientId: process.env.CLIENT_ID,
clientSecret: process.env.CLIENT_SECRET,
name: 'Sample App',
identifier: 'sample-app',
description: 'Sample App description',
postgreConfig: {
host: process.env.POSTGRES_HOST,
user: process.env.POSTGRES_USER,
password: process.env.POSTGRES_PASSWORD,
database: process.env.POSTGRES_DATABASE,
ssl: true
},
imagePath: __dirname + '/' + 'logo.png',
customMT: {
translate: () => {
console.log('translate');
},
validate: () => {
console.log('validate');
}
}
});
vercel.json
{
"version": 2,
"builds": [
{
"src": "./index.js",
"use": "@vercel/node"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "/"
}
]
}
.gitignore
/node_modules/
package.json
{
"name": "crowdin-app-demo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"engines": {
"node": "14.x"
},
"scripts": {
"start": "node index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"@crowdin/app-project-module": "0.66.1"
}
}

AWS Lambda

You can use Serverless to deploy your Crowdin app to AWS Lambda.

Example of the Crowdin app

It uses Serverless framework so in order to deploy it to AWS you just need to install deps npm i and after run this command serverless deploy.

In this example we are using PostgreSQL as a storage (e.g. AWS RDS with PostgreSQL engine can be used). Visit the Storage page to see other options.

Project structure:

  • Directoryroot
    • handler.js
    • logo.svg
    • package.json
    • env.json
    • package-lock.json
    • serverless.yml
    • .gitignore
handler.js
const serverless = require('serverless-http');
const path = require('path');
const express = require('express');
const app = express();
const crowdinApp = require('@crowdin/app-project-module');
crowdinApp.addCrowdinEndpoints(app, {
baseUrl: process.env.LAMBDA_URL,
clientId: process.env.CLIENT_ID,
clientSecret: process.env.CLIENT_SECRET,
name: 'Sample App',
identifier: 'sample-app',
description: 'Sample App description',
postgreConfig: {
user: process.env.PG_USER,
password: process.env.PG_PASSWORD,
database: process.env.PG_DB,
host: process.env.PG_HOST
},
imagePath: path.join(__dirname, 'logo.svg'),
projectIntegration: {
getIntegrationFiles: async () => {
return [
{
id: '12',
name: 'File from integration',
type: 'json',
parentId: '10'
},
{
id: '14',
name: 'File from integration 2',
type: 'xml',
parentId: '11'
},
{
id: '10',
name: 'Folder from integration'
},
{
id: '11',
name: 'Folder from integration 2'
}
];
},
updateCrowdin: async () => {
//TODO implement
},
updateIntegration: async () => {
//TODO implement
}
}
});
module.exports.handler = serverless(app);
serverless.yml
service: aws-node-express-api
frameworkVersion: '3'
provider:
name: aws
runtime: nodejs14.x
functions:
api:
handler: handler.handler
environment: ${file(env.json)}
url: true
env.json
{
"LAMBDA_URL": "https://<id>.execute-api.us-east-1.amazonaws.com",
"CLIENT_ID": "<client-id>",
"CLIENT_SECRET": "<client-secret>",
"PG_HOST": "<pg_host>",
"PG_USER": "<pg_user>",
"PG_PASSWORD": "<pg_pass>",
"PG_DB": "<pg_db>"
}
.gitignore
node_modules
.serverless
package.json
{
"name": "crowdin-serverless",
"version": "1.0.0",
"description": "",
"dependencies": {
"express": "^4.17.1",
"serverless-http": "^2.7.0",
"@crowdin/app-project-module": "0.66.1"
},
"author": "",
"license": "ISC"
}