Skip to content

Latest commit

 

History

History
107 lines (81 loc) · 4.38 KB

CONTRIBUTING.md

File metadata and controls

107 lines (81 loc) · 4.38 KB

Hello there!

So, you want to help improve the site — great!

Setup

Local setup is fairly straightforward:

  1. Run the server (you'll need Rust):
    $ cd server && cargo run
  2. Install the client components (you'll need npm):
    $ cd client && npm install
  3. Run the client:
    $ cd client && npm run dev
  4. Open http://localhost:5173/.

If you modify the files under client/, the browser view should auto-update. If you modify files under server/, you'll have to re-run cargo run to see its effects.

Note that when run this way, to aid in development, the server will auto-populate an event with a set of questions from a past live Q&A session I ran at http://localhost:5173/event/00000000000000000000000000/secret. It will also auto-generate user votes over time for the questions there.

If you're curious about the technologies used in the server and client, see their respective README.md files.

DynamoDB Local

To run tests against a DynamoDB instance running locally, make sure you got docker and AWS CLI installed, then hit:

$ cd server
$ ./run-dynamodb-local.sh

This will also spin a Web UI for your local DynamoDB instance.

You can now run tests with:

USE_DYNAMODB=local cargo t -- --include-ignored

Assuming you are staying in the server directory, to run the back-end application against your local DynamoDB instance, hit:

USE_DYNAMODB=local cargo run

API Gateway Local

Prerequisites:

NB! API Gateway Local will only work when the binary is built in release mode (sam build will do this for us). See how we are wrapping the axum app in the LambdaLayer in release mode in main.

To build and launch the application as a Lambda function behind API Gateway locally, cd to the server directory, and hit:

sam build
sam local start-api

Once you make changes to the back-end code, open a separate terminal window and rebuild the app with:

sam build

The sam local process we've lauched previously will then pick up the new binary from ./server/.aws-sam directory.

Here is how our API Gateway Local plus DynamoDB Local setup look like:

 ______________________________                                  _______________________________________________
|           Browser            |                                |       Docker Network: wewerewondering         |
|   _______________________    |     _______________________    |     __________________________________        |
|  |                       |   |    | API Gateway Proxy     |   |    | WeWereWondering Server Container |       |
|  | WeWereWodering Client |-- |--> | http://localhost:3000 | --|--> | ports: SAM assigns dynamically   | --|   |
|  | http://localhost:5173 |   |    |_______________________|   |    |__________________________________|   |   |
|  |_______________________|   |                                |                                           |   |
|   _______________________    |                                |                                           |   |
|  |                       |   |                                |     _____________________________         |   |
|  | DynamoDB Admin Client |---|--------------------------------|--> | DynamoDB Local Container    |        |   |
|  | http://localhost:8001 |   |                                |    | ports: 127.0.0.1:8000:8000  |        |   |
|  |_______________________|   |                                |    | host: dynamodb-local        | <------|   |
|                              |                                |    |_____________________________|            |
|______________________________|                                |_______________________________________________|