Provides HTTP REST endpoints for consuming Entur services from mobile / web applications. Built as a docker image and runs on GCP.
API documentation is generated at runtime and lives in /documentation
(Swagger).
Clone this project:
git clone https://github.com/atb-as/atb-bff.git
Build and run the docker image, for local development:
docker build --target=dev -t atb-bff:dev .
docker run --rm -it -e PORT=8080 -p 8080:8080 -v $PWD:/app atb-bff:dev
- Node.js >=18
Install node packages
npm install
Start the development server
npm run start:dev
Or, to enable live reloading
npm run start:watch
The runtime is written in TypeScript and runs on Node.js
- HTTP server framework: Hapi
- Request and response validation is performed by Joi
- Swagger documentation is generated by hapi-swagger
- Testing framework: Jest and k6 (see test/README.md)
Hapi was chosen because it is battle-tested, has a magnitude of features supported out of the box, and has few external dependencies. Most of its dependencies are handled by the same team that maintains Hapi.
Service interfaces lives in service/
, implementations in service/impl
API endpoints live in api/
.
For endpoints that uses GraphQL directly we generate types and code using
graphql-code-gen
. GraphQL queries against journey planner must be put in
folders named journey-gql
.
If the queries, scheme, operations or fragments change, generate the code using the script:
npm run gql-gen
This will make a TypeScript representation of the .graphql
file in the same
location but with .graphql-gen.ts
extension. You can use these directly as
queries.
Changes to main
branch will automatically be deployed to staging.
You can see the status of each deploy here.
- Go to Releases
- Click "Draft a new release"
- Create a new tag (formatted something like "v1.9.0"). When selecting version number, follow these guidelines:
- Major: Breaking change. This version breaks functionality for older clients.
- Minor: This version extends functionality.
- Patch: This version affects no APIs at all, just changes to existing code.
- Click "Generate release notes"
- Click "Publish release"
You can see the status of the deploy here.