Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
to ana-chain readme with docker aurtto build/install composer up commanmds etc updated scripts in json..
  • Loading branch information
RastaDjuss authored Feb 12, 2025
1 parent 845587b commit f910681
Showing 1 changed file with 78 additions and 56 deletions.
134 changes: 78 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,94 +1,116 @@
# ana
# Ana-Chain

## Getting Started
Ana-Chain is a fullstack social application using Solana as a backend for decentralized governance.

### Prerequisites
---

- Node v18.18.0 or higher
### **Setup Commands Using `pnpm`**

- Rust v1.77.2 or higher
- Anchor CLI 0.30.1 or higher
- Solana CLI 1.18.17 or higher
Once the repository has been cloned, you can use `pnpm` commands to streamline development and build tasks. `pnpm` is a fast and efficient package manager, ideal for managing dependencies in a complex project.

### Installation
Here is the list of key commands:

#### Clone the repo
---

```shell
git clone <repo-url>
cd <repo-name>
```
### **Global Commands**

#### Install Dependencies
#### **`pnpm install`**
- Installs all the dependencies required for the project.
- This includes both frontend (`web`) and backend (`anchor`) dependencies, preparing the entire project in one step.
- **Note:** This process may take some time as it installs all dependencies for the fullstack project. You can monitor the progress in your terminal.

```shell
pnpm install
```
#### **`pnpm dev`**
- Starts the development server for the frontend React application with live reload enabled.
- Ideal for fast-paced development and real-time previews.

#### Start the web app
#### **`pnpm build`**
- Compiles and builds the frontend application for production. The final files are placed in the `out` directory.

```
pnpm dev
```
#### **`pnpm start`**
- Runs the production version of the frontend application, perfect for local verification before deployment.

## Apps
---

### anchor
### **Anchor-Related Commands**

This is a Solana program written in Rust using the Anchor framework.
#### **`pnpm anchor`**
- Allows you to run any Anchor CLI command directly from the root directory. Equivalent to navigating to the `anchor` directory and running the Anchor command.

#### Commands
Example:
```bash
pnpm anchor build
```

You can use any normal anchor commands. Either move to the `anchor` directory and run the `anchor` command or prefix the command with `pnpm`, eg: `pnpm anchor`.
#### **`pnpm anchor:build`**
- Compiles the Solana program in the `anchor` directory using `anchor build`.
- Useful if you want to build your smart contract manually without running the entire dev flow.

#### Sync the program id:
#### **`pnpm anchor-localnet`**
- Starts a local Solana validator and deploys the Anchor program to it.
- This is crucial for testing programs locally without relying on external networks.

Running this command will create a new keypair in the `anchor/target/deploy` directory and save the address to the Anchor config file and update the `declare_id!` macro in the `./src/lib.rs` file of the program.
#### **`pnpm anchor-test`**
- Runs tests for the Solana program using Anchor's built-in test framework.

You will manually need to update the constant in `anchor/lib/counter-exports.ts` to match the new program id.
#### **`pnpm anchor-deploy`**
- Deploys the current program onto the specified Solana blockchain configured in the `Anchor.toml` file.

```shell
pnpm anchor keys sync
```
---

#### Build the program:
### **Miscellaneous Commands**

```shell
pnpm anchor-build
```
#### **`pnpm lint-init`**
- Initializes ESLint for the project setup.

#### Start the test validator with the program deployed:

```shell
pnpm anchor-localnet
```
#### **`pnpm lint`**
- Runs ESLint and fixes style issues in `.js`, `.ts`, and `.tsx` files.

#### Run the tests
---

```shell
pnpm anchor-test
```
### **Project-Specific Dependency Installation**

#### Deploy to Devnet
#### **Frontend (governance-ui)**
To install dependencies specific to the frontend located in the `governance-ui` folder, use the following command:

```shell
pnpm anchor deploy --provider.cluster devnet
```bash
pnpm gov-ui-install
```

### web
This command navigates into the `governance-ui` directory and installs all its necessary dependencies using `pnpm install`.

This is a React app that uses the Anchor generated client to interact with the Solana program.
---

#### Commands
### **Quick Instructions**

Start the web app
#### Install dependencies:
```bash
pnpm install
```

```shell
#### Start the project in development mode:
```bash
pnpm dev
```

Build the web app
#### Compile the Anchor program:
```bash
pnpm anchor:build
```

#### Start a local Solana network:
```bash
pnpm anchor-localnet
```

---

## **Available Applications**

### **Anchor**
- This is a Solana program written in Rust using the Anchor framework.
- You can run all standard Anchor commands by either navigating to the `anchor` directory or prefixing your Anchor commands with `pnpm`.

```shell
pnpm build
Example:
```bash
pnpm anchor build
```

0 comments on commit f910681

Please sign in to comment.