Skip to content

Commit

Permalink
change
Browse files Browse the repository at this point in the history
  • Loading branch information
enddynayn committed Oct 21, 2024
1 parent 3bdbddd commit 1e59699
Showing 1 changed file with 71 additions and 19 deletions.
90 changes: 71 additions & 19 deletions developer-docs/account/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
# Account Service

The Account Service is a crucial component of the Gateway suite, enabling easy interaction with DSNP accounts on Frequency. This document provides an overview of the service, its architecture, and guides for setup and usage.

## πŸ“— Table of Contents

- [πŸ“– About the Project](#about-project)
- [πŸ” Architecture Overview](#architecture-overview)
- [πŸ”‘ Key Features](#key-features)
- [πŸ’» Getting Started](#getting-started)
- [πŸš€ Live OpenAPI Docs](#live-docs)
- [πŸ“‹ Testing](#testing)
- [πŸ›  Built With](#built-with)
- [πŸš€ API Documentation](#api-documentation)
- [πŸ›  Development](#development)
- [🀝 Contributing](#contributing)
- [❓ FAQ](#faq)
- [πŸ“ License](#license)

## πŸ“– About the Project <a name="about-project"></a>

The Account Service is a crucial component of the Gateway suite, enabling easy interaction with [DSNP](https://dsnp.org/) accounts on [Frequency](https://docs.frequency.xyz/). It simplifies the management of user accounts, defined by a user's handle and MSA Id (Message Source Account Identifier).
The Account Service simplifies the management of user accounts, defined by a user's handle and MSA Id (Message Source Account Identifier) on the [Frequency](https://docs.frequency.xyz/) blockchain using [DSNP](https://dsnp.org/) protocols.

## πŸ” Architecture Overview <a name="architecture-overview"></a>

Expand All @@ -37,6 +38,8 @@ The Account Service is built using NestJS and is divided into two main component

## πŸ’» Getting Started <a name="getting-started"></a>

This section will guide you through setting up the Account Service for both quick start and local development.

### Prerequisites

Ensure you have the following installed:
Expand All @@ -46,22 +49,26 @@ Ensure you have the following installed:
### Quick Start

1. Clone the repository and navigate to the project directory:
```bash
git clone https://github.com/ProjectLibertyLabs/gateway.git
cd gateway
```bash
git clone https://github.com/ProjectLibertyLabs/gateway.git
cd gateway
```

2. Copy the environment template:
```bash
cp env-files/account.template.env .env.account
```
```bash
cp env-files/account.template.env .env.account
```

3. Install dependencies:
```bash
npm install
```
```bash
npm install
```

4. Start all services using Docker:
```bash
./scripts/account/restart-chain-docker.sh
```
```bash
./scripts/account/restart-chain-docker.sh
```

### Local Development (without containers)

If you prefer to run services locally for development:
Expand Down Expand Up @@ -91,21 +98,66 @@ If you prefer to run services locally for development:
- Access Swagger UI: [http://localhost:3000/api/docs/swagger](http://localhost:3000/api/docs/swagger)
- View and manage queues: [http://localhost:3000/queues](http://localhost:3000/queues)

### Next Steps

After setting up the Account Service, you can:
- Explore the API using the Swagger UI
- Run the test suite to ensure everything is working correctly
- Start integrating the Account Service into your application

For more detailed setup instructions, environment variable configuration, and advanced usage, please refer to our [comprehensive documentation](#).

## πŸš€ Live OpenAPI Docs <a name="live-docs"></a>
## πŸš€ API Documentation <a name="api-documentation"></a>

### Live OpenAPI Docs

Explore our [Live API Documentation](https://projectlibertylabs.github.io/account-service) for detailed information on endpoints and usage.

## πŸ“‹ Testing <a name="testing"></a>
## πŸ›  Development <a name="development"></a>

This section covers testing, debugging, and information about the technologies used in the Account Service.

### Testing

- Run E2E tests: `make test-e2e-account`
- Access Swagger UI: [http://localhost:3000/api/docs/swagger](http://localhost:3000/docs/swagger)
- Manage queues: [http://localhost:3000/queues](http://localhost:3000/queues)

For more testing options, including linting and debugging, please see the [Testing](#testing) section in the full documentation.

## πŸ›  Built With <a name="built-with"></a>
### Debugging

#### Using Docker

To stop containers, networks, volumes, and images created by `docker compose up`, run:

```bash
docker compose down
```

Note: You may need to manually remove containers using the Docker Desktop app.

#### Using the Debugger with VSCode

1. Follow step 1 from the Development Environment section above to set up the Redis and Frequency containers.

2. Use the debug panel and start the `Debug Api (NestJS via ts-node)` configuration to debug the API.

Use the debug panel and start the `Debug Worker (NestJS via ts-node)` configuration to debug the worker.

3. Set breakpoints in the code and debug your code.

4. Monitor the service worker jobs in [BullUI](http://0.0.0.0:3000/queues/).

Any API functions that require an extrinsic to be submitted to the blockchain will be queued here. The queue will manage the amount of `capacity` this service is allowed to use.

Reference the [Frequency Docs](https://docs.frequency.xyz/) for more information about extrinsics and capacity.

5. Use [Swagger](http://0.0.0.0:3000/api/docs/swagger) to test the API.

**Note:** Reference `.vscode/launch.json` for more details on the debug configurations and apply the concepts to your preferred debugger.

### Built With

- **Framework**: NestJS
- **Language**: TypeScript
Expand Down

0 comments on commit 1e59699

Please sign in to comment.