create-web3-dapp icon indicating copy to clipboard operation
create-web3-dapp copied to clipboard

Next build failed and some folder structure related questions

Open kenryu42 opened this issue 3 years ago • 2 comments

Just finished the week 3 of road to web3 project by using create-web3-app. https://github.com/kenryu42/chain-battles-create-web3-dapp

Here is a list of the bugs / questions I encountered.

Bugs

  1. Running npx create-web3-dapp will prompt you twice to enter the details. #17
  2. Running next build throws the following error:

Build optimization failed: found pages without a React Component as default export

Questions

  1. Hardhat related packages are installed in the root directory, but I can't run hardhat commands from the root directory. What is the recommended way to use hardhat in this folder structure?
  2. Most full-stack app I've seen separate the back-end and front-end folders. Shouldn't we keep the backend and frontend folders separate?
  3. Is there a use case that requires the use of a private key on the front end? If no maybe we should remove the NEXT_PUBLIC_PRIVATE_KEY from .env.

kenryu42 avatar Aug 12 '22 14:08 kenryu42

Hey @kenryu42!

Just finished the week 3 of road to web3 project by using create-web3-app. https://github.com/kenryu42/chain-battles-create-web3-dapp

Here is a list of the bugs / questions I encountered.

Bugs

  1. Running npx create-web3-dapp will prompt you twice to enter the details. deleted duplicate code blocks #17

Merging.

  1. Running next build throws the following error:

Build optimization failed: found pages without a React Component as default export

Thanks for reporting - looking into it

Questions

  1. Hardhat related packages are installed in the root directory, but I can't run hardhat commands from the root directory. What is the recommended way to use hardhat in this folder structure?
  2. Most full-stack app I've seen separate the back-end and front-end folders. Shouldn't we keep the backend and frontend folders separate?
  3. Is there a use case that requires the use of a private key on the front end? If no maybe we should remove the NEXT_PUBLIC_PRIVATE_KEY from .env.

1,2. From the hardhat folder itself but, going to question number two - yes we should separate the folder structure 3. There are situations where you want your API key on the front-end I.e when you're fetching NFTs using the Alchemy API, or call a view function on a contract

Eversmile12 avatar Aug 16 '22 11:08 Eversmile12

Hey @Eversmile12 Glad you are back now. For question 3, NEXT_PUBLIC_PRIVATE_KEY refers to the private key of a wallet address. Is there a use case for the private key of a wallet address on the front end?

kenryu42 avatar Aug 16 '22 13:08 kenryu42

@kenryu42 removed private key from front-end in new pr!

Eversmile12 avatar Aug 23 '22 15:08 Eversmile12

solved

Eversmile12 avatar Sep 12 '22 20:09 Eversmile12