AppName
October 13, 2025 ยท View on GitHub
App responsible for all appname related data.
Setting up your repository
Upon cloning, fill in the values for the .env.example and save this as a new .env in the root directory. Run the following:
Related links
- Deploy Environments
- Swagger docs for the back-end service
- Storybook
- Jira Project
- Confluence Space
- Sentry Error Reporting
Getting Started
git clone https://github.com/abarrows/template-nextjs-ui
Prerequisites
You will need:
- An OS package manager
- MacOS: Homebrew
- Windows: Chocolatey
- NVM & Node
- Install the same Node version listed in the .nvmrc file
- NPM
- Comes with Node installation
- Docker
- MacOS:
brew cask install docker - Windows:
choco install docker-desktop
- MacOS:
- Powershell
- MacOS:
brew install --cask powershell - Windows:
choco install powershell-core
- MacOS:
Building the Project
To start the app locally:
- Retrieve the
.envfile by running one of the commands in the Retrieving Environment Variables section - From the root project directory, run
npm run devto start a development server with hot reloadingnpm run build && npm startto build and start a production server without hot reloadingdocker compose up --buildto build and start the application using Docker
- Open app in browser: http://localhost:3000
Environment Variables
The environment variables for this project were previously sourced from Azure Key Vault Secrets. WIP: I will create a branch soon to update this process so that it sources from either AWS Secret Manager. Until then, simply replace the values with you personal situation's values..
Retrieving Environment Variables
You have options when generating a local .env file:
- To generate a
.envfile for a specific environment: In a PowerShell session, run./Get-Secrets.ps1 -Environment [ENVIRONMENT]. If no environment is provided, the script defaults to the "development" environment. - To generate a
.envfile for a specific key vault: In a PowerShell session, run./Get-Secrets.ps1 -KeyVaultName [KEY VAULT NAME]. You can find the available key vaults for this project below. - To generate a
.envfile for a specific environment: In a shell session, runnpm run setup [ENVIRONMENT](also runsnpm install). If no environment is provided, the script defaults to the "development" environment.
Here are the available Azure Key Vault names for this project:
template-ui-developmenttemplate-ui-stagingtemplate-ui-production
Using Environment Variables
These files are where you can find and manage environment variables:
Secrets-example.json- sample variables for each Key VaultSecrets.json- secrets config file for each Key Vault- Generate and edit with
npm run keys:editor./Edit-Secrets.ps1 - Save and apply changes with
npm run keys:saveor./Set-Secrets.ps1
- Generate and edit with
.env- variables for the selected Key Vault- Generated by
npm run setupandnpm run keys:get
- Generated by
.env.development- override non-secret values from .env while developing the project locally.env.production- override non-secret values from .env while building the project locally.env*.local- override secret values for local use only- This file is optional and should only be used for advanced configuration
Onboarding A New UI Product
- Review
.env.example, - TODO: ONBOARDING: Review all instances of this and follow the TODO instructions for the new product.
- Once all is finished, run the
npm run validateor thenpm run validate:cicommand which executes all setup scripts, tests, linting, etc. to ensure that everything works correctly without errors:
npm run validate
- USER Update with the repo's owner name.
- USER_EMAIL Update with the repo's owner email.
Development Essentials
Hooks
Our ESLint config is set up to validate hooks, including useEffect dependency arrays. Before disabling a warning because you believe something doesn't belong in deps, read through A Complete Guide to useEffect and try to find another solution. It's OK to disable a linter if you have good reason (leave a comment explaining why if that reason isn't immediately obvious), but that particular rule should never be disabled.
State Management
We use hooks for local state and React Context for wider (but non-global) state. For global state we use Zustand.
Styling
We use SCSS Modules to style components. SCSS Modules are CSS Modules, but with all the power of SCSS (nesting, variables, etc). SCSS Modules scope styles to just that component, as opposed to making them globally available. Our entrypoint for global styles is in `src/styles/index.scss.
BEM
BEM is our preferred naming convention, which is slightly modified for convenience. This allows us to more easily access classes within JSX, like styles.blockName instead of styles['block-name'].
// Original BEM
.block-name
.block-name--modifier-name
.block-name__element-name
.block-name__element-name--modifier-name
// ACB BEM, uses camelCase and replaces -- with _
.blockName
.blockName_modifierName
.blockName__elementName
.blockName__elementName_modifierName
Testing
Test files should be stored in the same location as the original file they are testing, with the exception of Playwright tests (see below).
We run tests automatically with GitHub Actions on every Pull Request, failing tests will need to be addressed before a PR can be merged.
Jest & React Testing Library
We use Jest for helper function tests. For more information about working with Jest, this is a useful guide.
We use React Testing Library for component tests that simulate how a user would interact with the component. There are several available queries for selecting the element you need to test.
Debugging Tools:
- The screen object allows us to interact with the component we have rendered and find elements. Screen provides a debug method that will print the document or specified elements.
- Screen provides another method called logTestingPlaygroundURL. This method will print a url in your terminal for you to copy and paste in your browser where you can further test the entire document or an element.
Run unit tests with npm run test:unit.
Playwright
We use Playwright as our end-to-end testing framework. All Playwright tests are contained in playwright/integration directory as .spec.js files.
Debugging Tools:
- We recommend the VSCode extension for Playwright for easier debugging
Run integration tests with npm run test:e2e.
Storybook
We use Storybook for component documentation and style guides. It can be run locally with npm run storybook:dev.
Deployments & Releases tom did you move this stuff bud
We use GitHub Actions to deploy this project. More information on how to deploy using GitHub Actions here: [GitHub Action Deployments](TODO: ONBOARDING:github-action-deployments-url)
Onboarding A New UI Product
- APPLICATION_NAME Find and replace all references of this with the real product's name.
- TODO: ONBOARDING: Review all instances of this and follow the TODO instructions for the new product.
- Once all is finished, run the preflight command which executes all setup scripts, tests, linting, etc. to ensure that everything works correctly without errors:
npm run validate