Welcome to your new Portfolio Template project, and welcome to the Internet Computer development community! This README serves as an introduction to get you started quickly with your project.
By default, creating a new project adds this README and some template files to your project directory. Feel free to customize the template files and include your own code to speed up your development cycle.
In order to use this template make sure that you are using dfx version 0.15.1 for native javascript development framework
dfxvm install 0.15.1
dfxvm default 0.15.1
restart your terminal
HAPPY CODING
Before you dive into development, here are some key resources to help you get familiar with the project:
- Quick Start Guide
- SDK Developer Tools
- Motoko Programming Language Guide
- Motoko Language Quick Reference
To get started, explore the project directory structure and the default configuration file. Working with this project in your development environment will not affect any production deployment or identity tokens.
Once you're ready to work on your project, here are some commands to help you get started:
cd portfolio_template/
dfx help
dfx canister --help
To test and run your project locally, follow these steps:
-
Start the Replica: This command starts the replica running in the background.
dfx start --background
-
Deploy the Canisters: Deploy your canisters to the replica and generate your candid interface.
dfx deploy
Once the deployment is complete, your application will be available at:
http://localhost:4943?canisterId={asset_canister_id}
-
Generate a New Candid Interface: If you make any changes to the backend canister, regenerate the candid interface by running:
npm run generate
This is recommended before starting the frontend development server, and it will be automatically run when you execute
dfx deploy
.
If you're working on the frontend and want to start the development server, use the following command:
npm start
This will start the frontend server at:
http://localhost:8080
API requests will be proxied to the replica at port 4943
.
If you are hosting the frontend code outside of DFX, you may need to make adjustments to ensure that the project doesn’t fetch the root key in production:
- Set
DFX_NETWORK
toic
if you are using Webpack. - Use your own method to replace
process.env.DFX_NETWORK
in the autogenerated declarations:- Set
canisters -> {asset_canister_id} -> declarations -> env_override
to a string indfx.json
. - Write your own
createActor
constructor for more advanced setups.
- Set
You're now ready to start working with the Portfolio Template project. Customize it, build your canisters, and have fun developing on the Internet Computer. If you run into any issues or need help, feel free to check the official documentation.
Happy coding! 🚀