This repository contains the Next.JS application which hosts the Source Cooperative frontend and API.
- 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]:
To install the dependencies, run the following command:
npm install
To install the Source Cooperative CLI, run the following command:
npm run install-cli
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%
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.
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.
To run the tests, run the following command:
npm run test
Any commits pushed to the main
branch will be automatically deployed via Vercel.