Next build failed and some folder structure related questions
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
- Running
npx create-web3-dappwill prompt you twice to enter the details. #17 - Running
next buildthrows the following error:
Build optimization failed: found pages without a React Component as default export
Questions
- 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?
- 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?
- 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_KEYfrom.env.
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-dappHere is a list of the bugs / questions I encountered.
Bugs
- Running
npx create-web3-dappwill prompt you twice to enter the details. deleted duplicate code blocks #17
Merging.
- Running
next buildthrows the following error:Build optimization failed: found pages without a React Component as default export
Thanks for reporting - looking into it
Questions
- 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?
- 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?
- 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_KEYfrom.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
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 removed private key from front-end in new pr!
solved