Skip to content

Commit 0e05422

Browse files
Merge pull request #185 from ryzen-xp/Improve-Project-README
[Docs] Improve Project README with Detailed Setup Guide
2 parents 8b3414f + 96f4282 commit 0e05422

1 file changed

Lines changed: 198 additions & 0 deletions

File tree

README.md

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,204 @@ web3-student-lab/
103103
└── docs/ # Documentation and learning materials
104104
```
105105

106+
## 🚀 Setup Guide
107+
108+
This repository is a monorepo with three main parts:
109+
110+
- `frontend/` for the Next.js application
111+
- `backend/` for the Express + Prisma API
112+
- `contracts/` for Soroban smart contracts written in Rust
113+
114+
You can work on the web app with Node.js alone, but you will need Rust and the Soroban CLI to
115+
build or test the smart contracts.
116+
117+
### Prerequisites
118+
119+
Install these tools before starting:
120+
121+
- **Node.js**: version 20 LTS or newer
122+
- **npm**: included with Node.js
123+
- **Rust**: stable toolchain installed with `rustup`
124+
- **Soroban CLI**: for building, testing, and deploying contracts
125+
- **PostgreSQL 15+** or **Docker Compose**: for the backend database
126+
127+
### 1. Install Node.js
128+
129+
Download Node.js from the official website:
130+
131+
- [https://nodejs.org/en/download](https://nodejs.org/en/download)
132+
133+
Verify your installation:
134+
135+
```bash
136+
node --version
137+
npm --version
138+
```
139+
140+
### 2. Install Rust
141+
142+
Install Rust with `rustup`:
143+
144+
```bash
145+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
146+
```
147+
148+
Restart your terminal, then verify:
149+
150+
```bash
151+
rustc --version
152+
cargo --version
153+
```
154+
155+
Add the WebAssembly target required for Soroban contracts:
156+
157+
```bash
158+
rustup target add wasm32-unknown-unknown
159+
```
160+
161+
### 3. Install Soroban CLI
162+
163+
Install the Soroban CLI with Cargo:
164+
165+
```bash
166+
cargo install --locked soroban-cli
167+
```
168+
169+
Verify the installation:
170+
171+
```bash
172+
soroban --version
173+
```
174+
175+
For a beginner-friendly Soroban walkthrough, see [SOROBAN_GUIDE.md](SOROBAN_GUIDE.md).
176+
177+
### 4. Clone the Repository
178+
179+
```bash
180+
git clone https://github.com/StellarDevHub/Web3-Student-Lab.git
181+
cd Web3-Student-Lab
182+
```
183+
184+
### 5. Install Project Dependencies
185+
186+
Install all JavaScript dependencies from the project root:
187+
188+
```bash
189+
npm run install-all
190+
```
191+
192+
If you prefer to install packages manually:
193+
194+
```bash
195+
cd backend && npm install
196+
cd ../frontend && npm install
197+
cd ..
198+
```
199+
200+
### 6. Configure Environment Variables
201+
202+
Create the backend environment file at `backend/.env`:
203+
204+
```env
205+
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/web3-student-lab?schema=public"
206+
PORT=8080
207+
NODE_ENV=development
208+
JWT_SECRET=change-this-in-development
209+
```
210+
211+
Create the frontend environment file at `frontend/.env.local`:
212+
213+
```env
214+
NEXT_PUBLIC_API_URL=http://localhost:8080/api
215+
NEXT_PUBLIC_SOROBAN_RPC_URL=https://soroban-testnet.stellar.org
216+
NEXT_PUBLIC_CERTIFICATE_CONTRACT_ID=
217+
```
218+
219+
### 7. Start the Database
220+
221+
Choose one of the following options.
222+
223+
#### Option A: Use Docker Compose
224+
225+
From the project root:
226+
227+
```bash
228+
docker compose up -d db
229+
```
230+
231+
This starts PostgreSQL on `localhost:5432`.
232+
233+
#### Option B: Use a Local PostgreSQL Instance
234+
235+
Create a database named `web3-student-lab`, then make sure your `DATABASE_URL` in
236+
`backend/.env` matches your local PostgreSQL username and password.
237+
238+
### 8. Prepare the Backend Database
239+
240+
From the `backend/` directory:
241+
242+
```bash
243+
npx prisma generate
244+
npx prisma migrate deploy
245+
```
246+
247+
If you want seed data and the project requires it:
248+
249+
```bash
250+
npx prisma db seed
251+
```
252+
253+
### 9. Run the Applications
254+
255+
Run the backend:
256+
257+
```bash
258+
cd backend
259+
npm run dev
260+
```
261+
262+
In a second terminal, run the frontend:
263+
264+
```bash
265+
cd frontend
266+
npm run dev
267+
```
268+
269+
Or run both from the project root:
270+
271+
```bash
272+
npm run dev-all
273+
```
274+
275+
You can then access:
276+
277+
- Frontend: `http://localhost:3000`
278+
- Backend API: `http://localhost:8080`
279+
- Health check: `http://localhost:8080/health`
280+
281+
### 10. Build and Test the Soroban Contracts
282+
283+
From the `contracts/` directory, run:
284+
285+
```bash
286+
cargo test
287+
cargo build --target wasm32-unknown-unknown --release
288+
```
289+
290+
This will validate the Rust contracts and produce a WASM build for deployment.
291+
292+
### Quick Verification Checklist
293+
294+
Use these commands to confirm your setup is working:
295+
296+
```bash
297+
node --version
298+
rustc --version
299+
soroban --version
300+
cd backend && npm test
301+
cd ../contracts && cargo test
302+
```
303+
106304
## 🐳 Getting Started with Docker
107305

108306
The easiest way to set up the local development environment (backend and database) is using Docker

0 commit comments

Comments
 (0)