|
7 | 7 |
|
8 | 8 | ## Quick start
|
9 | 9 |
|
10 |
| -A self-contained Docker image is provided, which starts a Stacks 2.05 blockchain and API instance. |
| 10 | +### Local |
11 | 11 |
|
12 |
| -Ensure Docker is installed, then run the command: |
| 12 | +This service requires `postgres`, `stacks-node`, `bitcoind`, and a few other components in order to run. |
| 13 | +The [`clarinet`](https://github.com/hirosystems/clarinet) project provides an easy way to spin up the API and all these services: |
| 14 | +> clarinet devnet - a local standalone development environment that simulates Bitcoin, Stacks node and other helpful components, similar to a staging environment. |
13 | 15 |
|
14 |
| -```shell |
15 |
| -docker run -p 3999:3999 hirosystems/stacks-blockchain-api-standalone |
16 |
| -``` |
| 16 | +Get started at https://docs.hiro.so/clarinet/getting-started |
17 | 17 |
|
18 |
| -Similarly, a "mocknet" instance can be started. This runs a local node, isolated from the testnet/mainnet: |
| 18 | +### Production |
19 | 19 |
|
20 |
| -```shell |
21 |
| -docker run -p 3999:3999 -e STACKS_NETWORK=mocknet hirosystems/stacks-blockchain-api-standalone |
22 |
| -``` |
| 20 | +The docker image `hirosystems/stacks-blockchain-api` is recommended when running the API in a mainnet or testnet environment. |
| 21 | + |
| 22 | +Note that this image cannot be ran standalone. Other services need to be configured correctly and running. For more information see https://docs.hiro.so/stacks-blockchain-api/how-to-guides/how-to-run-api-node |
23 | 23 |
|
24 |
| -Once the blockchain has synced with the network, the API will be available at: |
25 |
| -[http://localhost:3999](http://localhost:3999) |
26 | 24 |
|
27 | 25 | ## Development quick start
|
28 | 26 |
|
29 | 27 | First, ensure Docker is installed on your machine.
|
30 | 28 |
|
31 | 29 | Clone repo and install dependencies with `npm install`.
|
32 | 30 |
|
33 |
| -Run `npm run dev:integrated`. |
| 31 | +VSCode is recommended for development. Pre-configured "run and debug" configurations are included. Run using `Launch: w/ postgres`. |
34 | 32 |
|
35 |
| -This command will concurrently start the API server app and the service dependencies. |
| 33 | +Alternatively, use the command `npm run dev:integrated` -- this command will concurrently start the API server app and the service dependencies. |
36 | 34 |
|
37 | 35 | Check to see if the server started successfully by visiting http://localhost:3999/extended/v1/status
|
38 | 36 |
|
39 | 37 | ## Local Development
|
40 | 38 |
|
41 |
| -### Setup Services |
42 |
| - |
43 |
| -Then run `npm run devenv:deploy`, which uses docker-compose to deploy the service dependencies (e.g., PostgreSQL, Stacks core node, etc.) |
44 |
| - |
45 |
| -### Running the server |
| 39 | +To run the server, run `npm run dev:integrated`, which uses docker-compose to deploy the service dependencies (e.g., PostgreSQL, Stacks core node, etc.). |
46 | 40 |
|
47 |
| -To run the server in 'watch' mode (restart for every code change), run `npm run dev:watch`. You'll have a server on port 3999. |
| 41 | +You'll have a server on port 3999. |
48 | 42 |
|
49 | 43 | # Architecture
|
50 | 44 |
|
|
0 commit comments