Setup and configure SDK solution
From this article you will learn how to set up and configure Sana Commerce SDK solution for development purposes.
Prerequisites
In order to work with Sana Commerce SDK, the following prerequisites are required:
- Node.js v20 LTS
- TypeScript
- GIT (available in PATH)
- Visual Studio 2022 or Visual Studio Code
- Sana Commerce SDK package Download
Set Up the SDK
Unpack the downloaded SDK package into a new folder and perform the following preparation steps:
Open the SDK solution in Visual Studio or VS Code
Build the solution (it may take some time until all dependencies are restored)
Run
npm installat the root ofClientAppfolder to install client-side packagesConfigure encryption keys and the authentication token secret. For the sake of this tutorial (since this is not a real project) any keys can be used. So, just specify the following values in the
appsettings.jsonfile under theSana.Commerce.WebAppproject:{ "Security": { "Auth": { "TokenSecret": "ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP" }, "Aes": { "Key": "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", "Vector": "0123456789ABCDEF0123456789ABCDEF" } } }Restore out-of-the-box Sana SQL database to any SQL Server instance. The database backup or the corresponding SQL scripts can be found in Sana Commerce release package.
Configure SQL connection string in the
appsettings.Development.jsonorappsettings.User.jsonfile under theSana.Commerce.WebAppproject to point to the previously restored database.Set
Sana.Commerce.WebAppas the startup project and run it to make sure that everything has been correctly configured. There are 3 available profiles to runSana.Commerce.WebApp:- IIS Express - selected by default, which runs lightweight IIS HTTP Server integrated to Visual studio. It allows to use some IIS-related features, but this method is not fastest during development.
- Sana.Commerce.WebApp - recommended for development. Project profile, which runs the application using Kestrel server, which execution is faster than IIS Express.
- Watch - runs application in a Watch mode, which tracks source files changes and executes .NET Core CLI
runcommand. Also to make application start faster, make sure that you run app without debugger attached to it unless you have a reason for that.
Configure the Web Store
By default, the option to configure the initial Sana Admin user is disabled. To activate it, modify the CreateFirstAdminUser value from false to true in the appsettings.json file.
{
"Features": {
"CreateFirstAdminUser": {
"Enabled": true
}
}
}
Then, navigate to /admin in your browser and set up the first Sana Admin user.
After that, connect the web store to any ERP system or enable ERP "Mocked operations" to be able to develop an add-on without the real ERP connection.
Note
To enable ERP "Mocked operations", follow these steps:
- Open "ERP connection" page in Sana Admin, enter anything into the "Webservice URL" field and save changes.
- Go to the "Mocked operations" page, check all available operations and save changes.
Now, when the ERP connection is set up, navigate to the "System/Scheduled tasks" page and run the following tasks in the corresponding order:
- General information import
- Customer import
- Product import
Done. The web store is ready for further development.
What's next?
Continue with creating an Add-on project.