This is a BigCommerce App built using Next.js that enables merchants to translate their catalog into multiple languages per storefront. It uses:
- App Extensions to create a native editing experience within the product list
- The BigCommerce GraphQL Admin API to fetch and update catalog localization data
- Ability to translate product name and description
- Ability to translate SEO page title and meta description
- Ability to translate dropdown variant option labels
- Ability to translate custom fields
- Add check for multi-lang functionality and fail gracefully if it's not enabled
- Ability to translate non-dropdown variant option labels
- Ability to translate pre-order settings
- Ability to translate storefront details
- Ability to translate modifier option labels
- Ability to translate modifier initial / default values
- Add remove mutations for all nodes
- Improve UX of custom field editing (should use two column layout on mobile)
- Add Sentry error tracking
- Translate app strings (including API route responses and setting user locale via JWT)
- Use default locale and available locales from channel locale settings instead of constant
- Verify app extension is only added once after app is reinstalled
- Simplify multiple database support, setup, and deployment docs
- Finish manual api token support
- Streamline types across callbacks, sessions, and db functions
- Pull out Admin GraphQL client into a separate package
- Add import / export functionality
-
Copy the sample environment file:
cp .env.sample .env.local
-
Update the following required variables in
.env.local
:CLIENT_ID
andCLIENT_SECRET
: Get these from the BigCommerce Developer PortalAPP_ORIGIN
: Your app's URL (for local development, this will be your ngrok URL)JWT_KEY
: A secure random string of 32+ charactersDATABASE_URL
: Your database connection string (see Database Setup below)
This app uses Neon (serverless Postgres) with Drizzle ORM for database management. It's also compatible with MySQL and SQLite with a tiny change to environment variables.
-
Create a Neon database through Vercel's marketplace:
- Visit Neon on Vercel Marketplace
- Click "Add Integration"
- Follow the setup instructions
-
Set up your environment variables:
# Pull environment variables from Vercel vercel env pull .env.local
This will populate your
.env.local
file with the necessaryDATABASE_URL
variable. -
Ensure
DB_TYPE=postgres
is set in.env.local
- Set your environment variables in
.env.local
:DB_TYPE=sqlite DATABASE_URL=sqlite:./local.db
- Set your environment variables in
.env
:DB_TYPE=mysql DATABASE_URL=mysql://user:password@host:port/database
After setting up your database, run these commands:
-
Install dependencies:
npm run dev
-
Generate the database tables from the schema:
npm run db:generate
-
Run database migrations to create the tables in your database:
npm run db:migrate
-
(Optional) Use Drizzle Studio to manage your data:
npm run db:studio
npm run dev
Open http://localhost:3000 with your browser to see the result.