Skip to content

Commit 0fc51ef

Browse files
committed
refactor: consolidate web apps documentation into a single overview and setup guide, removing the old overview file
1 parent bb67e90 commit 0fc51ef

4 files changed

Lines changed: 257 additions & 122 deletions

File tree

astro.config.mjs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,8 @@ export default defineConfig({
8282
label: "Development",
8383
items: [
8484
{
85-
label: "Web Apps Overview",
86-
slug: "development/web-apps-overview",
87-
},
88-
{
89-
label: "Web Apps Install and Run",
90-
slug: "development/web-apps-install-and-run",
85+
label: "Web Apps Overview and Setup",
86+
slug: "development/web-apps-overview-and-setup",
9187
},
9288
{
9389
label: "Querying Data",

src/content/docs/development/web-apps-install-and-run.mdx renamed to src/content/docs/development/web-apps-install-and-run(old).mdx

File renamed without changes.
Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
---
2+
title: Web Apps Overview and Setup
3+
description: Learn how to navigate in the Torus ecosystem
4+
---
5+
6+
import {
7+
Steps,
8+
TabItem,
9+
Tabs,
10+
LinkCard,
11+
FileTree,
12+
Aside,
13+
} from "@astrojs/starlight/components";
14+
15+
These docs guide you through building and integrating with Torus web apps—from understanding our structure and stack to installing and developing.
16+
17+
The ecosystem is built using a monorepo with [Turborepo](https://turbo.build/repo/docs), which allows us to share code and tools across different projects.
18+
19+
<Aside type="tip">
20+
To access environments pointing to the testnet nodes, add the `.testnet`
21+
subdomain to the URL, eg. `https://allocator.testnet.torus.network/`
22+
</Aside>
23+
24+
## Prerequisites
25+
26+
- **Node.js** - `20.16.0` or higher.
27+
- **PNPM** - `9.7.1` or higher.
28+
- **Docker** - [installation guide](https://docs.docker.com/get-docker/).
29+
- **Just** - [installation guide](https://github.com/casey/just).
30+
31+
##### Docker Tip
32+
33+
If you have difficulties or want alternatives to simplify using Docker, consider:
34+
35+
- [Colima](https://github.com/abiosoft/colima): A lightweight solution for running containers on macOS.
36+
- [Orbstack](https://orbstack.dev/): A fast and efficient alternative for managing containers.
37+
38+
## Quick Start
39+
40+
```bash
41+
# Clone and setup
42+
git clone git@github.com:renlabs-dev/torus-ts.git
43+
cd torus-ts
44+
pnpm install
45+
cp .env.example .env
46+
47+
# Build and run
48+
just build
49+
just dev torus-wallet # or any other app
50+
```
51+
52+
For detailed setup instructions, see the setup guide below.
53+
54+
<Aside type="note">
55+
Some environment variables required by the `torus-ts` monorepo are sensitive
56+
and cannot be shared publicly. You’ll need to configure them manually using
57+
the provided `.env.example` file as a reference.
58+
</Aside>
59+
60+
## Frameworks & Libraries
61+
62+
We use a variety of frameworks and libraries to build our web apps. Here are some of the key ones:
63+
64+
- **React**: JavaScript library for building user interfaces
65+
- **Next.js**: React framework for building static and server-rendered applications
66+
- **TypeScript**: Typed superset of JavaScript that compiles to plain JavaScript
67+
- **Tailwind**: Utility-first CSS framework for rapidly building custom designs
68+
- **Drizzle**: Typesafe ORM for TypeScript
69+
- **tRPC**: TypeScript-first RPC framework for Node.js
70+
- **TanStack Query**: data-fetching library for React
71+
- **Polkadot JS API**: JavaScript API for interacting with Polkadot-based chains
72+
- **Agent API**: Enables decentralized collaboration among autonomous AI agents
73+
74+
## Project Structure
75+
76+
<FileTree>
77+
78+
- .github
79+
80+
- workflows pnpm cache setup & ci/cd
81+
- ISSUE_TEMPLATE Template for open source contributors
82+
- DISCUSSION_TEMPLATE Template for open source contributors
83+
84+
- .vscode
85+
86+
- ... Extensions and settings for VSCode users
87+
88+
- apps
89+
90+
- torus-page Landing Page
91+
- torus-portal Torus Hypergraph
92+
- torus-governance DAO & Governance Portal
93+
- torus-wallet Transactions & Staking
94+
- torus-bridge Bridge between Torus and Subspace
95+
- torus-allocator Set weights to Agents
96+
97+
- services
98+
99+
- torus-cache Blockchain data caching service
100+
- torus-worker Background services
101+
102+
- packages
103+
104+
- ui UI components library
105+
- db Typesafe DB calls using Drizzle
106+
- dsl Constraint definitions for Torus
107+
- api tRPC v11 router definition
108+
- utils Common code
109+
- **torus-ts-sdk** Typesafe substrate client library
110+
- env-validation Environment variables validation
111+
- torus-provider Polkadot JS API provider
112+
- query-provider React Query provider
113+
114+
- tooling
115+
116+
- eslint Shared, fine-grained, eslint presets
117+
- prettier Shared prettier configuration
118+
- tailwind Shared tailwind configuration
119+
- typescript Shared tsconfig you can extend from
120+
121+
- just
122+
- justfile All the commands you need to run the project
123+
124+
</FileTree>
125+
126+
This stack comes from [create-t3-app](https://github.com/t3-oss/create-t3-app).
127+
128+
This guide will walk you through the process of installing and running the `torus-ts` monorepo.
129+
130+
## Monorepo setup
131+
132+
<br />
133+
134+
<Steps>
135+
136+
1. ##### Clone the repository
137+
138+
<Tabs>
139+
<TabItem label="SSH">
140+
```bash
141+
# Recommended for contributors with SSH keys configured.
142+
git clone git@github.com:renlabs-dev/torus-ts.git
143+
```
144+
</TabItem>
145+
<TabItem label="HTTPS">
146+
```bash
147+
# Works without SSH key setup.
148+
git clone https://github.com/renlabs-dev/torus-ts.git
149+
```
150+
</TabItem>
151+
<TabItem label="GitHub CLI">
152+
```bash
153+
gh repo clone renlabs-dev/torus-ts
154+
```
155+
Use the [GitHub CLI](https://cli.github.com/).
156+
</TabItem>
157+
</Tabs>
158+
159+
<br />
160+
161+
2. ##### Install the dependencies
162+
163+
```bash
164+
pnpm install
165+
# or
166+
just install
167+
```
168+
169+
<br />
170+
171+
3. ##### Configure environment variables
172+
173+
There is an `.env.example` in the root directory you can use for reference
174+
175+
```bash
176+
cp .env.example .env
177+
```
178+
179+
<br />
180+
181+
4. ##### Setup database
182+
183+
<Aside>
184+
This step is only required for the **`torus-allocator`** &
185+
**`torus-governance`** apps.
186+
</Aside>
187+
188+
Create a postgres container with docker:
189+
190+
```bash
191+
docker run --name torus-db-container \
192+
-e POSTGRES_PASSWORD=password \
193+
-e POSTGRES_DB=torus-ts-db \
194+
-e POSTGRES_USER=postgres \
195+
-p 1337:1337 \
196+
-d postgres:16-alpine \
197+
postgres -p 1337
198+
```
199+
200+
Push the Drizzle schema to the database:
201+
202+
```bash
203+
just db-push
204+
```
205+
206+
You can also use the `just db-studio` command to open a GUI provided by [Drizzle](https://orm.drizzle.team/drizzle-studio/overview).
207+
208+
<br />
209+
210+
5. ##### Build the project
211+
212+
```bash
213+
just build
214+
```
215+
216+
<Aside type="caution">
217+
This step is required before running any app since **`@torus-ts/subspace`** needs to be built and imported indirectly, otherwise dependant packages may typecheck its sources and cause conflict in the generated/augmented types.
218+
</Aside>
219+
220+
<br />
221+
222+
6. ##### Run the project
223+
224+
From the root directory, run the following command:
225+
226+
```bash
227+
just dev <app-name> # Run any app
228+
```
229+
230+
<Aside>
231+
The `app-name` is the name of the app you want to run. You can find the
232+
list of apps in the `apps` directory. For example, to run the
233+
`torus-allocator` app, you would run `just dev torus-allocator`.
234+
</Aside>
235+
236+
Or from the app directory, run the following command:
237+
238+
```bash
239+
pnpm run dev
240+
```
241+
242+
<Aside>
243+
To run apps from their directories, you need to set up the environment
244+
variables inside the app directory as well.
245+
</Aside>
246+
247+
<br />
248+
249+
250+
</Steps>
251+
252+
<Aside type="caution">
253+
If you desire to contribute, please follow the `DISCUSSION_TEMPLATE` and
254+
`ISSUE_TEMPLATE` in the `.github` folder.
255+
</Aside>

src/content/docs/development/web-apps-overview.mdx

Lines changed: 0 additions & 116 deletions
This file was deleted.

0 commit comments

Comments
 (0)