π Start UI [web] is an opinionated frontend starter repository created & maintained by the BearStudio Team and other contributors. It represents our team's up-to-date stack that we use when creating web apps for our clients.
npx create-start-ui --web myApp
That will scaffold a new folder with the latest version of π Start UI [web] π
Then just go to the created folder and start the dev server.
cd myApp
yarn dev
- π¦ TypeScript
- βοΈ React
- β² NextJS (with Static Export)
- π Storybook
- β‘οΈ Chakra UI
- π Formiz
- π₯ React Error Boundary
- βοΈ React Icons
- π React i18next
- π½ React Select
- π’ React Currency Input Field
- π Day.js
π Technology Choices
βΉοΈ API calls are mapped on a JHipster backend application.
- Reponsive layout / navigation.
- Sign / Sign Up / Password recovery screens.
- Account profile / Change Password screens.
- Users management admin screens (CRUD).
- Multi-languages (English & French built-in).
- Custom Chakra UI theme with preview of customized components in Storybook.
- Extra UI components with Storybook documentation.
- Fields components for Formiz.
- Dark mode support with Storybook toggle.
- App version & Environment name in the UI.
- API Schema documentation via Swagger UI React.
- API Mocking with persisting state via MirageJS.
yarn install
yarn build
yarn dev
yarn storybook
Development with MirageJS (mock)
This is the default behavior.
Do not set the NEXT_PUBLIC_API_BASE_URL
variable in the .env
file at the root of the project.
Development with a JHipster backend
Create a .env
file at the root of the project with the following content:
NEXT_PUBLIC_API_BASE_URL=http://localhost:8080/api
Setup the NEXT_PUBLIC_DEV_ENV_NAME
env variable with the name of the environment.
NEXT_PUBLIC_DEV_ENV_NAME=staging
NEXT_PUBLIC_DEV_ENV_COLOR_SCHEME=teal
API documentation is accessible by admins in the app with Swagger-UI.
yarn docs:build
This will build the json documentation from the main file /src/mocks/openapi/openapi.yaml
.
We recommended using the i18n Ally plugin for VS Code for translations management.
Create or edit the .vscode/settings.json
file with the following settings:
{
"i18n-ally.localesPaths": ["src/locales"],
"i18n-ally.keystyle": "nested",
"i18n-ally.enabledFrameworks": ["general", "react", "i18next"],
"i18n-ally.namespace": true,
"i18n-ally.defaultNamespace": "common",
"i18n-ally.extract.autoDetect": true,
"i18n-ally.keysInUse": ["common.languages.*"]
}
- Use namespaces
t('namespace:translationKey')
and nestingt('namespace:this.is.nested')
.
// Example for translations available in account.json
t('account:data.firstname.label')
- For fields and data translations use a
data
object.
// account.json
{
"data": {
"firstname": {
"label": "First Name",
"required": "First Name is required",
},
}
}
// React
t('account:data.firstname.label')
t('account:data.firstname.required')
- For user feedbacks, use a
feedbacks
object withactionSuccess
&actionError
keys containing eachtitle
anddescription
(optional).
// account.json
{
"resetPassword": {
"feedbacks": {
"confirmSuccess": {
"title": "Your password has been reset",
"description": "You can now login"
},
"confirmError": {
"title": "Reset password failed"
}
}
}
}
// React
t('account:resetPassword.feedbacks.updateSuccess.title')
t('account:resetPassword.feedbacks.updateSuccess.description')
t('account:resetPassword.feedbacks.updateError.title')
- For user actions, use an
actions
object.
// account.json
{
"resetPassword": {
"actions": {
"send": "Send Email",
"reset": "Reset Password"
}
}
}
// React
t('account:resetPassword.actions.send')
t('account:resetPassword.actions.reset')
- Use the common workspace only for VERY generic translations. By default, use specific namespaces to allow easy update on large code base without unwanted side-effects.
yarn storybook:build # Optional: Will expose the Storybook at `/storybook`
yarn build
yarn start
yarn storybook:build # Optional: Will expose the Storybook at `/storybook/index.html`
yarn static:build
Then expose the /out
folder.
π‘ You will need to setup your server to rewrite all /app/*
urls to serve the app.html
file.
React is a JavaScript library created in 2013 to build reactive user interfaces. At the time of writing, React is probably the front end library the most used to create new projects and has a huge community which is beneficial for the maintainability of the project in terms of developers and online resources.
Next.js gives you the best developer experience with all the features you need for production: hybrid static & server rendering, TypeScript support, smart bundling, route pre-fetching, and more. No config needed.
JavaScript is a not typed language. TypeScript is here to help add static type definition. TypeScript helps a lot when it comes to types, interfaces and define contract between functions which helps a lot for a reliable documentation. No worry, the TypeScript adoption is incremental and writing in TypeScript is not mandatory to use Start UI, but it is a good practice to do so to avoid bugs in the future.
Storybook is an Open Source tool to help you develop framework agnostic components in isolation and document them.
Chakra UI is a simple, modular, composable and accessible component library that is highly customizable.
To create React forms, there is a lot of libraries out there. Formiz will help you create React forms with ease! Composable, headless & with built-in multi steps.