Skip to content

Commit

Permalink
chore: documentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
lucbelliveau committed Jul 11, 2024
1 parent f51f694 commit 55c8502
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 24 deletions.
3 changes: 3 additions & 0 deletions frontend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,7 @@ DFO_NEO4J_URL="bolt://example:7687"

# URL of QA service (to be passed to cypher query)
QA_SERVICE_URL="http://example:8000"

# Secret Keys
OGMA_KEY="you-need-an-ogma-license"
NEXT_PUBLIC_GOOGLE_API_KEY="example"
97 changes: 84 additions & 13 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,102 @@
This proof of concept is a showcase of tools to aid humans detect potential health
threats by leveraging the data innovation team's proposed architecture.

## Configuration

## Getting started

First thing to do is to create the set of required environment variables by copying
the examples from [.env.example](./.env.example) to `./env`.
The front end is configured via environment variables, the
[.env.example](./.env.example) file contains all the available configuration
options; you can use it to get started.

```bash
cp .env.example .env
```

Then start the development server:
### Database and services

| Variable | Description |
| -------------- | ---------------------------------------------- |
| DATABASE_URL | Database to maintain user sessions |
| NEO4J_USERNAME | Neo4J username |
| NEO4J_PASSWORD | Neo4j password |
| NEO4J_URL | Neo4j instance with article data |
| DFO_NEO4J_URL | Neo4j instance with DFO data |
| QA_SERVICE_URL | URL of service proving AI answers to questions |

### Authentication and Access Control

> All list values are comma separated.
| Variable | Description |
| -------------------- | ---------------------------------------------------- |
| NEXTAUTH_SECRET | Used to encrypt the JWT and to hash tokens |
| NEXTAUTH_URL | Base URL used for redirects |
| GITHUB_CLIENT_ID | Client ID for Github OAuth authentication |
| GITHUB_CLIENT_SECRET | Secret for Github OAuth authentication |
| GITHUB_ALLOWED_USERS | List of github usernames allowed to sign in |
| RESTRICTED_USERS | List of github users without access to article data. |

### Third party

> This prototype uses [Ogma](https://doc.linkurious.com/ogma/latest/) by
> Linkurious, and [Google maps](https://developers.google.com/maps/documentation/javascript/get-api-key).
> Both of these require a key to be used.
| Variable | Description |
| -------------------------- | ----------------------- |
| OGMA_KEY | Key to download Ogma |
| NEXT_PUBLIC_GOOGLE_API_KEY | Key to use google maps. |

## Testing and linting

To run the test suites, run the following command:

```bash
npm run dev
npm run test
```

Finally use your browser to visit [http://localhost:3000](http://localhost:3000).
To perform linting, run the following command:

## Learn More
```bash
npm run lint
```

## Contributing

All commits must pass all unit tests and linting. This project uses rather
strict linting rules, to enforce code consistency. It is recommended to use
VSCode and install the recommended extensions to help.

## Launching
To start the local development server, use the following command:

This is a [T3 Stack](https://create.t3.gg/) project bootstrapped with `create-t3-app`.
```bash
npm run dev
```

To learn more about the [T3 Stack](https://create.t3.gg/), take a look at the following resources:
By default, the application will launch on port 3000. Use your browser to
visit [http://localhost:3000](http://localhost:3000).

- [Documentation](https://create.t3.gg/)
- [Learn the T3 Stack](https://create.t3.gg/en/faq#what-learning-resources-are-currently-available) — Check out these awesome tutorials
## Deployment

You can check out the [create-t3-app GitHub repository](https://github.com/t3-oss/create-t3-app) — your feedback and contributions are welcome!
The frontend is deployed as a docker image, suitable for containerization. All
environment variables should be passed to the docker build as build arguments.

```bash
cd frontend
docker build . \
--build-arg DATABASE_URL=<replace_with_database_url> \
--build-arg OGMA_KEY=<replace_with_key> \
--build-arg NEO4J_USERNAME=<replace_with_username> \
--build-arg NEO4J_PASSWORD=<replace_with_password> \
--build-arg NEO4J_URL=<replace_with_url> \
--build-arg QA_SERVICE_URL=<replace_with_url> \
--build-arg NEXT_PUBLIC_GOOGLE_API_KEY=<replace_with_api_key> \
--build-arg DFO_NEO4J_URL=<replace_with_url> \
--build-arg GITHUB_CLIENT_ID=<replace_with_client_id> \
--build-arg GITHUB_CLIENT_SECRET=<replace_with_secret> \
--build-arg GITHUB_ALLOWED_USERS=<replace_with_allowed_users> \
--build-arg RESTRICTED_USERS=<replace_with_restricted_users> \
--build-arg NEXTAUTH_SECRET=<replace_with_secret> \
--build-arg NEXTAUTH_URL=<replace_with_url> \
-t foresight-frontend
```
3 changes: 1 addition & 2 deletions frontend/env-dependencies.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as dotenv from "dotenv";
import pkg from "./package.json" assert { type: "json" };
import { execSync } from "child_process";
import { renameSync, unlinkSync } from "fs";
import pkg from "./package.json" assert { type: "json" };

dotenv.config();

Expand Down
9 changes: 0 additions & 9 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 55c8502

Please sign in to comment.