This technical test assesses your full-stack application development skills using existing code similar to the project you'll be working on and includes tasks that simulate real project work.
Most applications connect to 3rd party APIs, which generally involve authentication by oauth2.0, retrieving some data via their API, then displaying it to the user.
In this test you will be authenticating Xero using oauth 2, then call the Xero API (https://developer.xero.com) to retrieve the user's invoices and display them in the web application.
If you have not worked with oAuth before, it is recommended to read up on it before starting the test (sample video explaining oauth2 https://www.youtube.com/watch?v=ZV5yTm4pT8g). If it's your first time, at least by completing this test you will take away something important in your future coding career :)
- Project - NX monorepo (https://nx.dev - allows running lint, tests, build, etc. e.g.
npx nx lint backend
) - Frontend - React Typescript (https://nx.dev/nx-api/react)
- Backend Tooling - AWS CDK (Typescript) (https://github.com/adrian-goe/nx-aws-cdk-v2/blob/main/packages/aws-cdk-v2/README.md)
- Database - DynamoDB
- Functions - Lambda
- API - Appsync GraphQL (Apollo used in Frontend)
- 3rd Party API - Xero - Accounting software
There are some accounts you will need to set up before you can do the technical test.
If you have any issues or concerns with the below, please let us know.
You will need to use an existing Amazon Web Services account or create a new one to complete this test. (https://console.aws.amazon.com)
- If you are creating a new account, you will need to provide payment information to complete the test however you can delete the account after the interview is complete
- If you have an existing account, you can destroy the stack once complete (e.g. calling
cdk destory--profile enterprofilename
in the backend folder) - There shouldn't be costs associated with this test, however make sure to destroy once the interview is complete
- The user stories will also guide you from this point
Full instructions here: https://developer.xero.com/documentation/getting-started-guide/
- Create a developer Xero account to complete this test, which will give you access to Xero APIs (https://www.xero.com/au/signup/developers)
- Once you create and verify the developer account, it will prompt you to create an organisation and start a free trial (no payment information required)
- A demo company will also be created for you to use in the test (Demo Company)
- The user stories will also guide you from this point
Create a repo in Github and push this code before you begin. Use github workflows you are used to when completing this test. (e.g. feature branches, pull requests, etc)
yarn install && cd backend/src/layers/dependencyLayer/nodejs && yarn install
npx nx serve react-app
Review package.json
for all scripts.
Command | Description |
---|---|
yarn run codegen |
Generates the latest graphql schema and typescript types. Run after deploying GraphQL schema updates |
yarn run output |
Copies output file to the react-app (providing it was generated during cdk deploy with flag. (e.g. npx cdk deploy --outputs-file output.json ) |
yarn run esbuild |
Used by AWS CDK to transpile typescript to javascript, shouldn't be necessary to run manually |
For your information, the project was set up with:
- yarn 3.6.4
- node v18.16.1
- That you are able to set up your dev environment, of course if you run intro troubles and can't get it working, please let us know. This happens in a real project too
- The code meets the requirements based on the user stories
- Coding best practices (e.g. comments, security, code structure, git workflow, etc)
- Demo of stories, code review together and discussion about your approach
Once the stories are complete, let us know and we will review together. Create a pull request or whatever workflow you would follow prior to a code review.
As a developer
I want to be able to set up a Xero app
So that I can connect to Xero
- When logged in to Xero, Set app name as 'Fullstack Test' at https://developer.xero.com/app/manage/
- Select integration type as "Web app"
- Enter application url as https://localhost:4200
- Enter the redirect URI as https://localhost:4200/xero-redirect (it will be used in oauth2 to exchange code for access token)
- Once app is created, generate the client ID and Client Secret for application access
As a developer
I want to be able to connect to Xero API
So that I can access the Xero API
- Insert the generated Xero client ID and Client Secret into the project to allow connecting to the Xero API (search
xeroClientId
andxeroClientSecret
in the project) - Ensure client Secret is not exposed in the code
-
Inserted the generated Xero client ID and Client Secret into the project by adding them in .env file
-
add .env file in .gitignore to not exposed in the code
As a developer
I want to be able to set up AWS CDK
So that I can deploy the backend to the correct AWS account
- Authenticate to your AWS account
- Set up AWS CDK using
npm install -g aws-cdk
oryarn global add aws-cdk
if not already installed - If you have never used CDK in your AWS account, you will need to bootstrap it first
npx nx bootstrap backend --profile enterprofilename
- First deploy the lambda layer stack using
npx nx deploy backend FULLayerStack --profile enterprofilename
- Deploy all stacks in the backend using
npx nx deploy backend --all --require-approval=never --outputs-file output.json --profile enterprofilename
- Copy output file to react-app application by running
yarn run output
- Quick and Easy way to authenticate to your AWS account is to generate secret and access keys. https://docs.aws.amazon.com/cli/latest/userguide/cli-authentication-user.html
aws configure --profile enterprofilename
), otherwise more ways here https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html
- Create new IAM user account and configure AWS CLI with new profile
- Install AWS CDK using
npm install -g aws-cdk
- Bootstrap the backend using
npx nx bootstrap backend --profile marko_salme
- Deploy the lambda layer stack using
npx nx deploy backend FULLayerStack --profile marko_salme
- Deploy all stacks in the backend using
npx nx deploy backend --all --require-approval=never --outputs-file output.json --profile marko_salme
- Copy output file to react-app application by running
yarn run output
As an user
I want to be able to connect to Xero
So that I can be authenticated via Xero oAuth 2 to access my data
- Once a user signs in, they should see the dashboard
- On the dashboard there is a button "Connect Xero"
- Clicking "Connect Xero" should open a new window to Xero oAuth 2.0
- Once the user connects to Xero, they should be redirected back to the application (
/xero-redirect
route)
- All this functionality should already be completed without any development from your end, unless your environment / xero is not set up correctly
As a user
I want the application to exchange the Xero authorisation code for a token set
So that I can make authenticated requests to access my Xero data
- Backend uses the redirect URL to exchange the authorisation code for a token set
- The token set is stored for my user in the database for subsequent Xero API requests
- Once successfully authenticated, in the web application the user should see a message that says "Xero Connected"
- Once successfully authenticated, in the web application the user should see a button "Go To Dashboard"
- Clicking "Go to Dashboard", user should navigate to the dashboard page
- The lambda function you will work on is
/backend/src/functions/xeroCreateTokenSet/index.ts
- The React component to work on is
react-app/src/app/pages/XeroRedirect/XeroRedirect.tsx
- A user record is created for each sign up in the DynamoDB database, you can update this record using the sub to store the token set
- Read more here to understand the Xero oAuth workflow and integration:
As a user
I want to be able to view my invoices
So that I can see all my invoices that appear in Xero
- Retrieve the token set from the user's profile to call the Xero API
- If the token set is expired, the backend should refresh the token set before calling the Xero API
- In the web application, the user should see a list of their invoices:
- For each invoice, it should show the invoice number, status, amount paid, Tax total and total
- User should be able to toggle between paginated results
- User should be able to filter invoices by status
- You will need to use AWS CDK to complete this task (previously done for you):
- Update the GraphQL schema (at
backend/src/appsync/schema.graphql
) - Create a lambda function to retrieve the invoices (in the directory
backend/src/functions
) - Create a mutation that will trigger a lambda function (at
backend/src/stacks/AppSyncAPIStack.ts
) - Use the sub to retrieve the user's database record, which should have the stored token set
- Update the GraphQL schema (at
- For the UI:
- Complete the UI in the component
react-app/src/app/pages/XeroTransactions/XeroTransactions.tsx
- Take note of the UI library the application uses, you may be able to use a UI component that will display the data nice, manage the columns and rows, whilst handling pagination
- Complete the UI in the component