coral-xyz / backpack

🎒 Next level crypto wallet
https://backpack.app
GNU General Public License v3.0
1.35k stars 811 forks source link

Update readme to add steps to setup backend locally #3536

Open hkirat opened 1 year ago

dhvll commented 1 year ago

Can I get this issue to assign myself?

hkirat commented 1 year ago

This one might make sense for someone in the team to do (because they're most familial with the setup process)

dhvll commented 1 year ago

Okay. If there are any beginner-friendly issues would love to work on them. Thanks

AFZL210 commented 1 year ago

@dhavall13 try fixing issues tagged with polish and good first issue tag

RakeshBC1 commented 1 year ago

I think these should be from an experienced internal person shd come with config setup steps, as we alre struggling to setup locally.

keshari1arya commented 1 year ago

we need to setup backend in order to move forward with our current stuff. Can we get some quick steps at least? meanwhile i am trying my own to setup.

tagging @hkirat @armaniferrante

hkirat commented 1 year ago

Hi, these are the quick steps-

 - Run the DB locally
    cd backend/reef/
    docker-compose up
 - Run Hasura locally
    cd backend/reef/hasura
    npx hasura-cli console  
 - Run the backend service locally
    cd backend/native/backpack-api
    yarn start
 - Change the URL to point to local (http://localhost:8080) vs prod
    https://github.com/coral-xyz/backpack/blob/master/packages/common/src/constants.ts#L581
keshari1arya commented 1 year ago

Thank you @hkirat this is life saver. Cheers

vijayabhaskar-ev commented 1 year ago

Getting this error when i tried to run the back end "Cannot find module '@coral-xyz/common' or its corresponding type declarations.ts(2307)"

hkirat commented 1 year ago

Can you go to packages/common and build it once (yarn build)

vijayabhaskar-ev commented 1 year ago

@hkirat Still getting the same error. Some how the coral package is not getting recognized

hkirat commented 1 year ago

Can you do

cd packages/common
yarn build
cd ../..

and try a yarn build in the root folder?

vijayabhaskar-ev commented 1 year ago

when i tried yarn build in common ,getting no output. But when i ran yarn build on root folder , getting this output :

@coral-xyz/zeus:build: cache miss, executing c036e64f6237f787
@coral-xyz/chat-zeus:build: cache miss, executing 61d64fb8f1ea3938
@coral-xyz/common:build: cache miss, executing b4b8313c95b4d7c6
@coral-xyz/backend-worker-xnft-wrapper:build: cache miss, executing 1e7f4abc05c5f699
@coral-xyz/themes:build: cache miss, executing 81c5c945134e5279
@coral-xyz/backpack-web:build: cache miss, executing 0f77445d39b34acb
@coral-xyz/backend-worker-xnft-wrapper:build: file:///home/vijay/Documents/projects/backpack/backpack/backend/workers/xnft-wrapper/build.js:9
@coral-xyz/backend-worker-xnft-wrapper:build:   await build({
@coral-xyz/backend-worker-xnft-wrapper:build:   ^^^^^
@coral-xyz/backend-worker-xnft-wrapper:build: 
@coral-xyz/backend-worker-xnft-wrapper:build: SyntaxError: Unexpected reserved word
@coral-xyz/backend-worker-xnft-wrapper:build:     at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)
@coral-xyz/backend-worker-xnft-wrapper:build:     at async link (internal/modules/esm/module_job.js:42:21)
@coral-xyz/backend-worker-xnft-wrapper:build: ERROR: command finished with error: command (/home/vijay/Documents/projects/backpack/backpack/backend/workers/xnft-wrapper) yarn run build exited (1)
command (/home/vijay/Documents/projects/backpack/backpack/backend/workers/xnft-wrapper) yarn run build exited (1)
vijayabhaskar-ev commented 1 year ago

Got this output when i ran yarn start at backpack-api folder


✘ [ERROR] Could not resolve "@coral-xyz/backend-common"

    src/routes/v1/friends.ts:1:35:
      1 │ import { insertNotification } from "@coral-xyz/backend-common";
        ╵                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@coral-xyz/backend-common" as external to exclude it from the bundle, which
  will remove this error.

✘ [ERROR] Could not resolve "@coral-xyz/zeus"

    src/db/preference.ts:1:22:
      1 │ import { Chain } from "@coral-xyz/zeus";
        ╵                       ~~~~~~~~~~~~~~~~~

  You can mark the path "@coral-xyz/zeus" as external to exclude it from the bundle, which will
  remove this error.

✘ [ERROR] Could not resolve "@coral-xyz/zeus"

    src/db/notifications.ts:1:32:
      1 │ import { Chain, order_by } from "@coral-xyz/zeus";
        ╵                                 ~~~~~~~~~~~~~~~~~

  You can mark the path "@coral-xyz/zeus" as external to exclude it from the bundle, which will
  remove this error.

✘ [ERROR] Could not resolve "@coral-xyz/backend-common"

    src/auth/middleware.ts:1:29:
      1 │ import { validateRoom } from "@coral-xyz/backend-common";
        ╵                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@coral-xyz/backend-common" as external to exclude it from the bundle, which
  will remove this error.

✘ [ERROR] Could not resolve "@coral-xyz/backend-common"

    src/routes/v1/barter.ts:1:29:
      1 │ import { validateRoom } from "@coral-xyz/backend-common";
        ╵                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@coral-xyz/backend-common" as external to exclude it from the bundle, which
  will remove this error.

✘ [ERROR] Could not resolve "@coral-xyz/backend-common"

    src/routes/v1/chats.ts:1:51:
      1 │ import { enrichMessages , getHistoryUpdates } from "@coral-xyz/backend-common";
        ╵                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@coral-xyz/backend-common" as external to exclude it from the bundle, which
  will remove this error.

6 of 15 errors shown (disable the message limit with --log-limit=0)
child_process.js:656
    throw err;
    ^

Error: Command failed: /home/vijay/Documents/projects/backpack/backpack/node_modules/esbuild-linux-64/bin/esbuild ./src/index.js --bundle --platform=node --outfile=dist/index.js
    at checkExecSyncError (child_process.js:635:11)
    at Object.execFileSync (child_process.js:653:15)
    at Object.<anonymous> (/home/vijay/Documents/projects/backpack/backpack/backend/native/backpack-api/node_modules/esbuild/bin/esbuild:211:28)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47 {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 50488,
  stdout: null,
  stderr: null
}
npm ERR! Lifecycle script `build` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: backpack-api@1.0.0 
npm ERR!   at location: /home/vijay/Documents/projects/backpack/backpack/backend/native/backpack-api 
hkirat commented 1 year ago

Can you try these steps

yarn cache clean
cd <backpack root>

git clean -xfd
yarn
yarn build --force 
vijayabhaskar-ev commented 1 year ago

Getting this error after running yarn build --force

• Packages in scope: @coral-xyz/app-extension, @coral-xyz/app-mobile, @coral-xyz/backend-common, @coral-xyz/backend-worker-xnft-wrapper, @coral-xyz/background, @coral-xyz/backpack-web, @coral-xyz/blockchain-common, @coral-xyz/blockchain-evm, @coral-xyz/blockchain-keyring, @coral-xyz/blockchain-solana, @coral-xyz/chat-sdk, @coral-xyz/chat-zeus, @coral-xyz/common, @coral-xyz/db, @coral-xyz/deptool, @coral-xyz/ledger-injection, @coral-xyz/message-sdk, @coral-xyz/provider-core, @coral-xyz/provider-injection, @coral-xyz/react-common, @coral-xyz/recoil, @coral-xyz/tamagui, @coral-xyz/themes, @coral-xyz/wallet-standard, @coral-xyz/xnft-cli, @coral-xyz/zeus, auth, avatars, backend-ws, backpack-api, dropzone-cli, eslint-config-custom, ethereum-rpc-proxy, feature-gates, invites, jupiter-proxy, nft-data, notifications-worker, rpc-proxy, swr-cache, version, xnft-api-server, xnft-gateway
• Running build in 43 packages
• Remote caching disabled
@coral-xyz/zeus:build: cache bypass, force executing c036e64f6237f787
@coral-xyz/backpack-web:build: cache bypass, force executing 0f77445d39b34acb
@coral-xyz/chat-zeus:build: cache bypass, force executing 61d64fb8f1ea3938
@coral-xyz/backend-worker-xnft-wrapper:build: cache bypass, force executing 1e7f4abc05c5f699
@coral-xyz/themes:build: cache bypass, force executing 81c5c945134e5279
@coral-xyz/common:build: cache bypass, force executing b4b8313c95b4d7c6
@coral-xyz/backend-worker-xnft-wrapper:build: file:///home/vijay/Documents/projects/backpack/backpack/backend/workers/xnft-wrapper/build.js:9
@coral-xyz/backend-worker-xnft-wrapper:build:   await build({
@coral-xyz/backend-worker-xnft-wrapper:build:   ^^^^^
@coral-xyz/backend-worker-xnft-wrapper:build: 
@coral-xyz/backend-worker-xnft-wrapper:build: SyntaxError: Unexpected reserved word
@coral-xyz/backend-worker-xnft-wrapper:build:     at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)
@coral-xyz/backend-worker-xnft-wrapper:build:     at async link (internal/modules/esm/module_job.js:42:21)
@coral-xyz/backend-worker-xnft-wrapper:build: ERROR: command finished with error: command (/home/vijay/Documents/projects/backpack/backpack/backend/workers/xnft-wrapper) yarn run build exited (1)
command (/home/vijay/Documents/projects/backpack/backpack/backend/workers/xnft-wrapper) yarn run build exited (1)

Is any other people have faced the same kind of issue?

hkirat commented 1 year ago

Could you share your OS Node version npm version

vijayabhaskar-ev commented 1 year ago

Ubuntu 22.04.1 LTS node version : 18.15.0 npm version:9.5.0

hkirat commented 1 year ago

Can you try after downgrading to v18.1.0

vijayabhaskar-ev commented 1 year ago

Can you try after downgrading to v18.1.0

Working now . Thank you

VISHALVARUN011002 commented 5 months ago

devtools#build failed to build in yarn build

PS C:\Users\MI\Downloads\backpack-master\backpack-master> yarn build ╭───────────────────────────────────────────────────────────────────────╮ │ │ │ Update available v1.11.1 ≫ v1.13.3 │ │ Changelog: https://github.com/vercel/turbo/releases/tag/v1.13.3 │ │ Run "npx @turbo/codemod@latest update" to update │ │ │ │ Follow @turborepo for updates: https://x.com/turborepo │ ╰───────────────────────────────────────────────────────────────────────╯ • Packages in scope: @coral-xyz/app-extension, @coral-xyz/background, @coral-xyz/backpack-web, @coral-xyz/common, @coral-xyz/data-components, @coral-xyz/expo-devtools, @coral-xyz/i18n, @coral-xyz/provider-core, @coral-xyz/provider-injection, @coral-xyz/react-common, @coral-xyz/recoil, @coral-xyz/secure-background, @coral-xyz/secure-clients, @coral-xyz/secure-ui, @coral-xyz/staking, @coral-xyz/tamagui, @coral-xyz/wallet-standard, @coral-xyz/xnft-cli, eslint-config-custom • Running build in 19 packages • Remote caching disabled @coral-xyz/wallet-standard:build: cache miss, executing 8d9ba2588e11467e @coral-xyz/backpack-web:build: cache miss, executing 72fa53e61c31bb8a @coral-xyz/expo-devtools:build: cache miss, executing 439be52a651fb8e2 @coral-xyz/common:build: cache miss, executing 1193f27f2e7207bb @coral-xyz/expo-devtools:build: C:\Users\MI\Downloads\backpack-master\backpack-master\node_modules\expo-module-scripts\bin\expo-module-build:3 @coral-xyz/expo-devtools:build: set -eo pipefail @coral-xyz/expo-devtools:build: ^^^^^^^^ @coral-xyz/expo-devtools:build: @coral-xyz/expo-devtools:build: SyntaxError: Unexpected identifier 'pipefail' @coral-xyz/expo-devtools:build: at internalCompileFunction (node:internal/vm:77:18)
@coral-xyz/expo-devtools:build: at wrapSafe (node:internal/modules/cjs/loader:1288:20) @coral-xyz/expo-devtools:build: at Module._compile (node:internal/modules/cjs/loader:1340:27) @coral-xyz/expo-devtools:build: at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) @coral-xyz/expo-devtools:build: at Module.load (node:internal/modules/cjs/loader:1207:32) @coral-xyz/expo-devtools:build: at Module._load (node:internal/modules/cjs/loader:1023:12) @coral-xyz/expo-devtools:build: at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) @coral-xyz/expo-devtools:build: at node:internal/main/run_main_module:28:49 @coral-xyz/expo-devtools:build: @coral-xyz/expo-devtools:build: Node.js v20.11.1 @coral-xyz/expo-devtools:build: ERROR: command finished with error: command (C:\Users\MI\Downloads\backpack-master\backpack-master\packages\expo-devtools) C:\Users\MI\AppData\Local\Temp\xfs-765e625e\yarn.cmd run build exited (1) @coral-xyz/wallet-standard:build: @coral-xyz/wallet-standard:build: > @coral-xyz/wallet-standard@0.1.0 clean @coral-xyz/wallet-standard:build: > shx mkdir -p lib && shx rm -rf lib @coral-xyz/wallet-standard:build: @coral-xyz/backpack-web:build: info - Skipping validation of types @coral-xyz/backpack-web:build: info - Linting... @coral-xyz/wallet-standard:build: @coral-xyz/wallet-standard:build: > @coral-xyz/wallet-standard@0.1.0 tsc @coral-xyz/wallet-standard:build: > tsc --build --verbose tsconfig.all.json @coral-xyz/wallet-standard:build: @coral-xyz/wallet-standard:build: 3:36:08 AM - Projects in this build: @coral-xyz/wallet-standard:build: tsconfig.cjs.json @coral-xyz/wallet-standard:build: tsconfig.esm.json @coral-xyz/wallet-standard:build: * tsconfig.all.json @coral-xyz/wallet-standard:build: @coral-xyz/wallet-standard:build: 3:36:08 AM - Project 'tsconfig.cjs.json' is out of date because output file 'lib/cjs/account.js' does not exist @coral-xyz/wallet-standard:build: @coral-xyz/wallet-standard:build: 3:36:08 AM - Building project 'C:/Users/MI/Downloads/backpack-master/backpack-master/packages/wallet-standard/tsconfig.cjs.json'... @coral-xyz/wallet-standard:build: @coral-xyz/backpack-web:build: @coral-xyz/backpack-web:build: ./pages/downloads.tsx
@coral-xyz/backpack-web:build: 45:1 Warning: This line has a length of 119. Maximum allowed is 100. max-len @coral-xyz/backpack-web:build: @coral-xyz/backpack-web:build: ./components/Nav.tsx @coral-xyz/backpack-web:build: 63:1 Warning: This line has a length of 109. Maximum allowed is 100. max-len @coral-xyz/backpack-web:build: 66:1 Warning: This line has a length of 148. Maximum allowed is 100. max-len @coral-xyz/backpack-web:build: @coral-xyz/backpack-web:build: info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules @coral-xyz/backpack-web:build: info - Creating an optimized production build... @coral-xyz/common:build: /bin/bash: C:\Users\MI\Downloads\backpack-master\backpack-master\packages\common\scripts\config.sh: No such file or directory
@coral-xyz/wallet-standard:build: 3:36:14 AM - Project 'tsconfig.esm.json' is out of date because output file 'lib/esm/account.js' does not exist @coral-xyz/wallet-standard:build: @coral-xyz/wallet-standard:build: 3:36:14 AM - Building project 'C:/Users/MI/Downloads/backpack-master/backpack-master/packages/wallet-standard/tsconfig.esm.json'... @coral-xyz/wallet-standard:build: @coral-xyz/backpack-web:build: Browserslist: caniuse-lite is outdated. Please run: @coral-xyz/backpack-web:build: npx browserslist@latest --update-db @coral-xyz/backpack-web:build: Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating @coral-xyz/wallet-standard:build: @coral-xyz/wallet-standard:build: > @coral-xyz/wallet-standard@0.1.0 package @coral-xyz/wallet-standard:build: > shx mkdir -p lib/cjs && shx echo '{ "type": "commonjs" }' > lib/cjs/package.json @coral-xyz/wallet-standard:build: @coral-xyz/backpack-web:build: Browserslist: caniuse-lite is outdated. Please run: @coral-xyz/backpack-web:build: npx update-browserslist-db@latest @coral-xyz/backpack-web:build: Why you should do it regularly: https://github.com/browserslist/update-db#readme @coral-xyz/backpack-web:build: info - Compiled successfully @coral-xyz/backpack-web:build: info - Collecting page data... @coral-xyz/backpack-web:build: info - Generating static pages (0/8) @coral-xyz/backpack-web:build: info - Generating static pages (2/8) @coral-xyz/backpack-web:build: info - Generating static pages (4/8) @coral-xyz/backpack-web:build: info - Generating static pages (6/8) @coral-xyz/backpack-web:build: info - Generating static pages (8/8) @coral-xyz/backpack-web:build: info - Finalizing page optimization... @coral-xyz/backpack-web:build: @coral-xyz/backpack-web:build: Route (pages) Size First Load JS @coral-xyz/backpack-web:build: ┌ ○ / (314 ms) 374 B 93.5 kB @coral-xyz/backpack-web:build: ├ /_app 0 B 93.2 kB @coral-xyz/backpack-web:build: ├ ○ /404 181 B 93.3 kB @coral-xyz/backpack-web:build: ├ ○ /about (329 ms) 781 B 93.9 kB @coral-xyz/backpack-web:build: ├ λ /api/apk-download-link 0 B 93.2 kB @coral-xyz/backpack-web:build: ├ λ /api/email 0 B 93.2 kB @coral-xyz/backpack-web:build: ├ ○ /downloads (301 ms) 4.5 kB 97.7 kB @coral-xyz/backpack-web:build: ├ ○ /privacy 471 B 93.6 kB @coral-xyz/backpack-web:build: ├ ○ /terms 469 B 93.6 kB @coral-xyz/backpack-web:build: └ ○ /ul/v1/browse/[[...url]] 610 B 93.8 kB @coral-xyz/backpack-web:build: + First Load JS shared by all 98.1 kB @coral-xyz/backpack-web:build: ├ chunks/framework-e2ea724f8e15eff2.js 44.9 kB @coral-xyz/backpack-web:build: ├ chunks/main-ac4fc349a2b21bac.js 30.6 kB @coral-xyz/backpack-web:build: ├ chunks/pages/_app-0269f8e43cca3ab9.js 16 kB @coral-xyz/backpack-web:build: ├ chunks/webpack-60fa36f59df8e1c7.js 1.59 kB @coral-xyz/backpack-web:build: └ css/fc27e9e8b0bca7bc.css 4.93 kB @coral-xyz/backpack-web:build: @coral-xyz/backpack-web:build: λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps) @coral-xyz/backpack-web:build: ○ (Static) automatically rendered as static HTML (uses no initial props) @coral-xyz/backpack-web:build: @coral-xyz/expo-devtools#build: command (C:\Users\MI\Downloads\backpack-master\backpack-master\packages\expo-devtools) C:\Users\MI\AppData\Local\Temp\xfs-765e625e\yarn.cmd run build exited (1)

Tasks: 0 successful, 4 total Cached: 0 cached, 4 total Time: 44.292s Failed: @coral-xyz/expo-devtools#build

ERROR run failed: command exited (1)