Ratatieto is an extranet service of the Finnish Railways Agency, which distributes track maintenance documents to internal and external stakeholders.
(To-do: Demo link will be published here...)
- It is monorepo architecture
- Monorepo uses a single repository for the source code management version control system
- Monorepo standardizes styling, code and tooling accross the team
In Ratatiedot Extranet, we use:
- React for user interface
- Lambda for server-side implementation
- AWS services: Cognito, Lambda, S3, ALB, IAM, CodePipeline, CodeBuild and CodeDeploy, CloudWatch (To-do: other AWS services to be decided)
- aws-cdk for defining and managing infrastructure and CI/CD Pipeline
- Typescript to enforce type-checking
Based on GitLab Flow (see: https://docs.gitlab.com/ee/topics/gitlab_flow.html). Feature branches are branched from main
.
Feature branchers should be name with the following naming convention:
commit_type/project_code-issue_number-feature_descriptive_name
E.g. feature/RTENU-12345-awesome-new-feature
If there is no issue, skip that part.
Conventional commits (see: https://www.conventionalcommits.org/en/v1.0.0/), with the addition of a ticketing issue (if applicable/available). E.g.
feat(api)!: RTENU-12345 Awesome new feature
Remade API to be more awesome, but with breaking changes
Feature branches are to be merged to main
via Pull Requests. Use squash merging by default. If you need to retain intermittent commits for some reason, use regular merging in such case. All PRs to prod
should use merge commit.
Naming: commit_type: PROJECT_CODE-ISSUE_NUMBER Description
E.g. feat: RTENU-12345 Awesome new feature
Prettier is used for automatic linter fixing for obvious cases. Otherwise, linter rules are defined in .eslintrc
AWS SAM CLI
Example for MacOs with pre-installed brew, check https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html for further instructions and other platforms
brew tap aws/tap
brew install aws-sam-cli
Note! AWS SAM CLI requires Docker to run functions locally. If you are using a Docker Desktop alternative, remember to set DOCKER_HOST to env. MacOs example:
export DOCKER_HOST="unix://$HOME/.colima/docker.sock"
AWS CLI & Session Manager plugin
Install AWS CLI and Session Manager plugin. Example for MacOS:
brew install awscli
brew install --cask session-manager-plugin
For other platforms, please see https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html and https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html
Check node version. You can use nvm use
to automatically set the right version.
To bootstrap the project, run:
npm run bootstrap
Create .env
file in server package and copy from .env.example
to .env
.
To install dependencies that only frontend or backend use, run command in the root repository:
npx lerna add <npm_package> [--dev] --scope=[frontend/server]
To install a common dependency that both frontend and server can use, run command in the root repository:
npm install <npm_package>
For detailed examples on how to setup and run the application, please refer to package-specific readmes:
If Husky's pre-commit hook fails to use nvm with the following error when using VS Code's integrated source control:
> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
.husky/pre-commit: line 4: npx: command not found
husky - pre-commit hook exited with code 127 (error)
It can be fixed by using ~/.huskyrc
to load the necessary stuff before running the hook:
# ~/.huskyrc
# This loads nvm.sh and sets the correct PATH before running hook
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"