Project Setup
Scaffold your frontend, backend overlay, and key server using the full-stack template.
This page shows you how to scaffold the three core services for your Metanet Marketplace—frontend, backend overlay, and key server—using the full-stack template and a minimal Express/TypeScript setup.
1. Clone the full-stack template
1git clone https://github.com/p2ppsr/full-stack-project-template.git my-marketplace
2cd my-marketplace
3npm installThis gives you a working frontend/ and backend/ already wired for LARS and CARS. Refer to the LARS and CARS Quickstarts for an in-depth look at how these systems are set up from scratch.
2. Scaffold the key server
For this project, you will need to set up a separate server to store the encryption keys and to facilitate the payment and retrieval of the files. For now, just set up a bare minimum express server and the general structure that we will build upon in later steps:
1## from repo root
2mkdir key-server && cd key-server
3
4npm init -y
5npm install express
6npm install --save-dev typescript ts-node-dev @types/node @types/expresskey-server/tsconfig.json
1{
2 "compilerOptions": {
3 "lib": [
4 "dom",
5 "ESNext"
6 ],
7 "module": "NodeNext",
8 "target": "esnext",
9 "moduleResolution": "NodeNext",
10 "moduleDetection": "force",
11 "rootDir": "./",
12 "baseUrl": "./",
13 "outDir": "./dist",
14 "strict": true,
15 "isolatedModules": true,
16 "strictNullChecks": true,
17 "downlevelIteration": false,
18 "skipLibCheck": true,
19 "forceConsistentCasingInFileNames": true,
20 "incremental": true,
21 "sourceMap": true,
22 "emitDecoratorMetadata": true,
23 "experimentalDecorators": true,
24 "resolveJsonModule": true,
25 "esModuleInterop": true,
26 "typeRoots": ["./node_modules/@types", "src/types"]
27 },
28 "include": [
29 "src",
30 "src/types.d.ts",
31 "jest.config.js",
32 "tsconfig.json",
33 "jest.config.js",
34 "tsconfig.json",
35 "src/types/authrite-express.d.ts"
36 ],
37 "exclude": [
38 "dist",
39 "*/**/__tests__"
40 ]
41}key-server/src/index.ts
1import express from 'express';
2const app = express();
3const port = process.env.PORT || 3000;
4
5app.listen(port, () =>
6 console.log(`Key Server listening at http://localhost:${port}`)
7);key-server/package.json
1"scripts": {
2+ "start": "ts-node-dev --respawn src/index.ts"
3}3. Verify your directory tree
Your codebase should now resemble:
1my-marketplace/
2├── backend/
3│ ├── src/ ← Overlay backend code
4│ └── package.json
5├── frontend/
6│ ├── src/ ← React + Vite code
7│ ├── vite.config.ts
8│ └── package.json
9├── key-server/
10│ ├── src/ ← Express + TS key server
11│ │ └── index.ts
12│ ├── tsconfig.json
13│ └── package.json
14├── deployment-info.json
15└── package.json ← root4. Initial smoke testing
You will want two separate terminals:
One to run the frontend and backend using LARS:
1# from root
2npx lars start- Select either
mainnetortestnetas the network (mainnet is recommended). - Be sure to select both the
frontendandbackendfor the services.
And one to run the key-server:
1cd key-server
2npm run start- Frontend → React app at http://localhost:5173
- Backend overlay → Overlay engine logs in the terminal
- Key Server → “Key Server listening” message
If everything starts without errors, you’re ready for the next step: wiring up your Upload Files page, Topic Manager, Lookup Service, and Key Server routes.
