Skip to content

Add JWT key generation docs #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,59 @@ graph TD
J --> K[(Their database)]
end
```

## Getting Started

This repository is managed with **Yarn workspaces** and **Lerna**. You will need
Node.js 16 (see `.nvmrc`) and Yarn 1 installed.

1. Install dependencies and bootstrap all packages:
```bash
yarn install
```
2. Start the databases required by the services:
```bash
docker-compose up -d
```
This launches `api` on port `5432` and `notifapi` on port `5433`.
3. Run every package in development mode:
```bash
yarn dev
```
Individual apps can be started with `yarn dev:webapp`, `yarn dev:www`,
`yarn dev:projector` and `yarn dev:admin`.
4. Copy the sample environment files when present. For example the webapp has
`src/.env.development.local.sample` which should be copied to
`src/.env.development.local`.

The GraphQL API will be available on port `8080` once the server package starts
and Vite will launch the frontend apps on their respective ports.

### Generating JWT keys

The API signs tokens using an RSA key pair. You can either expose the keys via
the `PRIVATE_KEY` and `PUBLIC_KEY` environment variables or place `private.key`
and `public.key` files in the `packages/server` directory.

```bash
# create a private key
openssl genrsa -out packages/server/private.key 2048

# create the matching public key
openssl rsa -in packages/server/private.key -pubout -out packages/server/public.key
```

If the environment variables are present they will be used instead of the local
files when the server starts.

## Contributing

Formatting is handled by **Prettier** and the pre-commit hook runs
`lerna run lint`. Before opening a pull request run:

```bash
npx lerna run lint
```

Feel free to open issues or pull requests against the `main` branch once your
changes are tested locally.
10 changes: 6 additions & 4 deletions packages/frontend-common/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# `@notifycomp/frontend-common`

> TODO: description
Shared TypeScript utilities for the various frontend applications. Currently this
package exposes helper functions for date and time formatting that are consumed
by both the admin and public websites.

## Usage

```
const frontendCommon = require('@notifycomp/frontend-common');
```ts
import { formatDateRange } from '@notifycomp/frontend-common';

// TODO: DEMONSTRATE API
console.log(formatDateRange('2023-01-01', '2023-01-05'));
```
2 changes: 1 addition & 1 deletion packages/frontend-common/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@notifycomp/frontend-common",
"version": "0.0.1",
"description": "> TODO: description",
"description": "Shared utilities for competition schedule frontends",
"author": "Choover <[email protected]>",
"homepage": "https://github.com/coder13/competition-schedule-live#readme",
"license": "ISC",
Expand Down