Skip to content

source-cooperative/source.coop

Repository files navigation

Source Cooperative Frontend & API

This repository contains the Next.JS application which hosts the Source Cooperative frontend and API.

Getting Started

Prerequisites

  • Docker installed and running locally
  • NPM installed on your local machine
  • AWS CLI installed on your local machine

Ensure the AWS CLI is configured (even in the values don't matter) by running, e.g.:

$ aws configure
AWS Access Key ID [None]: dummy
AWS Secret Access Key [None]: dummy
Default region name [None]: us-east-1
Default output format [None]:

Install Dependencies

To install the dependencies, run the following command:

npm install

Installing the Source Cooperative CLI

To install the Source Cooperative CLI, run the following command:

npm run install-cli

Setting up Ory

To set up Ory, create an Ory account and create a new project in the console. After creating the project, navigate to the project settings and create a new API key. Copy the API key and set it as the ORY_ACCESS_TOKEN environment variable. Next, copy the API endpoint URL and set it as the ORY_SDK_URL environment variable.

You can copy .env.local to .env and set the values inside it to avoid leaking secrets, since the latter file is not versioned. Also .env is loaded after .env.local, so it will override the values.

cp .env.local .env
vi .env
ORY_ACCESS_TOKEN=ory_pat_xxxxx
ORY_SDK_URL=https://xxxxx.projects.oryapis.com%

Run Locally

After having set up your environment variables, run the following command to start the service locally:

npm run dev

You can now access the service at http://localhost:3000.

You can also check that the was correctly initialized by running the following command and ensuring it contains a non-empty list of tables:

aws dynamodb list-tables --page-size 1 --endpoint-url=http://localhost:8000

Now, make sure that you have the Source Cooperative Data Proxy running locally as well.

Resetting the Database

To reset the database, stop the local webserver and run the following CLI command:

npm run kill

You will need to restart the local webserver after running this command.

Running Tests

To run the tests, run the following command:

npm run test

Deployment

Any commits pushed to the main branch will be automatically deployed via Vercel.

About

Source Cooperative Web Interface & API

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages