This project is a clone of friend.tech build using stacks.
link: https://youtu.be/INeiKFHWJpc?si=AUcngvN7NmrdHL9j
To get the application running, follow these steps:
- Clone the repository:
git clone https://github.com/Aman-zishan/friend.tech.git
- Navigate into the directory:
cd friend.tech
- setup supabase client secret : create a .env file with the following content (development credentials).You could also create a fresh project with table
subjects
and column asroomId
in supabase
VITE_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im5rbGRucXFiaGlibmN2dnh2Y2ZrIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDE2ODc2NjIsImV4cCI6MjAxNzI2MzY2Mn0.H7LiOJFQT4jhCjmdhkVs3M5jLxjQQENhX30kiVKrMZ0
VITE_SUPABASE_PROJECT_URL=https://nkldnqqbhibncvvxvcfk.supabase.co
- Install the dependencies:
yarn install
- Start the frontend development server:
yarn dev
- Open a new terminal session
- Install the dependencies for the chat server:
cd server && yarn install
- Start the chat server:
yarn start
- Open the application in your browser:
http://localhost:5173/
Before getting into testing the application you need to spin up the devnet. This applications uses devnet to interact with the smart contract. To spin up the devnet, follow these steps:
In a new terminal session run the command:
clarinet integrate
- Once the devnet is up and running, import wallets to different browser accounts
- For testing we'll be using chrome user 1 as subject 1 and chrome user 2 as holder of this subject
- Import deployer wallet, go to
settings/Devnet.toml
and copy the mnemonic of the deployer account - Similarly import the mnemonic of any other wallet to be the holder
To run the contract tests, simply run yarn test
from the root directory. This will run the tests in the tests
directory.
-
Create a new account in the imported deployer wallet
-
set the protocol fee destination to the newly created account (only deployer can set the protocol fee destination) by calling
set-protocol-fee-destination
function from the deployed keys contract via stacks explorer sandbox
stacks explorer sandbox contract link : http://localhost:8000/sandbox/contract-call/ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.keys?chain=testnet&api=http://localhost:3999
-
Connect the deployer wallet to the application
-
The application will check if you have already bought the first key, if not then it will ask you to buy the first key (first key is free and allows the subject to create a profile)
-
Now you are redirected to the profile page, where you can trade keys
-
Now connect the holder wallet to the application in another browser
-
repeat the process of buying the first key