Skip to content

Commit

Permalink
refactor: addressing pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aorumbayev committed Feb 21, 2024
1 parent 4cacd81 commit c0c4863
Show file tree
Hide file tree
Showing 47 changed files with 218 additions and 96 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AlgoKit Official Template for contributors

This repository is a template for creating new AlgoKit projects. It includes a basic structure for creating a beaker based smart contract project.
This repository is a template for creating new AlgoKit projects. It includes a basic structure for creating a full-stack project.

## Pre-requisites

Expand Down Expand Up @@ -30,7 +30,7 @@ We are using the [Conventional Commits](https://www.conventionalcommits.org/en/v

### Guiding Principles

AlgoKit development is done within the [AlgoKit Guiding Principles](./docs/algokit.md#guiding-principles).
AlgoKit development is done within the [AlgoKit Guiding Principles](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/algokit.md#guiding-principles).

### Pull Requests

Expand Down
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ This is one of the official templates used by AlgoKit to initialize both a front

## Features

This template supports a multitude of features for both developing full-stack applications using official AlgoKit templates. Using the full-stack template, currently allows you to create a workspace that combines the following frontend template:
This template supports a multitude of features for developing full-stack applications using official AlgoKit templates. Using the full-stack template, currently allows you to create a workspace that combines the following frontend template:

- [algokit-react-frontend-template](https://github.com/algorandfoundation/algokit-react-frontend-template) - A React web app with TypeScript, Tailwind CSS, and all Algorand specific integrations pre configured and ready for you to build.

And the following backend template:
And the following backend templates:

- [algokit-puya-template](https://github.com/algorandfoundation/algokit-puya-template) - An official starter for developing and deploying Puya smart contracts.
- [algokit-tealscript-template](https://github.com/algorand-devrel/tealscript-algokit-template) - An official starter for developing and deploying TealScript smart contracts.
- [algokit-beaker-default-template](https://github.com/algorandfoundation/algokit-beaker-default-template) - A production-ready baseline for developing and deploying Beaker smart contracts. Please note this template option is to be deprecated upon initial release of `puya`.
- [algokit-beaker-default-template](https://github.com/algorandfoundation/algokit-beaker-default-template) - A production-ready baseline for developing and deploying Beaker smart contracts. Please note this template option is to be deprecated after `puya` is ready for production use.

### Frontend

Expand Down Expand Up @@ -55,7 +55,7 @@ And the following backend template:
- VS Code configuration (linting, formatting, breakpoint debugging).
- dotenv (.env) file for configuration.
- Automated testing of the compiled smart contracts.
- [Output stability](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/articles/output_stability.md) tests of the TEAL output. Artifacts folder is also available as standalone `examples` for anyone curious to see default instances of presets of this template.
- [Output stability](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/articles/output_stability.md) tests of the TEAL output. Artifacts folder is also available as standalone `examples` for anyone curious to see default instances of preset projects.
- CI/CD pipeline using GitHub Actions.

> Refer to the respective backend repository mentioned in [features](#features) for up-to-date information.
Expand All @@ -64,14 +64,16 @@ And the following backend template:

Once the template is instantiated you can follow the [README.md](template_content/README.md.jinja) file to see instructions for how to use the template.

### Interactive wizard
### Interactive Wizard

Prefer to run the interactive wizard directly from the `algokit-cli`?
**To initialize using the `algokit` CLI**:

Run `algokit init` to get started. The wizard will guide you through the process of selecting the template that best suits your needs.
- Execute the command `algokit init`. This initiates an interactive wizard that assists in selecting the most appropriate template for your project requirements.

Prefer to try out any of the official templates interactively on `GitHub Codespaces`? Follow the steps below to get started:
**To initialize within GitHub Codespaces**:

1. Navigate to [algokit-base-template](https://github.com/algorandfoundation/algokit-base-template)
2. Click `Create codespace on main` by clicking on `Code` button under `Codespaces` tab.
3. Once the codespace is ready, algokit will automatically invoke an interactive prompt to help you choose the template best suited for your needs.
- Follow these steps to leverage GitHub Codespaces for template selection:

1. Go to the [algokit-base-template](https://github.com/algorandfoundation/algokit-base-template) repository.
2. Initiate a new codespace by selecting the `Create codespace on main` option. This can be found by clicking the `Code` button, then navigating to the `Codespaces` tab.
3. Upon codespace preparation, `algokit` will automatically start `LocalNet` and present a prompt with the next steps. Executing `algokit init` will initiate the interactive wizard.
2 changes: 1 addition & 1 deletion copier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ _subdirectory: ./template_content

_tasks:
- "echo '==== 1/4 - Initializing base template ===='"
- 'algokit init --template-url gh:algorandfoundation/algokit-base-template -n . --no-git --no-ide --no-bootstrap -a use_default_readme false'
- 'algokit init --template-url gh:algorandfoundation/algokit-base-template -n . --no-git --no-ide --no-bootstrap -a include_readme false -a include_algokit_toml false'

- "echo '==== 2/4 - Initializing frontend template ===='"
- "algokit init -t react -n {{ project_name }}-app --no-git --no-ide --no-bootstrap
Expand Down
2 changes: 1 addition & 1 deletion examples/production_beaker_react/.algokit.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[algokit]
min_version = "v1.8.0"
min_version = "v1.11.3"

[project]
type = 'workspace'
Expand Down
19 changes: 19 additions & 0 deletions examples/production_beaker_react/.devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"forwardPorts": [4001, 4002, 8980, 5173],
"portsAttributes": {
"4001": {
"label": "algod"
},
"4002": {
"label": "kmd"
},
"8980": {
"label": "indexer"
},
"5173": {
"label": "vite"
}
},
"postCreateCommand": "pipx install algokit",
"postStartCommand": "algokit localnet start && echo 'Run algokit init in terminal to get started with Algorand development 🚀'"
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,28 @@ jobs:
run: pipx install algokit

- name: Install dependencies
working-directory: ./projects/{{ project_name }}-app
working-directory: ./projects/production_beaker_react-app
run: npm ci

- name: Run linters
working-directory: ./projects/{{ project_name }}-app
working-directory: ./projects/production_beaker_react-app
run: npm run lint

- name: Run unit tests
working-directory: ./projects/{{ project_name }}-app
working-directory: ./projects/production_beaker_react-app
run: npm run test

- name: Create placeholder .env file
if: ${{ inputs.run-build }}
uses: makerxstudio/shared-config/.github/actions/env-to-placeholders@main
with:
env-output-path: ./projects/{{ project_name }}-app/.env
env-template-path: ./projects/{{ project_name }}-app/.env.template
env-output-path: ./projects/production_beaker_react-app/.env
env-template-path: ./projects/production_beaker_react-app/.env.template
env-variable-prefix: VITE_

- name: Build
if: ${{ inputs.run-build }}
working-directory: ./projects/{{ project_name }}-app
working-directory: ./projects/production_beaker_react-app
run: npm run build

- name: Archive
Expand Down
2 changes: 1 addition & 1 deletion examples/production_beaker_react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This starter full stack project has been generated using AlgoKit. See below for
1. Clone this repository locally.
2. Install pre-requisites:
- Make sure to have [Docker](https://www.docker.com/) installed and running on your machine.
- Install `AlgoKit` - [Link](https://github.com/algorandfoundation/algokit-cli#install): The minimum required version is `1.8.0`. Ensure you can execute `algokit --version` and get `1.8.0` or later.
- Install `AlgoKit` - [Link](https://github.com/algorandfoundation/algokit-cli#install)
- Bootstrap your local environment; run `algokit bootstrap all` within this folder, which will install Poetry, run `npm install` and `poetry install` in the root directory to install NPM and Python packages respectively, set up a `.venv` folder with a Python virtual environment and also install all Python dependencies.
- For TypeScript projects, it will also run `npm install` to install NPM packages.
- For all projects, it will copy `.env.template` to `.env`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: 0.9.4-16-gffd1386
_commit: 0.9.4-17-gd603f12
_src_path: gh:algorandfoundation/algokit-react-frontend-template
author_email: None
author_name: None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

The following folder is reserved for the Algorand Application Clients. The clients are used to interact with instances of Algorand Smart Contracts (ASC1s) deployed on-chain.

When you initially create your project the frontend starter automatically compiles (see [`generate:app-clients`](../../package.json)) the default `{{ contract_name }}` contract as `{{ contract_name.split('_')|map('capitalize')|join }}Client` and provides the [`AppCalls.tsx`](../components/AppCalls.tsx) component showcasing how to interact with that application client.
When you initially create your project, the frontend starter automatically compiles (see [`generate:app-clients`](../../package.json)) the default `hello_world` contract as `HelloWorldClient` and provides the [`AppCalls.tsx`](../components/AppCalls.tsx) component showcasing how to interact with that application client.

When you create new Beaker contracts on the backend folder and build them (so that they are available under `artifacts` folder) - simply run `npm run build` to automatically:
After you create or edit a contract in your contracts project and run a build (so that it's available under the `artifacts` folder), you'll need to run `npm run build` in this project to:

1. generate new typed clients based on all contracts currently available under `artifacts` folder.
2. move them to `frontend/src/contracts` folder.
1. Generate new typed clients based on all contracts currently available under `artifacts` folder.
2. Copy the typed clients into this folder (`src/contracts`).

Afterwards you are free to use the newly generated clients in your frontend code (such as using them in your custom components, functions and etc) as you wish.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: 0.4.0-13-g511ed3b
_commit: 0.4.0-14-g586fcab
_src_path: gh:algorandfoundation/algokit-puya-template
author_email: None
author_name: None
Expand Down
2 changes: 1 addition & 1 deletion examples/production_puya_react/.algokit.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[algokit]
min_version = "v1.8.0"
min_version = "v1.11.3"

[project]
type = 'workspace'
Expand Down
19 changes: 19 additions & 0 deletions examples/production_puya_react/.devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"forwardPorts": [4001, 4002, 8980, 5173],
"portsAttributes": {
"4001": {
"label": "algod"
},
"4002": {
"label": "kmd"
},
"8980": {
"label": "indexer"
},
"5173": {
"label": "vite"
}
},
"postCreateCommand": "pipx install algokit",
"postStartCommand": "algokit localnet start && echo 'Run algokit init in terminal to get started with Algorand development 🚀'"
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,28 @@ jobs:
run: pipx install algokit

- name: Install dependencies
working-directory: ./projects/{{ project_name }}-app
working-directory: ./projects/production_puya_react-app
run: npm ci

- name: Run linters
working-directory: ./projects/{{ project_name }}-app
working-directory: ./projects/production_puya_react-app
run: npm run lint

- name: Run unit tests
working-directory: ./projects/{{ project_name }}-app
working-directory: ./projects/production_puya_react-app
run: npm run test

- name: Create placeholder .env file
if: ${{ inputs.run-build }}
uses: makerxstudio/shared-config/.github/actions/env-to-placeholders@main
with:
env-output-path: ./projects/{{ project_name }}-app/.env
env-template-path: ./projects/{{ project_name }}-app/.env.template
env-output-path: ./projects/production_puya_react-app/.env
env-template-path: ./projects/production_puya_react-app/.env.template
env-variable-prefix: VITE_

- name: Build
if: ${{ inputs.run-build }}
working-directory: ./projects/{{ project_name }}-app
working-directory: ./projects/production_puya_react-app
run: npm run build

- name: Archive
Expand Down
2 changes: 1 addition & 1 deletion examples/production_puya_react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This starter full stack project has been generated using AlgoKit. See below for
1. Clone this repository locally.
2. Install pre-requisites:
- Make sure to have [Docker](https://www.docker.com/) installed and running on your machine.
- Install `AlgoKit` - [Link](https://github.com/algorandfoundation/algokit-cli#install): The minimum required version is `1.8.0`. Ensure you can execute `algokit --version` and get `1.8.0` or later.
- Install `AlgoKit` - [Link](https://github.com/algorandfoundation/algokit-cli#install)
- Bootstrap your local environment; run `algokit bootstrap all` within this folder, which will install Poetry, run `npm install` and `poetry install` in the root directory to install NPM and Python packages respectively, set up a `.venv` folder with a Python virtual environment and also install all Python dependencies.
- For TypeScript projects, it will also run `npm install` to install NPM packages.
- For all projects, it will copy `.env.template` to `.env`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: 0.9.4-16-gffd1386
_commit: 0.9.4-17-gd603f12
_src_path: gh:algorandfoundation/algokit-react-frontend-template
author_email: None
author_name: None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

The following folder is reserved for the Algorand Application Clients. The clients are used to interact with instances of Algorand Smart Contracts (ASC1s) deployed on-chain.

When you initially create your project the frontend starter automatically compiles (see [`generate:app-clients`](../../package.json)) the default `{{ contract_name }}` contract as `{{ contract_name.split('_')|map('capitalize')|join }}Client` and provides the [`AppCalls.tsx`](../components/AppCalls.tsx) component showcasing how to interact with that application client.
When you initially create your project, the frontend starter automatically compiles (see [`generate:app-clients`](../../package.json)) the default `hello_world` contract as `HelloWorldClient` and provides the [`AppCalls.tsx`](../components/AppCalls.tsx) component showcasing how to interact with that application client.

When you create new Beaker contracts on the backend folder and build them (so that they are available under `artifacts` folder) - simply run `npm run build` to automatically:
After you create or edit a contract in your contracts project and run a build (so that it's available under the `artifacts` folder), you'll need to run `npm run build` in this project to:

1. generate new typed clients based on all contracts currently available under `artifacts` folder.
2. move them to `frontend/src/contracts` folder.
1. Generate new typed clients based on all contracts currently available under `artifacts` folder.
2. Copy the typed clients into this folder (`src/contracts`).

Afterwards you are free to use the newly generated clients in your frontend code (such as using them in your custom components, functions and etc) as you wish.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: 0.4.0-13-g511ed3b
_commit: 0.4.0-14-g586fcab
_src_path: gh:algorandfoundation/algokit-puya-template
author_email: None
author_name: None
Expand Down
2 changes: 1 addition & 1 deletion examples/production_tealscript_react/.algokit.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[algokit]
min_version = "v1.8.0"
min_version = "v1.11.3"

[project]
type = 'workspace'
Expand Down
19 changes: 19 additions & 0 deletions examples/production_tealscript_react/.devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"forwardPorts": [4001, 4002, 8980, 5173],
"portsAttributes": {
"4001": {
"label": "algod"
},
"4002": {
"label": "kmd"
},
"8980": {
"label": "indexer"
},
"5173": {
"label": "vite"
}
},
"postCreateCommand": "pipx install algokit",
"postStartCommand": "algokit localnet start && echo 'Run algokit init in terminal to get started with Algorand development 🚀'"
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,28 @@ jobs:
run: pipx install algokit

- name: Install dependencies
working-directory: ./projects/{{ project_name }}-app
working-directory: ./projects/production_tealscript_react-app
run: npm ci

- name: Run linters
working-directory: ./projects/{{ project_name }}-app
working-directory: ./projects/production_tealscript_react-app
run: npm run lint

- name: Run unit tests
working-directory: ./projects/{{ project_name }}-app
working-directory: ./projects/production_tealscript_react-app
run: npm run test

- name: Create placeholder .env file
if: ${{ inputs.run-build }}
uses: makerxstudio/shared-config/.github/actions/env-to-placeholders@main
with:
env-output-path: ./projects/{{ project_name }}-app/.env
env-template-path: ./projects/{{ project_name }}-app/.env.template
env-output-path: ./projects/production_tealscript_react-app/.env
env-template-path: ./projects/production_tealscript_react-app/.env.template
env-variable-prefix: VITE_

- name: Build
if: ${{ inputs.run-build }}
working-directory: ./projects/{{ project_name }}-app
working-directory: ./projects/production_tealscript_react-app
run: npm run build

- name: Archive
Expand Down
2 changes: 1 addition & 1 deletion examples/production_tealscript_react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This starter full stack project has been generated using AlgoKit. See below for
1. Clone this repository locally.
2. Install pre-requisites:
- Make sure to have [Docker](https://www.docker.com/) installed and running on your machine.
- Install `AlgoKit` - [Link](https://github.com/algorandfoundation/algokit-cli#install): The minimum required version is `1.8.0`. Ensure you can execute `algokit --version` and get `1.8.0` or later.
- Install `AlgoKit` - [Link](https://github.com/algorandfoundation/algokit-cli#install)
- Bootstrap your local environment; run `algokit bootstrap all` within this folder, which will install Poetry, run `npm install` and `poetry install` in the root directory to install NPM and Python packages respectively, set up a `.venv` folder with a Python virtual environment and also install all Python dependencies.
- For TypeScript projects, it will also run `npm install` to install NPM packages.
- For all projects, it will copy `.env.template` to `.env`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: 0.9.4-16-gffd1386
_commit: 0.9.4-17-gd603f12
_src_path: gh:algorandfoundation/algokit-react-frontend-template
author_email: None
author_name: None
Expand Down
Loading

0 comments on commit c0c4863

Please sign in to comment.