Dir Structure

Let's dive into the nutshell to learn how to implement it. The code directory of the project `trustless-browser-sandbox` is:

โ•ญโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚  # โ”‚        name         โ”‚ type โ”‚   size   โ”‚   modified   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  0 โ”‚ README.md           โ”‚ file โ”‚     35 B โ”‚ 2 months ago โ”‚
โ”‚  1 โ”‚ config-overrides.js โ”‚ file โ”‚  1.7 KiB โ”‚ 2 months ago โ”‚
โ”‚  2 โ”‚ demo-game           โ”‚ dir  โ”‚  4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚  3 โ”‚ node_modules        โ”‚ dir  โ”‚ 40.0 KiB โ”‚ 2 months ago โ”‚
โ”‚  4 โ”‚ package-lock.json   โ”‚ file โ”‚  1.0 MiB โ”‚ 2 months ago โ”‚
โ”‚  5 โ”‚ package.json        โ”‚ file โ”‚  2.8 KiB โ”‚ 2 months ago โ”‚
โ”‚  6 โ”‚ planet              โ”‚ dir  โ”‚  4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚  7 โ”‚ public              โ”‚ dir  โ”‚  4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚  8 โ”‚ publish-td.sh       โ”‚ file โ”‚    268 B โ”‚ 2 months ago โ”‚
โ”‚  9 โ”‚ publish.sh          โ”‚ file โ”‚    281 B โ”‚ 2 months ago โ”‚
โ”‚ 10 โ”‚ roguelike           โ”‚ dir  โ”‚  4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚ 11 โ”‚ src                 โ”‚ dir  โ”‚  4.0 KiB โ”‚ 2 weeks ago  โ”‚
โ”‚ 12 โ”‚ tdengine            โ”‚ dir  โ”‚  4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚ 13 โ”‚ tsconfig.json       โ”‚ file โ”‚    561 B โ”‚ 2 months ago โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

In it, the subdirectory `roguelike` implements the game backend logic (which is a Rust project) that we will talk about later. Let's look into the src subdirectory:

โ•ญโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚  # โ”‚          name          โ”‚ type โ”‚  size   โ”‚   modified   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  0 โ”‚ src/data               โ”‚ dir  โ”‚ 4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚  1 โ”‚ src/sdk                โ”‚ dir  โ”‚ 4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚  2 โ”‚ src/react-app-env.d.ts โ”‚ file โ”‚    40 B โ”‚ 2 months ago โ”‚
โ”‚  3 โ”‚ src/logo.svg           โ”‚ file โ”‚ 1.1 KiB โ”‚ 2 months ago โ”‚
โ”‚  4 โ”‚ src/types              โ”‚ dir  โ”‚ 4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚  5 โ”‚ src/layout             โ”‚ dir  โ”‚ 4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚  6 โ”‚ src/index.css          โ”‚ file โ”‚ 1.0 KiB โ”‚ 2 months ago โ”‚
โ”‚  7 โ”‚ src/serviceWorker.ts   โ”‚ file โ”‚ 5.2 KiB โ”‚ 2 months ago โ”‚
โ”‚  8 โ”‚ src/styles             โ”‚ dir  โ”‚ 4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚  9 โ”‚ src/games              โ”‚ dir  โ”‚ 4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚ 10 โ”‚ src/modals             โ”‚ dir  โ”‚ 4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚ 11 โ”‚ src/assets             โ”‚ dir  โ”‚ 4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚ 12 โ”‚ src/app                โ”‚ dir  โ”‚ 4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚ 13 โ”‚ src/utils              โ”‚ dir  โ”‚ 4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚ 14 โ”‚ src/setupTests.ts      โ”‚ file โ”‚   255 B โ”‚ 2 months ago โ”‚
โ”‚ 15 โ”‚ src/components         โ”‚ dir  โ”‚ 4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚ 16 โ”‚ src/fonts              โ”‚ dir  โ”‚ 4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚ 17 โ”‚ src/index.tsx          โ”‚ file โ”‚   690 B โ”‚ 2 months ago โ”‚
โ”‚ 18 โ”‚ src/App.css            โ”‚ file โ”‚   623 B โ”‚ 2 months ago โ”‚
โ”‚ 19 โ”‚ src/App.tsx            โ”‚ file โ”‚   283 B โ”‚ 2 months ago โ”‚
โ”‚ 20 โ”‚ src/images             โ”‚ dir  โ”‚ 4.0 KiB โ”‚ 2 months ago โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

This is a typescript project implementing the frontend app, it forms the basic bone of the entire frontend app. The card roguelike game is located in `src/games`, as you can see:

โ•ญโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ # โ”‚          name          โ”‚ type โ”‚  size   โ”‚   modified   โ”‚
โ”œโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 0 โ”‚ src/games/sumgame      โ”‚ dir  โ”‚ 4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚ 1 โ”‚ src/games/towerdefence โ”‚ dir  โ”‚ 4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚ 2 โ”‚ src/games/style.scss   โ”‚ file โ”‚   240 B โ”‚ 2 months ago โ”‚
โ”‚ 3 โ”‚ src/games/roguelike    โ”‚ dir  โ”‚ 4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚ 4 โ”‚ src/games/demogame     โ”‚ dir  โ”‚ 4.0 KiB โ”‚ 2 months ago โ”‚
โ”‚ 5 โ”‚ src/games/planet       โ”‚ dir  โ”‚ 4.0 KiB โ”‚ 2 months ago โ”‚
โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

The `src/games/roguelike` is the right place for the frontend of our card roguelike game which is shown on the previous page.

Last updated