diff --git a/README.md b/README.md index 4ff1d033a..5ad6e0c48 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,28 @@ The best way to get started with the SDK and interacting with Buildcore is [inst

(back to top)

+## Running it locally + Navigate to the root folder and build the entire projet by running + ```sh + npm run build + ``` + + Buildcore backend consist of 3 individually ran services. + 1. Search API + This is a small express server that connects to the Postgres Database and exposes HTTP endpoints to query the data. + To run it navigate to `packages/search` folder, upate `.env.sample` with your DB connection params and run `npm run start` + + 2. Functions: + This is the main part of the backend. It is an express server that exposes several HTTP enpoints. One part of the enpoints are for users who wish to interrect with the backend. The other part of the endpoints are triggered by the Notifier once there is a change in the database. To run the Functions locally: + a) Navigate to `packages/functions`. + b) Upate `.env.sample` with your DB connection params + c) Run`npm run serve`. This will start the express server and it will run the Notifier locally. + + 3. Notifier: + The Notifier is responsible for listening to changes in the database. Every time there is a change, the Notifier calls the relevant endpoint sending the data before and after the update. Locally, the notifier calls the endpoint directly but if deployed from the `packages/notifier` folder, it posts the changes to Google pub/sub. + +Currently some tests in Functions are still strongly dependent on Google Cloud Storage, so to run the full test suite, you will need a Google Cloud service account file. + ## Contributing diff --git a/packages/functions/.env.sample b/packages/functions/.env.sample new file mode 100644 index 000000000..d68e79967 --- /dev/null +++ b/packages/functions/.env.sample @@ -0,0 +1,17 @@ +ENVIRONMENT=test +PROJECT_ID=google-project-id +NFT_STORAGE_TOKEN=yourneftstoragetokne +JWT_SECRET=yourjwtsecret +ALGOLIA_APPID=your_algolia_app_id +ALGOLIA_KEY=your_algolia_key +ENCRYPTION_SALT=yout_encryption_salt +IP_INFO_TOKEN=your_ip_info_token +NEYNAR_API_KEY=your_neynary_key + +DB_USER=db_user +DB_USER_PWD=db_pwd +DB_NAME=buildcore +DB_HOST=db-server-host +DB_PORT=5432 + +GOOGLE_APPLICATION_CREDENTIALS='path-to-your-credentials-file' diff --git a/packages/notifier/.env.sample b/packages/notifier/.env.sample new file mode 100644 index 000000000..f48d2e5f3 --- /dev/null +++ b/packages/notifier/.env.sample @@ -0,0 +1,5 @@ +DB_USER=db_user +DB_USER_PWD=db_pwd +DB_NAME=buildcore +DB_HOST=db-server-host +DB_PORT=5432 diff --git a/packages/search/.env.sample b/packages/search/.env.sample new file mode 100644 index 000000000..62fb21d56 --- /dev/null +++ b/packages/search/.env.sample @@ -0,0 +1,6 @@ + +DB_USER=db_user +DB_USER_PWD=db_pwd +DB_NAME=buildcore +DB_HOST=db-server-host +DB_PORT=5432 \ No newline at end of file