- Take a task/feature, move it to 'In Progress' on the Board
- Create a branch for your feature/task
- Feature branches are generally named like 'feature/12345-add-sorting-to-products', where '12345' is the Id of your Task/UserStory with short description of what it does
- Design a backend API interface
- Try to use REST, but don't be too dogmatic. If non-REST interface suits better, go for it (but first make sure, that non-REST REALLY suits better and is more understandable)
- Discuss API with colleagues if in doubt
- Implement backend logic
- Autogenerate typescript client
- Implement frontend logic
- Write at least a single Component auto-test per API endpoint, more tests (including unit-tests) are better.
- Create a Pull Request
- Wait for it to be approved, answer & resolve all comments, make necessary changes to the code.
- Merge PR using squash
- Wait for your changes to be built on CI & deployed.
- Don't merge & go home! :) Wait for your merge to be built by CI. Better postpone merging till tomorrow morning (because if your changes break on CI and you are offline, your colleagues will be angry!)
- Common sense above all. If some principle/rule goes against the common sense, don't do it, ask colleagues why/what-to-do.
- We tend to use a lot of Trunk-based-development principles
- Create a branch per task/feature/functionality (branch name is like
feature/12345-add-sorting-to-products
where 12345 is the Id of your Task/UserStory), create a Pull Request when finished, merge using squash when PR is approved and tests are green.- Some small changes could be pushed to master directly (with over-the-shoulder code review)
- We try to keep branches short-lived (e.g. 1-week is too long) & pull requests small (big PRs are hard to review)
- We run autotests for feature-branches (so wait for them to be green before merging your PR)
- We don't deploy to PROD on each commit, but we deploy to DEV, and we strive to keep the master branch ready-to-be-deployed.
- We use feature flags (and hide new not-finished functionality behind the feature flag) to keep the feature-branches short and master deployable.
- Create a branch per task/feature/functionality (branch name is like
- When designing API/class follow the principle of the least astonishment. The API/behaviour you are building should not surprise the user or your fellow developer.
- If you are doing something non-obvious, leave a comment explaining other simpler solutions that you've tried, and why they didn't work out.
- Don't build bicycles.
- If something similar to your feature exists in the codebase already - check it out and consider implementing it in a similar way.
- If you think about building something complex solution - maybe there's a 3rd party library for that (or at least, someone shared solutions to a similar problem in blog-post). Search for them.
- Write SIMPLE code (it's actually harder than writing complex code :)). Make sure it's understandable for your colleagues and your future self.
- Follow the SRP (single responsibility principle). Try to keep your classes/functions small, so that it's easy to grasp what they are doing.
- Try to write self-documenting code (create good names for your classes/functions/variables). Comments should explain why you are doing something, not what are you doing (if you are going to write a comment like
/* attach device to a patient */
, just extract the code into a function namedAttachDeviceToPatient
)- XML-comments to public functions/classes (if you are writing a library) are exceptions for this case.
- Try to use REST API
- Read about DateTime handling in backend
- For pages with filters/sorting, store the filters in the URL.
- It should be possible to copy the URL, send it to the colleague, and if he opens the page, he should see the same thing.
- It should be possible to press F5 and see more-or-less the same result
- Detailed how to is also available.
- Use feature-flags to disable/enable features (especially features that are being developed and not yet finished).
- Do not use
Controllers
andServices
folders. Rather create a folder inFeatures
folder (with a name of your feature), and put your Controllers, Services and Dtos there.- it puts everything related to a feature in one place, which helps in refactoring and understanding
- Check Multi-tenancy implementation if your app uses it
- Add logs wherever meaningful, also use
[Log]
attribute (more details here)
- Use redux for client state only (and it's ok to not use redux at all :))
- Do not store Form state in redux (use
react-hook-form
) - Do not store http-request-cache in redux (use
react-query
)
- Do not store Form state in redux (use
- Routing: we use react-router v6.
- Define your route. We use a small createLink wrapper to add typings to URLs.
- Add e.g.
WorkItemDetails: createLink('/projects/:id')}
- Handle this route at RootPage
<Route path={Links.WorkItemDetails.route} element={<YOUR_PAGE_COMPONENT />} />
- Within the page component you could access URL parameters using
Links.WorkItemDetails.useParams()
- Add e.g.
- Optional parameters unfortunately are not supported. You have to define separate route for each optional parameter and
Links.WorkItemDetails.useMatch()
to get the values.
- Define your route. We use a small createLink wrapper to add typings to URLs.
- We have UIKit (based on MUI) with some additional convenience options. Please check the docs to know how/when to use it :)
- We tend NOT to use default exports. Please export and use components via named exports (i.e.
export const MyPage = () => <div>blablabla</div>
). Only use default exports with lazy-loading (viaReact.lazy
, or better using the lazyRetry helper)
- You could pull updates from Template into your project by running
yarn pull-changes-from-template
(it will actually run scripts/pull-changes-from-template.js).- It will clone the template repo next to your project folder, rename according to your project and copy Lib folder and other files that are not meant to be changed.
- You could examine/compare some other files and copy them to your project manually
- Check the changes before commiting them to your repo!